diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/src/main/java/io/entgra/device/mgt/core/analytics/mgt/grafana/proxy/api/GrafanaAPIProxyService.java b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/src/main/java/io/entgra/device/mgt/core/analytics/mgt/grafana/proxy/api/GrafanaAPIProxyService.java index c7081b8b97..afbf98d345 100644 --- a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/src/main/java/io/entgra/device/mgt/core/analytics/mgt/grafana/proxy/api/GrafanaAPIProxyService.java +++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/src/main/java/io/entgra/device/mgt/core/analytics/mgt/grafana/proxy/api/GrafanaAPIProxyService.java @@ -18,25 +18,12 @@ package io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api; import com.google.gson.JsonObject; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.Extension; -import io.swagger.annotations.ExtensionProperty; -import io.swagger.annotations.Info; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; import io.entgra.device.mgt.core.apimgt.annotations.Scope; import io.entgra.device.mgt.core.apimgt.annotations.Scopes; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.UriInfo; +import io.swagger.annotations.*; + +import javax.ws.rs.*; +import javax.ws.rs.core.*; @SwaggerDefinition( info = @Info( diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/src/main/java/io/entgra/device/mgt/core/analytics/mgt/grafana/proxy/api/addons/ApiOriginFilter.java b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/src/main/java/io/entgra/device/mgt/core/analytics/mgt/grafana/proxy/api/addons/ApiOriginFilter.java index 59c2fccc32..2a336fa4c4 100644 --- a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/src/main/java/io/entgra/device/mgt/core/analytics/mgt/grafana/proxy/api/addons/ApiOriginFilter.java +++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/src/main/java/io/entgra/device/mgt/core/analytics/mgt/grafana/proxy/api/addons/ApiOriginFilter.java @@ -18,12 +18,7 @@ package io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api.addons; -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.*; import javax.servlet.http.HttpServletResponse; import java.io.IOException; diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/src/main/java/io/entgra/device/mgt/core/analytics/mgt/grafana/proxy/api/addons/ValidationInterceptor.java b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/src/main/java/io/entgra/device/mgt/core/analytics/mgt/grafana/proxy/api/addons/ValidationInterceptor.java index b4078f20d6..dcd75926bd 100644 --- a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/src/main/java/io/entgra/device/mgt/core/analytics/mgt/grafana/proxy/api/addons/ValidationInterceptor.java +++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/src/main/java/io/entgra/device/mgt/core/analytics/mgt/grafana/proxy/api/addons/ValidationInterceptor.java @@ -28,11 +28,7 @@ import org.apache.cxf.message.MessageContentsList; import org.apache.cxf.phase.AbstractPhaseInterceptor; import org.apache.cxf.phase.Phase; -import javax.validation.ConstraintViolation; -import javax.validation.ConstraintViolationException; -import javax.validation.Validation; -import javax.validation.Validator; -import javax.validation.ValidatorFactory; +import javax.validation.*; import javax.validation.executable.ExecutableValidator; import java.lang.reflect.Method; import java.util.List; diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/src/main/java/io/entgra/device/mgt/core/analytics/mgt/grafana/proxy/api/impl/GrafanaAPIProxyServiceImpl.java b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/src/main/java/io/entgra/device/mgt/core/analytics/mgt/grafana/proxy/api/impl/GrafanaAPIProxyServiceImpl.java index 9c91a23e2b..6121f78ddd 100644 --- a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/src/main/java/io/entgra/device/mgt/core/analytics/mgt/grafana/proxy/api/impl/GrafanaAPIProxyServiceImpl.java +++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/src/main/java/io/entgra/device/mgt/core/analytics/mgt/grafana/proxy/api/impl/GrafanaAPIProxyServiceImpl.java @@ -27,20 +27,12 @@ import io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common.exception.Gr import io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core.bean.GrafanaPanelIdentifier; import io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core.exception.MaliciousQueryAttempt; import io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core.internal.GrafanaMgtDataHolder; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DBConnectionException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DBConnectionException; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.UriInfo; +import javax.ws.rs.*; +import javax.ws.rs.core.*; import java.io.IOException; import java.sql.SQLException; diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/src/main/java/io/entgra/device/mgt/core/analytics/mgt/grafana/proxy/api/impl/util/GrafanaRequestHandlerUtil.java b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/src/main/java/io/entgra/device/mgt/core/analytics/mgt/grafana/proxy/api/impl/util/GrafanaRequestHandlerUtil.java index d81a6d4d26..ddc36731db 100644 --- a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/src/main/java/io/entgra/device/mgt/core/analytics/mgt/grafana/proxy/api/impl/util/GrafanaRequestHandlerUtil.java +++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.api/src/main/java/io/entgra/device/mgt/core/analytics/mgt/grafana/proxy/api/impl/util/GrafanaRequestHandlerUtil.java @@ -25,6 +25,8 @@ import io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core.bean.GrafanaPa import io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core.exception.GrafanaEnvVariablesNotDefined; import io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core.util.GrafanaConstants; import io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core.util.GrafanaUtil; +import io.entgra.device.mgt.core.device.mgt.core.common.util.HttpUtil; +import io.entgra.device.mgt.core.device.mgt.core.report.mgt.Constants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.HttpResponse; @@ -35,8 +37,6 @@ import org.apache.http.client.methods.HttpRequestBase; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; -import io.entgra.device.mgt.core.device.mgt.core.common.util.HttpUtil; -import io.entgra.device.mgt.core.device.mgt.core.report.mgt.Constants; import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.MediaType; diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common/pom.xml b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common/pom.xml index 940ea30eae..a05f1959a3 100644 --- a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common/pom.xml +++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common/pom.xml @@ -35,6 +35,14 @@ + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + org.apache.felix maven-bundle-plugin @@ -48,12 +56,6 @@ io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common.* - - javax.xml.bind.annotation; version="${javax.xml.bind.imp.pkg.version}", - com.fasterxml.jackson.annotation;version="${jackson-annotations.version}", - io.swagger.annotations; version="${swagger.annotations.version}"; resolution:=optional, - com.google.gson - diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml index 4620a73d5f..2e2888b88a 100644 --- a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml +++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/pom.xml @@ -35,10 +35,6 @@ - - org.apache.felix - maven-scr-plugin - org.jacoco jacoco-maven-plugin @@ -65,6 +61,14 @@ + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + org.apache.felix maven-bundle-plugin @@ -77,15 +81,47 @@ Grafana API Management Core Bundle io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core.internal - io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common.*, - javax.xml.parsers;version="${javax.xml.parsers.import.pkg.version}";resolution:=optional, - javax.xml.bind.annotation, - javax.xml.bind, - org.apache.commons.lang, - org.wso2.carbon, - io.entgra.device.mgt.core.device.mgt.common.*, - io.entgra.device.mgt.core.device.mgt.core.* - io.entgra.device.mgt.core.application.mgt.core.* + com.google.common.cache;version="[31.0,32)", + com.google.gson;version="[2.9,3)", + io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common.exception;version="[5.0,6)", + io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core.bean, + io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core.config, + io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core.config.xml.bean, + io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core.exception, + io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core.service, + io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core.service.bean, + io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core.service.cache, + io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core.service.impl, + io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core.sql.connection, + io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core.sql.query, + io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core.sql.query.encoder, + io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core.util, + io.entgra.device.mgt.core.application.mgt.common.exception;version="[5.0,6)", + io.entgra.device.mgt.core.application.mgt.core.config;version="[5.0,6)", + io.entgra.device.mgt.core.application.mgt.core.util;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.exceptions;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.core.common.util;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.core.config;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.core.config.datasource;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.core.dao;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.core.report.mgt.config;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.core.report.mgt.dao.common;version="[5.0,6)", + javax.xml.bind;version="[0.0,1)", + javax.xml.bind.annotation;version="[0.0,1)", + javax.xml.parsers, + org.apache.commons.codec.binary;version="[1.9,2)", + org.apache.commons.lang;version="[2.6,3)", + org.apache.commons.lang3;version="[3.1,4)", + org.apache.commons.logging;version="[1.2,2)", + org.apache.http;version="[4.4,5)", + org.apache.http.client, + org.apache.http.client.methods, + org.apache.http.impl.client, + org.apache.juli.logging;version="[9.0,10)", + org.osgi.framework.*;version="${imp.package.version.osgi.framework}", + org.osgi.service.*;version="${imp.package.version.osgi.service}", + org.w3c.dom,org.wso2.carbon.context;version="[4.8,5)", + org.wso2.carbon.utils;version="[4.8,5)" !io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core.internal, @@ -103,15 +139,12 @@ - org.eclipse.osgi - org.eclipse.osgi - - - org.eclipse.osgi - org.eclipse.osgi.services + org.apache.felix + org.apache.felix.scr.ds-annotations + provided - org.wso2.orbit.org.scannotation + io.entgra.org.scannotation scannotation @@ -132,7 +165,6 @@ org.ops4j.pax.logging pax-logging-api provided - org.wso2.carbon @@ -246,14 +278,6 @@ org.apache.ws.commons.axiom.wso2 axiom - org.apache.axis2.wso2 axis2 diff --git a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/src/main/java/io/entgra/device/mgt/core/analytics/mgt/grafana/proxy/core/internal/GrafanaManagementServiceComponent.java b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/src/main/java/io/entgra/device/mgt/core/analytics/mgt/grafana/proxy/core/internal/GrafanaManagementServiceComponent.java index 8438c61156..8d53ce7ab3 100644 --- a/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/src/main/java/io/entgra/device/mgt/core/analytics/mgt/grafana/proxy/core/internal/GrafanaManagementServiceComponent.java +++ b/components/analytics-mgt/grafana-mgt/io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core/src/main/java/io/entgra/device/mgt/core/analytics/mgt/grafana/proxy/core/internal/GrafanaManagementServiceComponent.java @@ -26,16 +26,19 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.framework.BundleContext; import org.osgi.service.component.ComponentContext; -import org.wso2.carbon.context.PrivilegedCarbonContext; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; -/** - * @scr.component name="io.entgra.analytics.mgt.grafana.proxy.grafanamanagementservicecomponent" immediate="true" - */ +@Component( + name = "io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core.internal.GrafanaManagementServiceComponent", + immediate = true) public class GrafanaManagementServiceComponent { private static Log log = LogFactory.getLog(GrafanaManagementServiceComponent.class); @SuppressWarnings("unused") + @Activate protected void activate(ComponentContext componentContext) { try { if (log.isDebugEnabled()) { @@ -60,6 +63,7 @@ public class GrafanaManagementServiceComponent { } @SuppressWarnings("unused") + @Deactivate protected void deactivate(ComponentContext componentContext) { if (log.isDebugEnabled()) { log.debug("De-activating Grafana Management Service Component"); diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/pom.xml index ad232780c8..e647b5f2dc 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/pom.xml @@ -27,9 +27,14 @@ io.entgra.device.mgt.core.apimgt.analytics.extension bundle Entgra - API mgt analytics extension - http://wso2.org + https://entgra.io + + org.apache.felix + org.apache.felix.scr.ds-annotations + provided + org.wso2.carbon org.wso2.carbon.core @@ -40,7 +45,7 @@ org.apache.velocity - velocity + velocity-engine-core @@ -56,8 +61,12 @@ - org.apache.felix - maven-scr-plugin + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + org.apache.felix @@ -72,10 +81,11 @@ io.entgra.device.mgt.core.apimgt.application.extension.internal io.entgra.device.mgt.core.apimgt.analytics.extension.dto, + io.entgra.device.mgt.core.apimgt.analytics.extension.exception, org.apache.velocity, org.apache.velocity.app, org.apache.velocity.context, - org.wso2.carbon.utils;version="[4.6,5)" + org.wso2.carbon.utils;version="[4.8,5)" io.entgra.device.mgt.core.apimgt.analytics.extension.* diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/src/main/java/io/entgra/device/mgt/core/apimgt/analytics/extension/AnalyticsArtifactsDeployer.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/src/main/java/io/entgra/device/mgt/core/apimgt/analytics/extension/AnalyticsArtifactsDeployer.java index ce92682a23..8d7e273633 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/src/main/java/io/entgra/device/mgt/core/apimgt/analytics/extension/AnalyticsArtifactsDeployer.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.analytics.extension/src/main/java/io/entgra/device/mgt/core/apimgt/analytics/extension/AnalyticsArtifactsDeployer.java @@ -27,16 +27,11 @@ import io.entgra.device.mgt.core.apimgt.analytics.extension.exception.EventStrea import org.apache.velocity.Template; import org.apache.velocity.VelocityContext; import org.apache.velocity.app.VelocityEngine; - import org.apache.velocity.runtime.RuntimeConstants; import org.wso2.carbon.utils.CarbonUtils; import org.wso2.carbon.utils.multitenancy.MultitenantConstants; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.PrintWriter; -import java.io.StringWriter; -import java.io.UnsupportedEncodingException; +import java.io.*; public class AnalyticsArtifactsDeployer { diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.annotations/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.annotations/pom.xml index 063c05be92..1732b47585 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.annotations/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.annotations/pom.xml @@ -31,22 +31,18 @@ bundle WSO2 Carbon - API Management Annotations WSO2 Carbon - API Management Custom Annotation Module - http://wso2.org + https://entgra.io - org.eclipse.osgi - org.eclipse.osgi - - - org.eclipse.osgi - org.eclipse.osgi.services + org.apache.felix + org.apache.felix.scr.ds-annotations + provided org.ops4j.pax.logging pax-logging-api provided - javax.ws.rs @@ -56,8 +52,12 @@ - org.apache.felix - maven-scr-plugin + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + org.apache.felix @@ -72,15 +72,6 @@ io.entgra.device.mgt.core.apimgt.annotations.* - - org.osgi.framework.*;version="${imp.package.version.osgi.framework}", - org.osgi.service.*;version="${imp.package.version.osgi.service}", - org.apache.commons.logging, - javax.servlet, - javax.xml.*, - javax.xml.parsers;version="${javax.xml.parsers.import.pkg.version}";resolution:=optional, - org.apache.commons.lang - scribe;scope=compile|runtime;inline=false; diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml index 4006f67cf4..37082c6fc6 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/pom.xml @@ -30,7 +30,7 @@ war WSO2 Carbon - API Application Management API This module provides capability to create api manager application. - http://wso2.org + https://entgra.io @@ -159,10 +159,6 @@ org.wso2.carbon.registry.core provided - - org.wso2.orbit.javax.xml.bind - jaxb-api - diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/src/main/java/io/entgra/device/mgt/core/apimgt/application/extension/api/ApiApplicationRegistrationServiceImpl.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/src/main/java/io/entgra/device/mgt/core/apimgt/application/extension/api/ApiApplicationRegistrationServiceImpl.java index 5dc89a80c4..f3fb909372 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/src/main/java/io/entgra/device/mgt/core/apimgt/application/extension/api/ApiApplicationRegistrationServiceImpl.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/src/main/java/io/entgra/device/mgt/core/apimgt/application/extension/api/ApiApplicationRegistrationServiceImpl.java @@ -18,18 +18,18 @@ package io.entgra.device.mgt.core.apimgt.application.extension.api; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.apimgt.application.extension.APIManagementProviderService; import io.entgra.device.mgt.core.apimgt.application.extension.api.util.APIUtil; import io.entgra.device.mgt.core.apimgt.application.extension.api.util.RegistrationProfile; import io.entgra.device.mgt.core.apimgt.application.extension.constants.ApiApplicationConstants; import io.entgra.device.mgt.core.apimgt.application.extension.dto.ApiApplicationKey; import io.entgra.device.mgt.core.apimgt.application.extension.exception.APIManagerException; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.wso2.carbon.base.MultitenantConstants; import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import org.wso2.carbon.user.api.UserStoreException; import javax.ws.rs.POST; diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/src/main/java/io/entgra/device/mgt/core/apimgt/application/extension/api/filter/ApiPermissionFilter.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/src/main/java/io/entgra/device/mgt/core/apimgt/application/extension/api/filter/ApiPermissionFilter.java index 3db47a1f16..50bab8861f 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/src/main/java/io/entgra/device/mgt/core/apimgt/application/extension/api/filter/ApiPermissionFilter.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/src/main/java/io/entgra/device/mgt/core/apimgt/application/extension/api/filter/ApiPermissionFilter.java @@ -17,20 +17,15 @@ */ package io.entgra.device.mgt.core.apimgt.application.extension.api.filter; +import io.entgra.device.mgt.core.apimgt.application.extension.api.util.APIUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.apimgt.application.extension.api.util.APIUtil; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.user.api.UserRealm; import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.utils.multitenancy.MultitenantUtils; -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.*; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.xml.bind.JAXBContext; diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/src/main/java/io/entgra/device/mgt/core/apimgt/application/extension/api/util/APIUtil.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/src/main/java/io/entgra/device/mgt/core/apimgt/application/extension/api/util/APIUtil.java index 3be91a559e..f56ec6831b 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/src/main/java/io/entgra/device/mgt/core/apimgt/application/extension/api/util/APIUtil.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.api/src/main/java/io/entgra/device/mgt/core/apimgt/application/extension/api/util/APIUtil.java @@ -18,13 +18,13 @@ package io.entgra.device.mgt.core.apimgt.application.extension.api.util; +import io.entgra.device.mgt.core.apimgt.application.extension.APIManagementProviderService; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; +import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.apimgt.application.extension.APIManagementProviderService; import org.wso2.carbon.base.MultitenantConstants; import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; -import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; import org.wso2.carbon.registry.api.Resource; import org.wso2.carbon.registry.core.Registry; import org.wso2.carbon.registry.core.exceptions.RegistryException; diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml index d9a1370d00..ed7542738a 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/pom.xml @@ -31,9 +31,14 @@ bundle WSO2 Carbon - API Application Management This module provides capability to create api manager application. - http://wso2.org + https://entgra.io + + org.apache.felix + org.apache.felix.scr.ds-annotations + provided + org.wso2.carbon org.wso2.carbon.registry.core @@ -93,8 +98,12 @@ - org.apache.felix - maven-scr-plugin + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + org.apache.felix @@ -108,9 +117,16 @@ API Management Application Bundle io.entgra.device.mgt.core.apimgt.application.extension.internal + io.entgra.device.mgt.core.apimgt.application.extension.bean, + io.entgra.device.mgt.core.apimgt.application.extension.dto, + io.entgra.device.mgt.core.apimgt.application.extension.exception, + io.entgra.device.mgt.core.identity.jwt.client.extension;version="[5.0,6)", + io.entgra.device.mgt.core.identity.jwt.client.extension.dto;version="[5.0,6)", + io.entgra.device.mgt.core.identity.jwt.client.extension.exception;version="[5.0,6)", + io.entgra.device.mgt.core.identity.jwt.client.extension.service;version="[5.0,6)", org.apache.commons.lang;version="[2.6,3)", org.apache.commons.logging;version="[1.2,2)", - org.json.simple, + org.json.simple;version="[1.1,2)", org.osgi.framework.*;version="${imp.package.version.osgi.framework}", org.osgi.service.*;version="${imp.package.version.osgi.service}", org.wso2.carbon.apimgt.api;version="${carbon.api.mgt.version.range}", @@ -127,12 +143,18 @@ io.entgra.device.mgt.core.identity.jwt.client.extension.exception, io.entgra.device.mgt.core.identity.jwt.client.extension.service, io.entgra.device.mgt.core.apimgt.extension.rest.api, + org.wso2.carbon.apimgt.api;version="[9.28,10)", + org.wso2.carbon.apimgt.api.dto;version="[9.28,10)", + org.wso2.carbon.apimgt.api.model;version="[9.28,10)", + org.wso2.carbon.apimgt.impl;version="[9.28,10)", + org.wso2.carbon.apimgt.impl.utils;version="[9.28,10)", + org.wso2.carbon.context;version="[4.8,5)", org.wso2.carbon.registry.core.exceptions;version="[1.0,2)", org.wso2.carbon.registry.core.service;version="[1.0,2)", - org.wso2.carbon.registry.indexing.service;version="${carbon.registry.imp.pkg.version.range}", + org.wso2.carbon.registry.indexing.service;version="[4.8,5)", org.wso2.carbon.user.api;version="[1.0,2)", - org.wso2.carbon.user.core.service;version="${carbon.kernel.version.range}", - org.wso2.carbon.user.core.tenant;version="${carbon.kernel.version.range}" + org.wso2.carbon.user.core.service;version="[4.8,5)", + org.wso2.carbon.user.core.tenant;version="[4.8,5)" !io.entgra.device.mgt.core.apimgt.application.extension.internal, diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/src/main/java/io/entgra/device/mgt/core/apimgt/application/extension/APIManagementProviderServiceImpl.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/src/main/java/io/entgra/device/mgt/core/apimgt/application/extension/APIManagementProviderServiceImpl.java index 1bf3d1ded1..67bf9ef56b 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/src/main/java/io/entgra/device/mgt/core/apimgt/application/extension/APIManagementProviderServiceImpl.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/src/main/java/io/entgra/device/mgt/core/apimgt/application/extension/APIManagementProviderServiceImpl.java @@ -18,6 +18,16 @@ package io.entgra.device.mgt.core.apimgt.application.extension; +import io.entgra.device.mgt.core.apimgt.application.extension.bean.APIRegistrationProfile; +import io.entgra.device.mgt.core.apimgt.application.extension.constants.ApiApplicationConstants; +import io.entgra.device.mgt.core.apimgt.application.extension.dto.ApiApplicationKey; +import io.entgra.device.mgt.core.apimgt.application.extension.exception.APIManagerException; +import io.entgra.device.mgt.core.apimgt.application.extension.internal.APIApplicationManagerExtensionDataHolder; +import io.entgra.device.mgt.core.apimgt.application.extension.util.APIManagerUtil; +import io.entgra.device.mgt.core.identity.jwt.client.extension.JWTClient; +import io.entgra.device.mgt.core.identity.jwt.client.extension.dto.AccessTokenInfo; +import io.entgra.device.mgt.core.identity.jwt.client.extension.exception.JWTClientException; +import io.entgra.device.mgt.core.identity.jwt.client.extension.service.JWTClientManagerService; import io.entgra.device.mgt.core.apimgt.extension.rest.api.APIApplicationServices; import io.entgra.device.mgt.core.apimgt.extension.rest.api.ConsumerRESTAPIServices; import io.entgra.device.mgt.core.apimgt.extension.rest.api.bean.APIMConsumer.APIInfo; @@ -41,21 +51,11 @@ import org.wso2.carbon.apimgt.api.model.ApiTypeWrapper; import org.wso2.carbon.apimgt.api.model.Application; import org.wso2.carbon.apimgt.api.model.SubscribedAPI; import org.wso2.carbon.apimgt.api.model.Subscriber; -import io.entgra.device.mgt.core.apimgt.application.extension.bean.APIRegistrationProfile; -import io.entgra.device.mgt.core.apimgt.application.extension.constants.ApiApplicationConstants; -import io.entgra.device.mgt.core.apimgt.application.extension.dto.ApiApplicationKey; -import io.entgra.device.mgt.core.apimgt.application.extension.exception.APIManagerException; -import io.entgra.device.mgt.core.apimgt.application.extension.internal.APIApplicationManagerExtensionDataHolder; -import io.entgra.device.mgt.core.apimgt.application.extension.util.APIManagerUtil; import org.wso2.carbon.apimgt.impl.APIAdminImpl; import org.wso2.carbon.apimgt.impl.APIConstants; import org.wso2.carbon.apimgt.impl.APIManagerFactory; import org.wso2.carbon.apimgt.impl.utils.APIUtil; import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.identity.jwt.client.extension.JWTClient; -import io.entgra.device.mgt.core.identity.jwt.client.extension.dto.AccessTokenInfo; -import io.entgra.device.mgt.core.identity.jwt.client.extension.exception.JWTClientException; -import io.entgra.device.mgt.core.identity.jwt.client.extension.service.JWTClientManagerService; import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.utils.multitenancy.MultitenantConstants; diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/src/main/java/io/entgra/device/mgt/core/apimgt/application/extension/dto/ApiApplicationKey.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/src/main/java/io/entgra/device/mgt/core/apimgt/application/extension/dto/ApiApplicationKey.java index 3c14bbb3d8..526d36cd60 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/src/main/java/io/entgra/device/mgt/core/apimgt/application/extension/dto/ApiApplicationKey.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/src/main/java/io/entgra/device/mgt/core/apimgt/application/extension/dto/ApiApplicationKey.java @@ -18,8 +18,8 @@ package io.entgra.device.mgt.core.apimgt.application.extension.dto; -import org.json.simple.JSONObject; import io.entgra.device.mgt.core.apimgt.application.extension.constants.ApiApplicationConstants; +import org.json.simple.JSONObject; /** * This holds api application consumer key and secret. diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/src/main/java/io/entgra/device/mgt/core/apimgt/application/extension/internal/APIApplicationManagerExtensionServiceComponent.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/src/main/java/io/entgra/device/mgt/core/apimgt/application/extension/internal/APIApplicationManagerExtensionServiceComponent.java index b2f82e6c31..f761bfbf38 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/src/main/java/io/entgra/device/mgt/core/apimgt/application/extension/internal/APIApplicationManagerExtensionServiceComponent.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/src/main/java/io/entgra/device/mgt/core/apimgt/application/extension/internal/APIApplicationManagerExtensionServiceComponent.java @@ -19,54 +19,25 @@ package io.entgra.device.mgt.core.apimgt.application.extension.internal; import io.entgra.device.mgt.core.apimgt.extension.rest.api.APIApplicationServices; import io.entgra.device.mgt.core.apimgt.extension.rest.api.ConsumerRESTAPIServices; +import io.entgra.device.mgt.core.apimgt.application.extension.APIManagementProviderService; +import io.entgra.device.mgt.core.apimgt.application.extension.APIManagementProviderServiceImpl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.framework.BundleContext; -import org.osgi.service.component.ComponentContext;; -import io.entgra.device.mgt.core.apimgt.application.extension.APIManagementProviderService; -import io.entgra.device.mgt.core.apimgt.application.extension.APIManagementProviderServiceImpl; +import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.*; import org.wso2.carbon.registry.core.service.TenantRegistryLoader; import org.wso2.carbon.registry.indexing.service.TenantIndexingLoader; import org.wso2.carbon.user.core.service.RealmService; -/** - * @scr.component name="io.entgra.device.mgt.core.apimgt.application.extension.internal.APIApplicationManagerExtensionServiceComponent" - * @scr.reference name="tenant.registryloader" - * interface="org.wso2.carbon.registry.core.service.TenantRegistryLoader" - * cardinality="1..1" - * policy="dynamic" - * bind="setTenantRegistryLoader" - * unbind="unsetTenantRegistryLoader" - * @scr.reference name="tenant.indexloader" - * interface="org.wso2.carbon.registry.indexing.service.TenantIndexingLoader" - * cardinality="1..1" - * policy="dynamic" - * bind="setIndexLoader" - * unbind="unsetIndexLoader" - * @scr.reference name="realm.service" - * immediate="true" - * interface="org.wso2.carbon.user.core.service.RealmService" - * cardinality="1..1" - * policy="dynamic" - * bind="setRealmService" - * unbind="unsetRealmService" - * @scr.reference name="apimgt.extension.ConsumerRESTAPIServices" - * interface="io.entgra.device.mgt.core.apimgt.extension.rest.api.ConsumerRESTAPIServices" - * cardinality="0..1" - * policy="dynamic" - * bind="setConsumerRESTAPIServices" - * unbind="unsetConsumerRESTAPIServices" - * @scr.reference name="apimgt.extension.APIApplicationService" - * interface="io.entgra.device.mgt.core.apimgt.extension.rest.api.APIApplicationServices" - * cardinality="0..1" - * policy="dynamic" - * bind="setAPIApplicationServices" - * unbind="unsetAPIApplicationServices" - */ +@Component( + name = "io.entgra.device.mgt.core.apimgt.application.extension.internal.APIApplicationManagerExtensionServiceComponent", + immediate = true) public class APIApplicationManagerExtensionServiceComponent { private static final Log log = LogFactory.getLog(APIApplicationManagerExtensionServiceComponent.class); + @Activate protected void activate(ComponentContext componentContext) { try { if (log.isDebugEnabled()) { @@ -81,10 +52,17 @@ public class APIApplicationManagerExtensionServiceComponent { } } + @Deactivate protected void deactivate(ComponentContext componentContext) { //do nothing } + @Reference( + name = "tenant.registry.loader", + service = org.wso2.carbon.registry.core.service.TenantRegistryLoader.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetTenantRegistryLoader") protected void setTenantRegistryLoader(TenantRegistryLoader tenantRegistryLoader) { APIApplicationManagerExtensionDataHolder.getInstance().setTenantRegistryLoader(tenantRegistryLoader); } @@ -93,6 +71,12 @@ public class APIApplicationManagerExtensionServiceComponent { APIApplicationManagerExtensionDataHolder.getInstance().setTenantRegistryLoader(null); } + @Reference( + name = "tenant.index.loader", + service = org.wso2.carbon.registry.indexing.service.TenantIndexingLoader.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetIndexLoader") protected void setIndexLoader(TenantIndexingLoader indexLoader) { if (indexLoader != null && log.isDebugEnabled()) { log.debug("IndexLoader service initialized"); @@ -109,6 +93,12 @@ public class APIApplicationManagerExtensionServiceComponent { * * @param realmService An instance of RealmService */ + @Reference( + name = "realm.service", + service = org.wso2.carbon.user.core.service.RealmService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRealmService") protected void setRealmService(RealmService realmService) { if (log.isDebugEnabled()) { log.debug("Setting Realm Service"); @@ -133,6 +123,12 @@ public class APIApplicationManagerExtensionServiceComponent { * * @param consumerRESTAPIServices An instance of ConsumerRESTAPIServices */ + @Reference( + name = "APIM.consumer.service", + service = io.entgra.device.mgt.core.apimgt.extension.rest.api.ConsumerRESTAPIServices.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetConsumerRESTAPIServices") protected void setConsumerRESTAPIServices(ConsumerRESTAPIServices consumerRESTAPIServices) { if (log.isDebugEnabled()) { log.debug("Setting APIM Consumer REST API Service"); @@ -158,6 +154,12 @@ public class APIApplicationManagerExtensionServiceComponent { * * @param apiApplicationServices An instance of APIApplicationServices */ + @Reference( + name = "APIM.application.service", + service = io.entgra.device.mgt.core.apimgt.extension.rest.api.APIApplicationServices.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetAPIApplicationServices") protected void setAPIApplicationServices(APIApplicationServices apiApplicationServices) { if (log.isDebugEnabled()) { log.debug("Setting DCR REST API Service"); @@ -176,5 +178,4 @@ public class APIApplicationManagerExtensionServiceComponent { } APIApplicationManagerExtensionDataHolder.getInstance().setApiApplicationServices(null); } - } diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/src/main/java/io/entgra/device/mgt/core/apimgt/application/extension/util/APIManagerUtil.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/src/main/java/io/entgra/device/mgt/core/apimgt/application/extension/util/APIManagerUtil.java index d86fdcd77e..a98e1ce632 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/src/main/java/io/entgra/device/mgt/core/apimgt/application/extension/util/APIManagerUtil.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension/src/main/java/io/entgra/device/mgt/core/apimgt/application/extension/util/APIManagerUtil.java @@ -17,10 +17,10 @@ */ package io.entgra.device.mgt.core.apimgt.application.extension.util; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.apimgt.application.extension.exception.APIManagerException; import io.entgra.device.mgt.core.apimgt.application.extension.internal.APIApplicationManagerExtensionDataHolder; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.wso2.carbon.base.MultitenantConstants; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.registry.core.exceptions.RegistryException; diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml index 60c28d0b2c..7d4ef0501d 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/pom.xml @@ -34,6 +34,11 @@ https://entgra.io + + org.apache.felix + org.apache.felix.scr.ds-annotations + provided + commons-httpclient.wso2 commons-httpclient @@ -54,17 +59,6 @@ org.wso2.carbon.core provided - - org.eclipse.osgi - org.eclipse.osgi - provided - - - org.eclipse.osgi - org.eclipse.osgi.services - provided - - org.json.wso2 json @@ -89,8 +83,12 @@ - org.apache.felix - maven-scr-plugin + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + org.apache.felix @@ -110,17 +108,23 @@ io.entgra.device.mgt.core.apimgt.extension.rest.api.* + com.google.gson;version="[2.9,3)", + io.entgra.device.mgt.core.apimgt.extension.rest.api, + io.entgra.device.mgt.core.apimgt.extension.rest.api.dto, + io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo, + io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions, + io.entgra.device.mgt.core.apimgt.extension.rest.api.util, + javax.net.ssl,okhttp3;version="[4.9,5)", + org.apache.commons.lang;version="[2.6,3)", + org.apache.commons.logging;version="[1.2,2)", + org.apache.commons.ssl;version="[3.1,4)", + org.json;version="[3.0,4)", org.osgi.framework.*;version="${imp.package.version.osgi.framework}", org.osgi.service.*;version="${imp.package.version.osgi.service}", - org.wso2.carbon.core;version="4.6", - org.wso2.carbon.core.util;version="4.6", - org.apache.commons.ssl, - org.wso2.carbon.apimgt.api.model, - okhttp3.*, - org.wso2.carbon.apimgt.impl;version="${carbon.api.mgt.version.range}", - org.wso2.carbon.apimgt.impl.utils;version="${carbon.api.mgt.version.range}", - org.wso2.carbon.apimgt.impl.internal;version="${carbon.api.mgt.version.range}", - org.json + org.wso2.carbon.apimgt.api.model;version="[9.28,10)", + org.wso2.carbon.apimgt.impl;version="[9.28,10)", + org.wso2.carbon.apimgt.impl.internal;version="[9.28,10)", + org.wso2.carbon.base;version="[1.0,2)" diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/APIApplicationServicesImpl.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/APIApplicationServicesImpl.java index 8e80e1f5f5..9dbd5f52cc 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/APIApplicationServicesImpl.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/APIApplicationServicesImpl.java @@ -19,20 +19,15 @@ package io.entgra.device.mgt.core.apimgt.extension.rest.api; import com.google.gson.Gson; -import org.json.JSONObject; -import io.entgra.device.mgt.core.apimgt.extension.rest.api.util.HttpsTrustManagerUtils; -import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIApplicationKey; import io.entgra.device.mgt.core.apimgt.extension.rest.api.constants.Constants; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIApplicationKey; import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.AccessTokenInfo; import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.APIServicesException; -import okhttp3.MediaType; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import okhttp3.RequestBody; -import okhttp3.Credentials; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.util.HttpsTrustManagerUtils; +import okhttp3.*; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.json.JSONObject; import org.wso2.carbon.apimgt.impl.APIManagerConfiguration; import org.wso2.carbon.apimgt.impl.internal.ServiceReferenceHolder; diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServices.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServices.java index f5b766b119..49f76f0622 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServices.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServices.java @@ -19,18 +19,13 @@ package io.entgra.device.mgt.core.apimgt.extension.rest.api; import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIApplicationKey; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.APIInfo; import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.AccessTokenInfo; import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.APIServicesException; import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.BadRequestException; import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.UnexpectedResponseException; -import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.APIInfo; import org.json.JSONObject; -import org.wso2.carbon.apimgt.api.model.APIIdentifier; -import org.wso2.carbon.apimgt.api.model.Scope; -import org.wso2.carbon.apimgt.api.model.Mediation; -import org.wso2.carbon.apimgt.api.model.APIRevision; -import org.wso2.carbon.apimgt.api.model.APIRevisionDeployment; -import org.wso2.carbon.apimgt.api.model.Documentation; +import org.wso2.carbon.apimgt.api.model.*; import java.util.List; diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServicesImpl.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServicesImpl.java index b3ae5c8f92..bcc282e843 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServicesImpl.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/PublisherRESTAPIServicesImpl.java @@ -21,30 +21,21 @@ package io.entgra.device.mgt.core.apimgt.extension.rest.api; import com.google.gson.Gson; import io.entgra.device.mgt.core.apimgt.extension.rest.api.constants.Constants; import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIApplicationKey; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.APIInfo; import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.AccessTokenInfo; import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.APIServicesException; import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.BadRequestException; import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.UnexpectedResponseException; -import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.APIInfo; import io.entgra.device.mgt.core.apimgt.extension.rest.api.util.HttpsTrustManagerUtils; import io.entgra.device.mgt.core.apimgt.extension.rest.api.util.ScopeUtils; -import okhttp3.MediaType; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import okhttp3.RequestBody; +import okhttp3.*; import org.apache.commons.httpclient.HttpStatus; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.commons.ssl.Base64; import org.json.JSONArray; import org.json.JSONObject; -import org.wso2.carbon.apimgt.api.model.APIIdentifier; -import org.wso2.carbon.apimgt.api.model.Scope; -import org.wso2.carbon.apimgt.api.model.Mediation; -import org.wso2.carbon.apimgt.api.model.APIRevision; -import org.wso2.carbon.apimgt.api.model.APIRevisionDeployment; -import org.wso2.carbon.apimgt.api.model.Documentation; +import org.wso2.carbon.apimgt.api.model.*; import java.io.IOException; import java.util.List; diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/internal/PublisherRESTAPIServiceComponent.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/internal/PublisherRESTAPIServiceComponent.java index cb5c992664..f5d000fc7f 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/internal/PublisherRESTAPIServiceComponent.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/internal/PublisherRESTAPIServiceComponent.java @@ -26,22 +26,17 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.framework.BundleContext; import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.*; import org.wso2.carbon.apimgt.impl.APIManagerConfigurationService; -/** - * @scr.component name="internal.io.entgra.device.mgt.core.apimgt.extension.rest.api.PublisherRESTAPIServiceComponent" - * immediate="true" - * @scr.reference name="user.apimanagerconfigurationservice.default" - * interface="org.wso2.carbon.apimgt.impl.APIManagerConfigurationService" - * cardinality="1..1" - * policy="dynamic" - * bind="setAPIManagerConfigurationService" - * unbind="unsetAPIManagerConfigurationService" - */ +@Component( + name = "io.entgra.device.mgt.core.apimgt.extension.rest.api.internal.PublisherRESTAPIServiceComponent", + immediate = true) public class PublisherRESTAPIServiceComponent { private static final Log log = LogFactory.getLog(PublisherRESTAPIServiceComponent.class); + @Activate protected void activate(ComponentContext componentContext) { if (log.isDebugEnabled()) { log.debug("Initializing publisher API extension bundle"); @@ -64,11 +59,17 @@ public class PublisherRESTAPIServiceComponent { log.error("Error occurred while initializing API Application bundle", e); } } - + @Deactivate protected void deactivate(ComponentContext componentContext) { //do nothing } + @Reference( + name = "apim.configuration.service", + service = org.wso2.carbon.apimgt.impl.APIManagerConfigurationService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetAPIManagerConfigurationService") protected void setAPIManagerConfigurationService(APIManagerConfigurationService apiManagerConfigurationService) { if (log.isDebugEnabled()) { log.debug("Setting API Manager Configuration Service"); diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/util/HttpsTrustManagerUtils.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/util/HttpsTrustManagerUtils.java index 99df380d79..0dbfb4c3c0 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/util/HttpsTrustManagerUtils.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.extension.rest.api/src/main/java/io/entgra/device/mgt/core/apimgt/extension/rest/api/util/HttpsTrustManagerUtils.java @@ -25,30 +25,12 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.base.ServerConfiguration; -import javax.net.ssl.SSLContext; -import javax.net.ssl.SSLSocketFactory; -import javax.net.ssl.TrustManager; -import javax.net.ssl.X509TrustManager; -import javax.net.ssl.SSLSession; -import javax.net.ssl.KeyManagerFactory; -import javax.net.ssl.TrustManagerFactory; -import javax.net.ssl.HostnameVerifier; - +import javax.net.ssl.*; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; -import java.net.Proxy; -import java.net.ProxySelector; -import java.net.InetSocketAddress; -import java.net.SocketAddress; -import java.net.URI; - -import java.security.KeyManagementException; -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.UnrecoverableKeyException; -import java.security.SecureRandom; +import java.net.*; +import java.security.*; import java.security.cert.CertificateException; import java.util.ArrayList; import java.util.List; diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/pom.xml index 6f31d0d2a8..2392078c2e 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/pom.xml @@ -29,15 +29,16 @@ war WSO2 Carbon - API Key Management API This module extends the API manager's key management apis. - http://wso2.org + https://entgra.io + org.apache.maven.plugins maven-compiler-plugin - + org.apache.maven.plugins maven-war-plugin WEB-INF/lib/*cxf*.jar diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/src/main/java/io/entgra/device/mgt/core/apimgt/keymgt/extension/api/KeyManagerService.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/src/main/java/io/entgra/device/mgt/core/apimgt/keymgt/extension/api/KeyManagerService.java index 3da6325022..b172d73b42 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/src/main/java/io/entgra/device/mgt/core/apimgt/keymgt/extension/api/KeyManagerService.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/src/main/java/io/entgra/device/mgt/core/apimgt/keymgt/extension/api/KeyManagerService.java @@ -18,12 +18,7 @@ package io.entgra.device.mgt.core.apimgt.keymgt.extension.api; -import javax.ws.rs.Consumes; -import javax.ws.rs.FormParam; -import javax.ws.rs.HeaderParam; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/src/main/java/io/entgra/device/mgt/core/apimgt/keymgt/extension/api/KeyManagerServiceImpl.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/src/main/java/io/entgra/device/mgt/core/apimgt/keymgt/extension/api/KeyManagerServiceImpl.java index 40b077f2f8..96f506d99e 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/src/main/java/io/entgra/device/mgt/core/apimgt/keymgt/extension/api/KeyManagerServiceImpl.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/src/main/java/io/entgra/device/mgt/core/apimgt/keymgt/extension/api/KeyManagerServiceImpl.java @@ -28,12 +28,7 @@ import io.entgra.device.mgt.core.apimgt.keymgt.extension.service.KeyMgtService; import io.entgra.device.mgt.core.apimgt.keymgt.extension.service.KeyMgtServiceImpl; import io.entgra.device.mgt.core.device.mgt.common.exceptions.UnAuthorizedException; -import javax.ws.rs.Consumes; -import javax.ws.rs.FormParam; -import javax.ws.rs.HeaderParam; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.util.Base64; diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/src/main/webapp/WEB-INF/cxf-servlet.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/src/main/webapp/WEB-INF/cxf-servlet.xml index 31a04fcf89..8d0cb7ecce 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/src/main/webapp/WEB-INF/cxf-servlet.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.api/src/main/webapp/WEB-INF/cxf-servlet.xml @@ -19,9 +19,9 @@ + http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd"> diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/pom.xml index 22e044737a..5d2d371df5 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/pom.xml @@ -30,9 +30,14 @@ bundle WSO2 Carbon - API Key Management This module extends the API manager's key management. - http://wso2.org + https://entgra.io + + org.apache.felix + org.apache.felix.scr.ds-annotations + provided + commons-codec.wso2 commons-codec @@ -55,8 +60,12 @@ - org.apache.felix - maven-scr-plugin + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + org.apache.felix @@ -70,10 +79,40 @@ API Management Application Bundle io.entgra.device.mgt.core.apimgt.keymgt.extension.internal - io.entgra.device.mgt.core.apimgt.application.extension, - io.entgra.device.mgt.core.apimgt.application.extension.*, - io.entgra.device.mgt.core.device.mgt.common.*, - io.entgra.device.mgt.core.device.mgt.core.* + com.google.gson;version="[2.9,3)", + io.entgra.device.mgt.core.apimgt.keymgt.extension, + io.entgra.device.mgt.core.apimgt.keymgt.extension.exception, + io.entgra.device.mgt.core.apimgt.keymgt.extension.service, + io.entgra.device.mgt.core.device.mgt.common.permission.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.core.config;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.core.config.keymanager;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.core.permission.mgt;version="[5.0,6)", + javax.cache;version="[1.0,2)", + javax.net.ssl,okhttp3;version="[4.9,5)", + org.apache.commons.lang;version="[2.4,3)", + org.apache.commons.logging;version="[1.2,2)", + org.json;version="[3.0,4)", + org.osgi.framework.*;version="${imp.package.version.osgi.framework}", + org.osgi.service.*;version="${imp.package.version.osgi.service}", + org.wso2.carbon.apimgt.api;version="[9.28,10)", + org.wso2.carbon.apimgt.api.model;version="[9.28,10)", + org.wso2.carbon.apimgt.api.model.subscription;version="[9.28,10)", + org.wso2.carbon.apimgt.impl;version="[9.28,10)", + org.wso2.carbon.apimgt.impl.caching;version="[9.28,10)", + org.wso2.carbon.apimgt.impl.dto;version="[9.28,10)", + org.wso2.carbon.apimgt.impl.factory;version="[9.28,10)", + org.wso2.carbon.apimgt.impl.jwt;version="[9.28,10)", + org.wso2.carbon.apimgt.impl.utils;version="[9.28,10)", + org.wso2.carbon.apimgt.keymgt;version="[9.28,10)", + org.wso2.carbon.apimgt.keymgt.handlers;version="[9.28,10)", + org.wso2.carbon.apimgt.keymgt.model;version="[9.28,10)", + org.wso2.carbon.apimgt.keymgt.model.entity;version="[9.28,10)", + org.wso2.carbon.apimgt.keymgt.service;version="[9.28,10)", + org.wso2.carbon.context;version="[4.8,5)", + org.wso2.carbon.user.api;version="[1.0,2)", + org.wso2.carbon.user.core.service;version="[4.8,5)", + org.wso2.carbon.user.core.tenant;version="[4.8,5)", + org.wso2.carbon.utils.multitenancy;version="[4.8,5)" !io.entgra.device.mgt.core.apimgt.keymgt.extension.internal, diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/src/main/java/io/entgra/device/mgt/core/apimgt/keymgt/extension/KeyManagerConnectorConfiguration.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/src/main/java/io/entgra/device/mgt/core/apimgt/keymgt/extension/KeyManagerConnectorConfiguration.java index 8f1456ee51..191e3a9ba8 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/src/main/java/io/entgra/device/mgt/core/apimgt/keymgt/extension/KeyManagerConnectorConfiguration.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/src/main/java/io/entgra/device/mgt/core/apimgt/keymgt/extension/KeyManagerConnectorConfiguration.java @@ -18,6 +18,7 @@ package io.entgra.device.mgt.core.apimgt.keymgt.extension; +import org.osgi.service.component.annotations.Component; import org.wso2.carbon.apimgt.api.model.ConfigurationDto; import org.wso2.carbon.apimgt.impl.APIConstants; import org.wso2.carbon.apimgt.impl.DefaultKeyManagerConnectorConfiguration; @@ -27,9 +28,10 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -/** - * @scr.component name="io.entgra.device.mgt.core.apimgt.keymgt.extension.customKeyManagerConfigComponent" immediate="true" - */ +@Component( + name = "io.entgra.device.mgt.core.apimgt.keymgt.extension.KeyManagerConnectorConfiguration", + service = DefaultKeyManagerConnectorConfiguration.class, + immediate = true) public class KeyManagerConnectorConfiguration extends DefaultKeyManagerConnectorConfiguration { @Override diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/src/main/java/io/entgra/device/mgt/core/apimgt/keymgt/extension/KeyValidationHandler.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/src/main/java/io/entgra/device/mgt/core/apimgt/keymgt/extension/KeyValidationHandler.java index c577f3c463..868adfc082 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/src/main/java/io/entgra/device/mgt/core/apimgt/keymgt/extension/KeyValidationHandler.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/src/main/java/io/entgra/device/mgt/core/apimgt/keymgt/extension/KeyValidationHandler.java @@ -17,6 +17,10 @@ */ package io.entgra.device.mgt.core.apimgt.keymgt.extension; +import io.entgra.device.mgt.core.device.mgt.common.permission.mgt.Permission; +import io.entgra.device.mgt.core.device.mgt.common.permission.mgt.PermissionManagementException; +import io.entgra.device.mgt.core.device.mgt.common.permission.mgt.PermissionManagerService; +import io.entgra.device.mgt.core.device.mgt.core.permission.mgt.PermissionManagerServiceImpl; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -36,22 +40,12 @@ import org.wso2.carbon.apimgt.keymgt.model.SubscriptionDataStore; import org.wso2.carbon.apimgt.keymgt.model.entity.API; import org.wso2.carbon.apimgt.keymgt.service.TokenValidationContext; import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.device.mgt.common.permission.mgt.Permission; -import io.entgra.device.mgt.core.device.mgt.common.permission.mgt.PermissionManagementException; -import io.entgra.device.mgt.core.device.mgt.common.permission.mgt.PermissionManagerService; -import io.entgra.device.mgt.core.device.mgt.core.permission.mgt.PermissionManagerServiceImpl; import org.wso2.carbon.user.api.UserRealm; import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.user.core.service.RealmService; import org.wso2.carbon.utils.multitenancy.MultitenantUtils; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.StringTokenizer; +import java.util.*; public class KeyValidationHandler extends DefaultKeyValidationHandler { diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/src/main/java/io/entgra/device/mgt/core/apimgt/keymgt/extension/internal/KeyMgtServiceComponent.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/src/main/java/io/entgra/device/mgt/core/apimgt/keymgt/extension/internal/KeyMgtServiceComponent.java index 9bbc07fa95..395bdc0107 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/src/main/java/io/entgra/device/mgt/core/apimgt/keymgt/extension/internal/KeyMgtServiceComponent.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/src/main/java/io/entgra/device/mgt/core/apimgt/keymgt/extension/internal/KeyMgtServiceComponent.java @@ -18,21 +18,24 @@ package io.entgra.device.mgt.core.apimgt.keymgt.extension.internal; +import io.entgra.device.mgt.core.apimgt.keymgt.extension.service.KeyMgtService; +import io.entgra.device.mgt.core.apimgt.keymgt.extension.service.KeyMgtServiceImpl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.framework.BundleContext; import org.osgi.service.component.ComponentContext; -import io.entgra.device.mgt.core.apimgt.keymgt.extension.service.KeyMgtService; -import io.entgra.device.mgt.core.apimgt.keymgt.extension.service.KeyMgtServiceImpl; - -/** - * @scr.component name="io.entgra.device.mgt.core.apimgt.keymgt.extension.keyMgtServiceComponent" immediate="true" - */ +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; +@Component( + name = "io.entgra.device.mgt.core.apimgt.keymgt.extension.internal.KeyMgtServiceComponent", + immediate = true) public class KeyMgtServiceComponent { private static final Log log = LogFactory.getLog(KeyMgtServiceComponent.class); @SuppressWarnings("unused") + @Activate protected void activate(ComponentContext componentContext) { try { if (log.isDebugEnabled()) { @@ -54,6 +57,7 @@ public class KeyMgtServiceComponent { } @SuppressWarnings("unused") + @Deactivate protected void deactivate(ComponentContext componentContext) { if (log.isDebugEnabled()) { log.debug("De-activating Key Management Service Component"); diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/src/main/java/io/entgra/device/mgt/core/apimgt/keymgt/extension/service/KeyMgtServiceImpl.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/src/main/java/io/entgra/device/mgt/core/apimgt/keymgt/extension/service/KeyMgtServiceImpl.java index fdacd7fdd4..aee387abc4 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/src/main/java/io/entgra/device/mgt/core/apimgt/keymgt/extension/service/KeyMgtServiceImpl.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension/src/main/java/io/entgra/device/mgt/core/apimgt/keymgt/extension/service/KeyMgtServiceImpl.java @@ -19,13 +19,13 @@ package io.entgra.device.mgt.core.apimgt.keymgt.extension.service; import com.google.gson.Gson; -import okhttp3.Credentials; -import okhttp3.FormBody; -import okhttp3.MediaType; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; +import io.entgra.device.mgt.core.apimgt.keymgt.extension.*; +import io.entgra.device.mgt.core.apimgt.keymgt.extension.exception.BadRequestException; +import io.entgra.device.mgt.core.apimgt.keymgt.extension.exception.KeyMgtException; +import io.entgra.device.mgt.core.device.mgt.core.config.DeviceConfigurationManager; +import io.entgra.device.mgt.core.device.mgt.core.config.DeviceManagementConfig; +import io.entgra.device.mgt.core.device.mgt.core.config.keymanager.KeyManagerConfigurations; +import okhttp3.*; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.json.JSONObject; @@ -34,18 +34,7 @@ import org.wso2.carbon.apimgt.api.APIManagementException; import org.wso2.carbon.apimgt.api.model.Application; import org.wso2.carbon.apimgt.impl.APIManagerFactory; import org.wso2.carbon.apimgt.impl.utils.APIUtil; -import io.entgra.device.mgt.core.apimgt.keymgt.extension.DCRResponse; -import io.entgra.device.mgt.core.apimgt.keymgt.extension.KeyManagerPayload; -import io.entgra.device.mgt.core.apimgt.keymgt.extension.KeyMgtConstants; -import io.entgra.device.mgt.core.apimgt.keymgt.extension.OAuthApplication; -import io.entgra.device.mgt.core.apimgt.keymgt.extension.TokenRequest; -import io.entgra.device.mgt.core.apimgt.keymgt.extension.TokenResponse; -import io.entgra.device.mgt.core.apimgt.keymgt.extension.exception.BadRequestException; -import io.entgra.device.mgt.core.apimgt.keymgt.extension.exception.KeyMgtException; import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.device.mgt.core.config.DeviceConfigurationManager; -import io.entgra.device.mgt.core.device.mgt.core.config.DeviceManagementConfig; -import io.entgra.device.mgt.core.device.mgt.core.config.keymanager.KeyManagerConfigurations; import org.wso2.carbon.user.api.UserRealm; import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.user.api.UserStoreManager; @@ -59,11 +48,7 @@ import javax.net.ssl.X509TrustManager; import java.io.IOException; import java.security.KeyManagementException; import java.security.NoSuchAlgorithmException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; +import java.util.*; public class KeyMgtServiceImpl implements KeyMgtService { diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml index 57c96ba6db..c0c72a2f65 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/pom.xml @@ -31,22 +31,19 @@ bundle WSO2 Carbon - API Management Webapp Publisher WSO2 Carbon - API Management Webapp Publisher - http://wso2.org + https://entgra.io + + org.apache.felix + org.apache.felix.scr.ds-annotations + provided + org.powermock powermock-api-mockito test - - org.eclipse.osgi - org.eclipse.osgi - - - org.eclipse.osgi - org.eclipse.osgi.services - org.testng testng @@ -67,7 +64,6 @@ org.ops4j.pax.logging pax-logging-api provided - org.wso2.carbon @@ -82,7 +78,7 @@ gson - org.wso2.orbit.org.scannotation + io.entgra.org.scannotation scannotation @@ -138,8 +134,12 @@ - org.apache.felix - maven-scr-plugin + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + org.apache.felix @@ -158,47 +158,43 @@ io.entgra.device.mgt.core.apimgt.webapp.publisher.* - com.google.gson;version="[2.3,2.8.6)", - com.google.gson.reflect;version="[2.3,2.8.6)", - io.swagger.annotations, - javax.servlet;version="2.6", - javax.xml, - javax.xml.bind, - javax.xml.bind.annotation, - javax.xml.parsers, - org.apache.catalina;version="9.0", - org.apache.catalina.core;version="9.0", - org.apache.commons.logging;version="1.2", - org.osgi.framework.*;version="${imp.package.version.osgi.framework}", - org.osgi.service.*;version="${imp.package.version.osgi.service}", - org.scannotation;version="1.0", - org.scannotation.archiveiterator;version="1.0", - org.w3c.dom, - io.entgra.device.mgt.core.apimgt.extension.rest.api.*, - io.entgra.device.mgt.core.apimgt.annotations, - org.wso2.carbon.apimgt.api, - org.wso2.carbon.apimgt.api.model, - org.wso2.carbon.apimgt.impl, - org.wso2.carbon.apimgt.impl.utils, - io.entgra.device.mgt.core.apimgt.webapp.publisher, + com.google.gson;version="[2.9,3)", + com.google.gson.reflect;version="[2.9,3)", + io.entgra.device.mgt.core.apimgt.annotations;version="[5.0,6)", + io.entgra.device.mgt.core.apimgt.extension.rest.api;version="[5.0,6)", + io.entgra.device.mgt.core.apimgt.extension.rest.api.dto;version="[5.0,6)", + io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo;version="[5.0,6)", + io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions;version="[5.0,6)", io.entgra.device.mgt.core.apimgt.webapp.publisher.config, io.entgra.device.mgt.core.apimgt.webapp.publisher.dto, io.entgra.device.mgt.core.apimgt.webapp.publisher.exception, - io.entgra.device.mgt.core.apimgt.webapp.publisher.lifecycle.listener, - io.entgra.device.mgt.core.apimgt.webapp.publisher.lifecycle.util, - org.wso2.carbon.base;version="1.0", - org.wso2.carbon.context;version="4.6", - org.wso2.carbon.core;version="4.6", - org.wso2.carbon.core.util;version="4.6", - org.wso2.carbon.registry.core.service;version="1.0", - org.wso2.carbon.user.api;version="1.0", - org.wso2.carbon.user.core.service;version="4.6", - org.wso2.carbon.user.core.tenant;version="4.6", - org.wso2.carbon.utils;version="4.6", - org.wso2.carbon.utils.multitenancy;version="4.6", - org.wso2.carbon.apimgt.impl.definitions, - org.apache.commons.lang, - org.json + io.swagger.annotations;version="[1.6,2)", + javax.servlet;version="[2.6,3)", + javax.xml.bind;version="[0.0,1)", + javax.xml.bind.annotation;version="[0.0,1)", + javax.xml.parsers;version="${javax.xml.parsers.import.pkg.version}", + org.apache.catalina;version="${catalina.version.range}", + org.apache.catalina.core;version="${catalina.version.range}", + org.apache.commons.lang;version="[2.6,3)", + org.apache.commons.logging;version="[1.2,2)", + org.json;version="[3.0,4)", + org.osgi.framework.*;version="${imp.package.version.osgi.framework}", + org.osgi.service.*;version="${imp.package.version.osgi.service}", + org.scannotation;version="[1.0,2)", + org.scannotation.archiveiterator;version="[1.0,2)", + org.w3c.dom, + org.wso2.carbon.apimgt.api;version="[9.28,10)", + org.wso2.carbon.apimgt.api.model;version="[9.28,10)", + org.wso2.carbon.apimgt.impl;version="[9.28,10)", + org.wso2.carbon.apimgt.impl.utils;version="[9.28,10)", + org.wso2.carbon.context;version="[4.8,5)", + org.wso2.carbon.core;version="[4.8,5)", + org.wso2.carbon.core.util;version="[4.8,5)", + org.wso2.carbon.registry.core.service, + org.wso2.carbon.user.api, + org.wso2.carbon.user.core.service;version="[4.8,5)", + org.wso2.carbon.user.core.tenant;version="[4.8,5)", + org.wso2.carbon.utils;version="[4.8,5)" jsr311-api;scope=compile|runtime;inline=false diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java index fda57d0d59..8d30d3daf2 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceImpl.java @@ -23,33 +23,26 @@ import io.entgra.device.mgt.core.apimgt.extension.rest.api.PublisherRESTAPIServi import io.entgra.device.mgt.core.apimgt.extension.rest.api.PublisherRESTAPIServicesImpl; import io.entgra.device.mgt.core.apimgt.extension.rest.api.constants.Constants; import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIApplicationKey; +import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.APIInfo; import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.AccessTokenInfo; import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.APIServicesException; import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.BadRequestException; import io.entgra.device.mgt.core.apimgt.extension.rest.api.exceptions.UnexpectedResponseException; -import io.entgra.device.mgt.core.apimgt.extension.rest.api.dto.APIInfo.APIInfo; +import io.entgra.device.mgt.core.apimgt.webapp.publisher.config.WebappPublisherConfig; +import io.entgra.device.mgt.core.apimgt.webapp.publisher.dto.ApiScope; +import io.entgra.device.mgt.core.apimgt.webapp.publisher.dto.ApiUriTemplate; +import io.entgra.device.mgt.core.apimgt.webapp.publisher.exception.APIManagerPublisherException; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.apimgt.api.model.Documentation; -import org.wso2.carbon.apimgt.api.model.DocumentationType; import org.json.JSONArray; import org.json.JSONObject; import org.wso2.carbon.apimgt.api.APIManagementException; import org.wso2.carbon.apimgt.api.APIProvider; -import org.wso2.carbon.apimgt.api.model.APIIdentifier; -import org.wso2.carbon.apimgt.api.model.APIRevision; -import org.wso2.carbon.apimgt.api.model.APIRevisionDeployment; -import org.wso2.carbon.apimgt.api.model.CORSConfiguration; -import org.wso2.carbon.apimgt.api.model.Mediation; -import org.wso2.carbon.apimgt.api.model.Scope; +import org.wso2.carbon.apimgt.api.model.*; import org.wso2.carbon.apimgt.impl.APIConstants; import org.wso2.carbon.apimgt.impl.APIManagerFactory; import org.wso2.carbon.apimgt.impl.utils.APIUtil; -import io.entgra.device.mgt.core.apimgt.webapp.publisher.config.WebappPublisherConfig; -import io.entgra.device.mgt.core.apimgt.webapp.publisher.dto.ApiScope; -import io.entgra.device.mgt.core.apimgt.webapp.publisher.dto.ApiUriTemplate; -import io.entgra.device.mgt.core.apimgt.webapp.publisher.exception.APIManagerPublisherException; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.user.core.service.RealmService; @@ -65,16 +58,7 @@ import java.io.IOException; import java.nio.file.DirectoryIteratorException; import java.nio.file.Files; import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.Date; +import java.util.*; /** * This class represents the concrete implementation of the APIPublisherService that corresponds to providing all diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherStartupHandler.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherStartupHandler.java index c986c798ce..55a1733498 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherStartupHandler.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherStartupHandler.java @@ -18,10 +18,10 @@ package io.entgra.device.mgt.core.apimgt.webapp.publisher; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.apimgt.webapp.publisher.exception.APIManagerPublisherException; import io.entgra.device.mgt.core.apimgt.webapp.publisher.internal.APIPublisherDataHolder; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.wso2.carbon.core.ServerStartupObserver; import java.util.Stack; diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherUtil.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherUtil.java index e982d3d6e8..26cd3077fd 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherUtil.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherUtil.java @@ -23,8 +23,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.reflect.TypeToken; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.apimgt.annotations.Scope; import io.entgra.device.mgt.core.apimgt.webapp.publisher.config.APIResource; import io.entgra.device.mgt.core.apimgt.webapp.publisher.config.APIResourceConfiguration; @@ -32,6 +30,8 @@ import io.entgra.device.mgt.core.apimgt.webapp.publisher.config.WebappPublisherC import io.entgra.device.mgt.core.apimgt.webapp.publisher.dto.ApiScope; import io.entgra.device.mgt.core.apimgt.webapp.publisher.dto.ApiUriTemplate; import io.entgra.device.mgt.core.apimgt.webapp.publisher.lifecycle.util.AnnotationProcessor; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.wso2.carbon.base.MultitenantConstants; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.core.util.Utils; diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/config/WebappPublisherConfig.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/config/WebappPublisherConfig.java index 0b7225b359..d1d55687ec 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/config/WebappPublisherConfig.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/config/WebappPublisherConfig.java @@ -18,10 +18,10 @@ package io.entgra.device.mgt.core.apimgt.webapp.publisher.config; -import org.w3c.dom.Document; import io.entgra.device.mgt.core.apimgt.webapp.publisher.InvalidConfigurationStateException; import io.entgra.device.mgt.core.apimgt.webapp.publisher.WebappPublisherConfigurationFailedException; import io.entgra.device.mgt.core.apimgt.webapp.publisher.WebappPublisherUtil; +import org.w3c.dom.Document; import org.wso2.carbon.utils.CarbonUtils; import javax.xml.bind.JAXBContext; diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/internal/APIPublisherServiceComponent.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/internal/APIPublisherServiceComponent.java index 8ab4d924b8..df71dcb231 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/internal/APIPublisherServiceComponent.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/internal/APIPublisherServiceComponent.java @@ -17,37 +17,27 @@ */ package io.entgra.device.mgt.core.apimgt.webapp.publisher.internal; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.osgi.framework.BundleContext; -import org.osgi.service.component.ComponentContext; import io.entgra.device.mgt.core.apimgt.webapp.publisher.APIPublisherService; import io.entgra.device.mgt.core.apimgt.webapp.publisher.APIPublisherServiceImpl; import io.entgra.device.mgt.core.apimgt.webapp.publisher.APIPublisherStartupHandler; import io.entgra.device.mgt.core.apimgt.webapp.publisher.config.WebappPublisherConfig; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.osgi.framework.BundleContext; +import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.*; import org.wso2.carbon.core.ServerStartupObserver; import org.wso2.carbon.registry.core.service.RegistryService; import org.wso2.carbon.user.core.service.RealmService; -/** - * @scr.component name="io.entgra.device.mgt.core.apimgt.webapp.publisher" immediate="true" - * @scr.reference name="user.realmservice.default" - * interface="org.wso2.carbon.user.core.service.RealmService" - * cardinality="1..1" - * policy="dynamic" - * bind="setRealmService" - * unbind="unsetRealmService" - * @scr.reference name="registry.service" - * interface="org.wso2.carbon.registry.core.service.RegistryService" - * cardinality="1..1" - * policy="dynamic" - * bind="setRegistryService" - * unbind="unsetRegistryService" - */ +@Component( + name = "io.entgra.device.mgt.core.apimgt.webapp.publisher.internal.APIPublisherServiceComponent", + immediate = true) public class APIPublisherServiceComponent { private static Log log = LogFactory.getLog(APIPublisherServiceComponent.class); + @Activate protected void activate(ComponentContext componentContext) { try { if (log.isDebugEnabled()) { @@ -71,6 +61,7 @@ public class APIPublisherServiceComponent { } } + @Deactivate protected void deactivate(ComponentContext componentContext) { //do nothing } @@ -88,6 +79,12 @@ public class APIPublisherServiceComponent { bundleContext.registerService(ServerStartupObserver.class, new APIPublisherStartupHandler(), null); } + @Reference( + name = "user.realmservice.default", + service = org.wso2.carbon.user.core.service.RealmService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRealmService") protected void setRealmService(RealmService realmService) { if (log.isDebugEnabled()) { log.debug("Setting Realm Service"); @@ -102,6 +99,12 @@ public class APIPublisherServiceComponent { APIPublisherDataHolder.getInstance().setRealmService(null); } + @Reference( + name = "registry.service", + service = org.wso2.carbon.registry.core.service.RegistryService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRegistryService") protected void setRegistryService(RegistryService registryService) { if (registryService != null && log.isDebugEnabled()) { log.debug("Registry service initialized"); diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/lifecycle/listener/APIPublisherLifecycleListener.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/lifecycle/listener/APIPublisherLifecycleListener.java index fcded26688..da503fc4d7 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/lifecycle/listener/APIPublisherLifecycleListener.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/lifecycle/listener/APIPublisherLifecycleListener.java @@ -17,12 +17,6 @@ */ package io.entgra.device.mgt.core.apimgt.webapp.publisher.lifecycle.listener; -import org.apache.catalina.Lifecycle; -import org.apache.catalina.LifecycleEvent; -import org.apache.catalina.LifecycleListener; -import org.apache.catalina.core.StandardContext; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.apimgt.webapp.publisher.APIConfig; import io.entgra.device.mgt.core.apimgt.webapp.publisher.APIPublisherService; import io.entgra.device.mgt.core.apimgt.webapp.publisher.APIPublisherUtil; @@ -30,6 +24,12 @@ import io.entgra.device.mgt.core.apimgt.webapp.publisher.config.APIResourceConfi import io.entgra.device.mgt.core.apimgt.webapp.publisher.config.WebappPublisherConfig; import io.entgra.device.mgt.core.apimgt.webapp.publisher.internal.APIPublisherDataHolder; import io.entgra.device.mgt.core.apimgt.webapp.publisher.lifecycle.util.AnnotationProcessor; +import org.apache.catalina.Lifecycle; +import org.apache.catalina.LifecycleEvent; +import org.apache.catalina.LifecycleListener; +import org.apache.catalina.core.StandardContext; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.user.api.UserStoreException; diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/lifecycle/util/AnnotationProcessor.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/lifecycle/util/AnnotationProcessor.java index 48cb848c8f..4a085ff715 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/lifecycle/util/AnnotationProcessor.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/lifecycle/util/AnnotationProcessor.java @@ -20,27 +20,18 @@ package io.entgra.device.mgt.core.apimgt.webapp.publisher.lifecycle.util; import io.entgra.device.mgt.core.apimgt.annotations.Scope; import io.entgra.device.mgt.core.apimgt.annotations.Scopes; +import io.entgra.device.mgt.core.apimgt.webapp.publisher.APIPublisherUtil; +import io.entgra.device.mgt.core.apimgt.webapp.publisher.config.APIResource; +import io.entgra.device.mgt.core.apimgt.webapp.publisher.config.APIResourceConfiguration; +import io.entgra.device.mgt.core.apimgt.webapp.publisher.dto.ApiScope; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.SwaggerDefinition; import org.apache.catalina.core.StandardContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.apimgt.webapp.publisher.APIPublisherUtil; -import io.entgra.device.mgt.core.apimgt.webapp.publisher.config.APIResource; -import io.entgra.device.mgt.core.apimgt.webapp.publisher.config.APIResourceConfiguration; -import io.entgra.device.mgt.core.apimgt.webapp.publisher.dto.ApiScope; import javax.servlet.ServletContext; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.HEAD; -import javax.ws.rs.HttpMethod; -import javax.ws.rs.OPTIONS; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; +import javax.ws.rs.*; import java.io.File; import java.io.IOException; import java.lang.annotation.Annotation; diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/lifecycle/util/ExtendedFileProtocolIteratorFactory.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/lifecycle/util/ExtendedFileProtocolIteratorFactory.java index 3d756e2eff..f7391c223c 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/lifecycle/util/ExtendedFileProtocolIteratorFactory.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/main/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/lifecycle/util/ExtendedFileProtocolIteratorFactory.java @@ -18,7 +18,6 @@ package io.entgra.device.mgt.core.apimgt.webapp.publisher.lifecycle.util; import org.scannotation.archiveiterator.*; - import java.io.File; import java.io.IOException; import java.net.URL; diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/test/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceTest.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/test/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceTest.java index cd8f1cd4f0..bd959e2f3a 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/test/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceTest.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/test/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherServiceTest.java @@ -17,6 +17,13 @@ */ package io.entgra.device.mgt.core.apimgt.webapp.publisher; +import io.entgra.device.mgt.core.apimgt.webapp.publisher.config.WebappPublisherConfig; +import io.entgra.device.mgt.core.apimgt.webapp.publisher.dto.ApiScope; +import io.entgra.device.mgt.core.apimgt.webapp.publisher.exception.APIManagerPublisherException; +import io.entgra.device.mgt.core.apimgt.webapp.publisher.internal.APIPublisherDataHolder; +import io.entgra.device.mgt.core.apimgt.webapp.publisher.utils.MockAPICollectionApi; +import io.entgra.device.mgt.core.apimgt.webapp.publisher.utils.MockAPIIndividualApi; +import io.entgra.device.mgt.core.apimgt.webapp.publisher.utils.TestUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.mockito.Mockito; @@ -32,13 +39,6 @@ import org.wso2.carbon.apimgt.integration.generated.client.publisher.api.APIIndi import org.wso2.carbon.apimgt.integration.generated.client.publisher.model.API; import org.wso2.carbon.apimgt.integration.generated.client.publisher.model.APIInfo; import org.wso2.carbon.apimgt.integration.generated.client.publisher.model.APIList; -import io.entgra.device.mgt.core.apimgt.webapp.publisher.config.WebappPublisherConfig; -import io.entgra.device.mgt.core.apimgt.webapp.publisher.dto.ApiScope; -import io.entgra.device.mgt.core.apimgt.webapp.publisher.exception.APIManagerPublisherException; -import io.entgra.device.mgt.core.apimgt.webapp.publisher.internal.APIPublisherDataHolder; -import io.entgra.device.mgt.core.apimgt.webapp.publisher.utils.MockAPICollectionApi; -import io.entgra.device.mgt.core.apimgt.webapp.publisher.utils.MockAPIIndividualApi; -import io.entgra.device.mgt.core.apimgt.webapp.publisher.utils.TestUtils; import java.lang.reflect.Field; import java.util.*; diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/test/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherUtilTest.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/test/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherUtilTest.java index a86c743d4f..4b8d6baac2 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/test/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherUtilTest.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/test/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/APIPublisherUtilTest.java @@ -17,9 +17,6 @@ */ package io.entgra.device.mgt.core.apimgt.webapp.publisher; -import org.testng.Assert; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.Test; import io.entgra.device.mgt.core.apimgt.webapp.publisher.config.APIResource; import io.entgra.device.mgt.core.apimgt.webapp.publisher.config.APIResourceConfiguration; import io.entgra.device.mgt.core.apimgt.webapp.publisher.config.WebappPublisherConfig; @@ -28,6 +25,9 @@ import io.entgra.device.mgt.core.apimgt.webapp.publisher.dto.ApiUriTemplate; import io.entgra.device.mgt.core.apimgt.webapp.publisher.exception.APIManagerPublisherException; import io.entgra.device.mgt.core.apimgt.webapp.publisher.utils.MockServletContext; import io.entgra.device.mgt.core.apimgt.webapp.publisher.utils.TestUtils; +import org.testng.Assert; +import org.testng.annotations.BeforeTest; +import org.testng.annotations.Test; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.registry.core.exceptions.RegistryException; import org.wso2.carbon.registry.core.jdbc.realm.InMemoryRealmService; @@ -36,14 +36,11 @@ import org.wso2.carbon.user.api.UserRealm; import org.wso2.carbon.user.api.UserStoreException; import javax.servlet.ServletContext; - import java.util.ArrayList; import java.util.List; import java.util.Set; -import static io.entgra.device.mgt.core.apimgt.webapp.publisher.APIPublisherUtil.buildApiConfig; -import static io.entgra.device.mgt.core.apimgt.webapp.publisher.APIPublisherUtil.getApiEndpointUrl; -import static io.entgra.device.mgt.core.apimgt.webapp.publisher.APIPublisherUtil.setResourceAuthTypes; +import static io.entgra.device.mgt.core.apimgt.webapp.publisher.APIPublisherUtil.*; /** * This is the test class for {@link APIPublisherUtil} diff --git a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/test/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/BaseAPIPublisherTest.java b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/test/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/BaseAPIPublisherTest.java index 0b6e84f2db..2988adb58f 100644 --- a/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/test/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/BaseAPIPublisherTest.java +++ b/components/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher/src/test/java/io/entgra/device/mgt/core/apimgt/webapp/publisher/BaseAPIPublisherTest.java @@ -17,12 +17,13 @@ */ package io.entgra.device.mgt.core.apimgt.webapp.publisher; +import io.entgra.device.mgt.core.apimgt.webapp.publisher.internal.APIPublisherDataHolder; +import io.entgra.device.mgt.core.apimgt.webapp.publisher.utils.MockAPIIndividualApi; +import io.entgra.device.mgt.core.identity.jwt.client.extension.exception.JWTClientException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.mockito.Mockito; import org.testng.annotations.BeforeSuite; -import io.entgra.device.mgt.core.apimgt.webapp.publisher.internal.APIPublisherDataHolder; -import io.entgra.device.mgt.core.apimgt.webapp.publisher.utils.MockAPIIndividualApi; import org.wso2.carbon.base.MultitenantConstants; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.context.internal.OSGiDataHolder; @@ -33,7 +34,6 @@ import org.wso2.carbon.registry.core.jdbc.realm.InMemoryRealmService; import org.wso2.carbon.registry.core.service.RegistryService; import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.user.core.service.RealmService; -import io.entgra.device.mgt.core.identity.jwt.client.extension.exception.JWTClientException; import java.io.File; import java.io.InputStream; diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml index bca5c79b63..c1cfef2e3e 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml @@ -30,7 +30,7 @@ bundle WSO2 Carbon - API Security Handler Component WSO2 Carbon - API Management Security Handler Module - http://wso2.org + https://entgra.io diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/pom.xml index c77e90c5e3..8620769238 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/pom.xml @@ -30,7 +30,7 @@ bundle WSO2 Carbon - API Management Integration Client WSO2 Carbon - API Management Integration Client - http://wso2.org + https://entgra.io diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.generated.client/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.generated.client/pom.xml index 4c49528503..78a5d81d7f 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.generated.client/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.generated.client/pom.xml @@ -30,7 +30,7 @@ bundle WSO2 Carbon - API Management Integration Generated Client WSO2 Carbon - API Management Integration Client - http://wso2.org + https://entgra.io diff --git a/components/apimgt-extensions/pom.xml b/components/apimgt-extensions/pom.xml index 0d781b6456..bee1ec2744 100644 --- a/components/apimgt-extensions/pom.xml +++ b/components/apimgt-extensions/pom.xml @@ -30,7 +30,7 @@ apimgt-extensions pom WSO2 Carbon - API Management Extensions Component - http://wso2.org + https://entgra.io io.entgra.device.mgt.core.apimgt.webapp.publisher @@ -43,23 +43,4 @@ io.entgra.device.mgt.core.apimgt.extension.rest.api - - - - - - - - - - - - - - - - - - - diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.addons/pom.xml b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.addons/pom.xml index 9be3afd092..e96bb9f4c2 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.addons/pom.xml +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.addons/pom.xml @@ -29,12 +29,17 @@ Entgra - Application Management Add-Ons Entgra - Application Management Add-Ons https://entgra.io + bundle - org.apache.felix - maven-scr-plugin + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + org.apache.felix @@ -47,8 +52,21 @@ ${io.entgra.device.mgt.core.version} Application Management Add-Ons Bundle - com.google.gson, - io.swagger.annotations.*;resolution:=optional + com.google.gson;version="[2.9,3)", + io.entgra.device.mgt.core.application.mgt.addons.jaxrs, + javax.servlet;version="[4.0,5)", + javax.servlet.http;version="[4.0,5)", + javax.validation;version="[1.1,2)", + javax.validation.executable;version="[1.1,2)", + javax.ws.rs;version="[2.1,3)", + javax.ws.rs.core;version="[2.1,3)", + javax.ws.rs.ext;version="[2.1,3)", + org.apache.commons.logging;version="[1.2,2)", + org.apache.cxf.interceptor;version="[3.5,4)", + org.apache.cxf.jaxrs.lifecycle;version="[3.5,4)", + org.apache.cxf.jaxrs.model;version="[3.5,4)", + org.apache.cxf.message;version="[3.5,4)", + org.apache.cxf.phase;version="[3.5,4)" io.entgra.device.mgt.core.application.mgt.addons.* @@ -60,6 +78,11 @@ + + org.apache.felix + org.apache.felix.scr.ds-annotations + provided + org.apache.cxf cxf-rt-frontend-jaxws @@ -75,19 +98,10 @@ cxf-rt-transports-http provided - - org.eclipse.osgi - org.eclipse.osgi - - - org.eclipse.equinox - org.eclipse.equinox.common - org.ops4j.pax.logging pax-logging-api provided - commons-codec.wso2 diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.addons/src/main/java/io/entgra/device/mgt/core/application/mgt/addons/JSONMessageHandler.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.addons/src/main/java/io/entgra/device/mgt/core/application/mgt/addons/JSONMessageHandler.java index 72fe1bb5f5..c9ef83455f 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.addons/src/main/java/io/entgra/device/mgt/core/application/mgt/addons/JSONMessageHandler.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.addons/src/main/java/io/entgra/device/mgt/core/application/mgt/addons/JSONMessageHandler.java @@ -29,11 +29,7 @@ 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.io.*; import java.lang.annotation.Annotation; import java.lang.reflect.Type; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.addons/src/main/java/io/entgra/device/mgt/core/application/mgt/addons/MultipartCustomProvider.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.addons/src/main/java/io/entgra/device/mgt/core/application/mgt/addons/MultipartCustomProvider.java index bda1cb8003..fbd8df6c45 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.addons/src/main/java/io/entgra/device/mgt/core/application/mgt/addons/MultipartCustomProvider.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.addons/src/main/java/io/entgra/device/mgt/core/application/mgt/addons/MultipartCustomProvider.java @@ -21,8 +21,8 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonObject; import com.google.gson.JsonParser; -import org.apache.cxf.jaxrs.ext.multipart.Attachment; import io.entgra.device.mgt.core.application.mgt.addons.jaxrs.AnnotationExclusionStrategy; +import org.apache.cxf.jaxrs.ext.multipart.Attachment; import javax.ws.rs.Consumes; import javax.ws.rs.WebApplicationException; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.api/pom.xml b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.api/pom.xml index 37c08fc1d4..3f9fe54664 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.api/pom.xml +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.api/pom.xml @@ -140,7 +140,6 @@ org.ops4j.pax.logging pax-logging-api provided - org.json.wso2 diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.api/src/main/java/io/entgra/device/mgt/core/application/mgt/api/ArtifactDownloadAPI.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.api/src/main/java/io/entgra/device/mgt/core/application/mgt/api/ArtifactDownloadAPI.java index e9fbe84f0f..019e2b9721 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.api/src/main/java/io/entgra/device/mgt/core/application/mgt/api/ArtifactDownloadAPI.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.api/src/main/java/io/entgra/device/mgt/core/application/mgt/api/ArtifactDownloadAPI.java @@ -18,23 +18,11 @@ package io.entgra.device.mgt.core.application.mgt.api; -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.SwaggerDefinition; import io.entgra.device.mgt.core.application.mgt.common.ApplicationList; import io.entgra.device.mgt.core.application.mgt.common.ErrorResponse; +import io.swagger.annotations.*; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.api/src/main/java/io/entgra/device/mgt/core/application/mgt/api/impl/ArtifactDownloadAPIImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.api/src/main/java/io/entgra/device/mgt/core/application/mgt/api/impl/ArtifactDownloadAPIImpl.java index a3b5d51828..3395cf5643 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.api/src/main/java/io/entgra/device/mgt/core/application/mgt/api/impl/ArtifactDownloadAPIImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.api/src/main/java/io/entgra/device/mgt/core/application/mgt/api/impl/ArtifactDownloadAPIImpl.java @@ -18,9 +18,6 @@ package io.entgra.device.mgt.core.application.mgt.api.impl; -import org.apache.commons.io.IOUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.application.mgt.api.ArtifactDownloadAPI; import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationManagementException; import io.entgra.device.mgt.core.application.mgt.common.services.ApplicationManager; @@ -29,18 +26,16 @@ import io.entgra.device.mgt.core.application.mgt.core.exception.BadRequestExcept import io.entgra.device.mgt.core.application.mgt.core.exception.NotFoundException; import io.entgra.device.mgt.core.application.mgt.core.util.APIUtil; import io.entgra.device.mgt.core.application.mgt.core.util.Constants; +import org.apache.commons.io.IOUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import javax.ws.rs.*; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; /** * Implementation of ApplicationDTO Management related APIs. diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/pom.xml b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/pom.xml index ee40a41479..c9eafdb800 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/pom.xml +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/pom.xml @@ -35,8 +35,12 @@ - org.apache.felix - maven-scr-plugin + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + org.apache.felix @@ -49,13 +53,23 @@ ${io.entgra.device.mgt.core.version} Application Management Common Bundle - io.entgra.device.mgt.core.device.mgt.common.*;version="${io.entgra.device.mgt.core.version}", - io.entgra.device.mgt.core.device.mgt.core.dto;version="${io.entgra.device.mgt.core.version}", - com.google.gson, - io.swagger.annotations.*;resolution:=optional, - com.fasterxml.jackson.annotation, - javax.validation.constraints, - javax.xml.bind.annotation; version="${javax.xml.bind.imp.pkg.version}", + com.fasterxml.jackson.annotation;version="[2.9,3)", + com.google.gson;version="[2.9,3)", + io.entgra.device.mgt.core.application.mgt.common, + io.entgra.device.mgt.core.application.mgt.common.config, + io.entgra.device.mgt.core.application.mgt.common.dto, + io.entgra.device.mgt.core.application.mgt.common.exception, + io.entgra.device.mgt.core.application.mgt.common.response, + io.entgra.device.mgt.core.application.mgt.common.wrapper, + io.entgra.device.mgt.core.device.mgt.common;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.app.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.operation.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.core.common.exception;version="[5.0,6)", + io.swagger.annotations;version="[1.6,2)", + javax.validation.constraints;version="[2.0,3)", + javax.xml.bind.annotation;version="[0.0,1)" + + io.entgra.device.mgt.core.application.mgt.common.* @@ -68,18 +82,14 @@ - org.eclipse.osgi - org.eclipse.osgi - - - org.eclipse.equinox - org.eclipse.equinox.common + org.apache.felix + org.apache.felix.scr.ds-annotations + provided org.ops4j.pax.logging pax-logging-api provided - commons-codec.wso2 diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/ApplicationInstallResponse.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/ApplicationInstallResponse.java index c52261a943..c6fd77b7a0 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/ApplicationInstallResponse.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/ApplicationInstallResponse.java @@ -18,9 +18,9 @@ package io.entgra.device.mgt.core.application.mgt.common; -import io.swagger.annotations.ApiModelProperty; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Activity; +import io.swagger.annotations.ApiModelProperty; import java.util.List; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/ApplicationSubscriptionInfo.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/ApplicationSubscriptionInfo.java index 93f002aad1..f2fab0456e 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/ApplicationSubscriptionInfo.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/ApplicationSubscriptionInfo.java @@ -21,7 +21,6 @@ package io.entgra.device.mgt.core.application.mgt.common; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; -import java.util.ArrayList; import java.util.List; public class ApplicationSubscriptionInfo { diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/DeviceList.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/DeviceList.java index 29c331c51a..4219ecf168 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/DeviceList.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/DeviceList.java @@ -18,8 +18,8 @@ package io.entgra.device.mgt.core.application.mgt.common; import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModelProperty; import io.entgra.device.mgt.core.device.mgt.common.Device; +import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/DeviceSubscriptionData.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/DeviceSubscriptionData.java index 55f2ec9edc..ffc1c4635f 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/DeviceSubscriptionData.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/DeviceSubscriptionData.java @@ -20,8 +20,6 @@ package io.entgra.device.mgt.core.application.mgt.common; import io.entgra.device.mgt.core.device.mgt.common.Device; -import java.sql.Timestamp; - public class DeviceSubscriptionData { private int subId; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/InstallationDetails.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/InstallationDetails.java index c948c93758..942817ec6f 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/InstallationDetails.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/InstallationDetails.java @@ -17,8 +17,8 @@ */ package io.entgra.device.mgt.core.application.mgt.common; -import io.swagger.annotations.ApiModelProperty; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; +import io.swagger.annotations.ApiModelProperty; import java.util.List; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/LifecycleState.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/LifecycleState.java index c3091f678d..b72d169253 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/LifecycleState.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/LifecycleState.java @@ -17,10 +17,10 @@ */ package io.entgra.device.mgt.core.application.mgt.common; -import java.sql.Timestamp; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import java.sql.Timestamp; import java.util.List; @ApiModel(value = "LifecycleState", description = "LifecycleState represents the Lifecycle state for an application release") diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/dto/ScheduledSubscriptionDTO.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/dto/ScheduledSubscriptionDTO.java index 1bd612d63a..8aaeb22770 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/dto/ScheduledSubscriptionDTO.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/dto/ScheduledSubscriptionDTO.java @@ -20,8 +20,8 @@ package io.entgra.device.mgt.core.application.mgt.common.dto; import com.google.gson.Gson; import io.entgra.device.mgt.core.application.mgt.common.ExecutionStatus; -import io.entgra.device.mgt.core.application.mgt.common.SubscriptionType; import io.entgra.device.mgt.core.application.mgt.common.SubAction; +import io.entgra.device.mgt.core.application.mgt.common.SubscriptionType; import io.entgra.device.mgt.core.application.mgt.common.response.ApplicationRelease; import java.util.List; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/ApplicationManager.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/ApplicationManager.java index ff4ca7710a..f7655b566b 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/ApplicationManager.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/ApplicationManager.java @@ -17,7 +17,9 @@ */ package io.entgra.device.mgt.core.application.mgt.common.services; -import io.entgra.device.mgt.core.application.mgt.common.ApplicationType; +import io.entgra.device.mgt.core.application.mgt.common.*; +import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationDTO; +import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationReleaseDTO; import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationManagementException; import io.entgra.device.mgt.core.application.mgt.common.exception.RequestValidatingException; import io.entgra.device.mgt.core.application.mgt.common.exception.ResourceManagementException; @@ -25,20 +27,10 @@ import io.entgra.device.mgt.core.application.mgt.common.response.Application; import io.entgra.device.mgt.core.application.mgt.common.response.ApplicationRelease; import io.entgra.device.mgt.core.application.mgt.common.response.Category; import io.entgra.device.mgt.core.application.mgt.common.response.Tag; +import io.entgra.device.mgt.core.application.mgt.common.wrapper.*; import io.entgra.device.mgt.core.device.mgt.common.Base64File; -import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationDTO; import org.apache.cxf.jaxrs.ext.multipart.Attachment; -import io.entgra.device.mgt.core.application.mgt.common.ApplicationArtifact; -import io.entgra.device.mgt.core.application.mgt.common.LifecycleChanger; -import io.entgra.device.mgt.core.application.mgt.common.ApplicationList; -import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationReleaseDTO; -import io.entgra.device.mgt.core.application.mgt.common.Filter; -import io.entgra.device.mgt.core.application.mgt.common.LifecycleState; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.CustomAppReleaseWrapper; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.EntAppReleaseWrapper; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.ApplicationUpdateWrapper; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.PublicAppReleaseWrapper; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.WebAppReleaseWrapper; + import java.util.List; /** @@ -525,4 +517,12 @@ public interface ApplicationManager { String getPlistArtifact(String uuid) throws ApplicationManagementException; List getReleaseByPackageNames(List packageIds) throws ApplicationManagementException; + + /** + * @param applicationRelease {@link ApplicationRelease} + * @param oldPackageName Old package name of the application + * @throws ApplicationManagementException Application management exception + */ + void updateAppIconInfo(ApplicationRelease applicationRelease, String oldPackageName) + throws ApplicationManagementException; } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/ReviewManager.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/ReviewManager.java index 756424275d..c354afa513 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/ReviewManager.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/ReviewManager.java @@ -17,12 +17,12 @@ */ package io.entgra.device.mgt.core.application.mgt.common.services; -import io.entgra.device.mgt.core.application.mgt.common.Rating; -import io.entgra.device.mgt.core.application.mgt.common.response.Review; import io.entgra.device.mgt.core.application.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.application.mgt.common.PaginationResult; +import io.entgra.device.mgt.core.application.mgt.common.Rating; import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationManagementException; import io.entgra.device.mgt.core.application.mgt.common.exception.ReviewManagementException; +import io.entgra.device.mgt.core.application.mgt.common.response.Review; import io.entgra.device.mgt.core.application.mgt.common.wrapper.ReviewWrapper; /** diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/SubscriptionManager.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/SubscriptionManager.java index f2bd759fd7..8219354946 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/SubscriptionManager.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.common/src/main/java/io/entgra/device/mgt/core/application/mgt/common/services/SubscriptionManager.java @@ -19,10 +19,10 @@ package io.entgra.device.mgt.core.application.mgt.common.services; import io.entgra.device.mgt.core.application.mgt.common.ApplicationInstallResponse; import io.entgra.device.mgt.core.application.mgt.common.ExecutionStatus; +import io.entgra.device.mgt.core.application.mgt.common.SubscriptionType; import io.entgra.device.mgt.core.application.mgt.common.dto.ScheduledSubscriptionDTO; import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationManagementException; import io.entgra.device.mgt.core.application.mgt.common.exception.SubscriptionManagementException; -import io.entgra.device.mgt.core.application.mgt.common.SubscriptionType; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.PaginationResult; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml index 7f32a0424c..9c3ab8ff85 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/pom.xml @@ -35,8 +35,12 @@ - org.apache.felix - maven-scr-plugin + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + org.apache.felix @@ -50,40 +54,91 @@ Application Management Core Bundle io.entgra.device.mgt.core.application.mgt.core.internal + com.dd.plist;version="[1.21,2)", + com.google.gson;version="[2.9,3)", + com.google.gson.reflect;version="[2.9,3)", + io.entgra.device.mgt.core.apimgt.application.extension;version="[5.0,6)", + io.entgra.device.mgt.core.apimgt.application.extension.dto;version="[5.0,6)", + io.entgra.device.mgt.core.apimgt.application.extension.exception;version="[5.0,6)", + io.entgra.device.mgt.core.application.mgt.common;version="[5.0,6)", + io.entgra.device.mgt.core.application.mgt.common.config;version="[5.0,6)", + io.entgra.device.mgt.core.application.mgt.common.dto;version="[5.0,6)", + io.entgra.device.mgt.core.application.mgt.common.exception;version="[5.0,6)", + io.entgra.device.mgt.core.application.mgt.common.response;version="[5.0,6)", + io.entgra.device.mgt.core.application.mgt.common.services;version="[5.0,6)", + io.entgra.device.mgt.core.application.mgt.common.wrapper;version="[5.0,6)", + io.entgra.device.mgt.core.application.mgt.core.config, + io.entgra.device.mgt.core.application.mgt.core.dao, + io.entgra.device.mgt.core.application.mgt.core.dao.common, + io.entgra.device.mgt.core.application.mgt.core.dao.impl, + io.entgra.device.mgt.core.application.mgt.core.dao.impl.application, + io.entgra.device.mgt.core.application.mgt.core.dao.impl.application.release, + io.entgra.device.mgt.core.application.mgt.core.dao.impl.application.spapplication, + io.entgra.device.mgt.core.application.mgt.core.dao.impl.lifecyclestate, + io.entgra.device.mgt.core.application.mgt.core.dao.impl.review, + io.entgra.device.mgt.core.application.mgt.core.dao.impl.subscription, + io.entgra.device.mgt.core.application.mgt.core.dao.impl.visibility, + io.entgra.device.mgt.core.application.mgt.core.exception, + io.entgra.device.mgt.core.application.mgt.core.serviceprovider, + io.entgra.device.mgt.core.device.mgt.common;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.app.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.app.mgt.android;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.exceptions;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.group.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.operation.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.permission.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.core.common.exception;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.core.common.util;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.core.dto;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.core.operation.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.core.permission.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.core.service;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.core.task.impl;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.core.util;version="[5.0,6)", + io.entgra.device.mgt.core.identity.jwt.client.extension;version="[5.0,6)", + io.entgra.device.mgt.core.identity.jwt.client.extension.dto;version="[5.0,6)", + io.entgra.device.mgt.core.identity.jwt.client.extension.exception;version="[5.0,6)", + io.entgra.device.mgt.core.identity.jwt.client.extension.service;version="[5.0,6)", + javax.annotation;version="[1.0,2)", + javax.naming, + javax.sql, + + javax.xml.bind;version="[0.0,1)", + javax.xml.bind.annotation;version="[0.0,1)", + javax.xml.parsers;version="${javax.xml.parsers.import.pkg.version}", + org.apache.commons.codec.digest;version="[1.4,2)", + org.apache.commons.httpclient;version="[3.1,4)", + org.apache.commons.httpclient.methods;version="[3.1,4)", + org.apache.commons.io;version="[2.4,3)", + org.apache.commons.lang;version="[2.6,3)", + org.apache.commons.lang3;version="[3.12,4)", + org.apache.commons.logging;version="[1.2,2)", + org.apache.commons.validator.routines;version="[1.7,2)", + + org.apache.http;version="[4.4,5)", + org.apache.http.client;version="[4.3,5)", + org.apache.http.client.methods;version="[4.3,5)", + org.apache.http.impl.client;version="[4.3,5)", + org.bouncycastle.cert, + org.bouncycastle.cert.jcajce, + org.bouncycastle.cms, + org.bouncycastle.jce.provider;version="[1.70,2)", + org.bouncycastle.util;version="[1.70,2)", + org.json;version="[3.0,4)", org.osgi.framework.*;version="${imp.package.version.osgi.framework}", org.osgi.service.*;version="${imp.package.version.osgi.service}", - org.apache.commons.logging, - javax.xml.parsers;version="${javax.xml.parsers.import.pkg.version}";resolution:=optional, - org.wso2.carbon.context.*, - org.wso2.carbon.utils.*, - org.w3c.dom, - org.json, - javax.sql, - com.google.gson.*, - javax.naming, - javax.xml.bind.annotation; version="${javax.xml.bind.imp.pkg.version}", - javax.xml.bind; version="${javax.xml.bind.imp.pkg.version}", - io.entgra.device.mgt.core.application.mgt.common.*, - io.entgra.device.mgt.core.device.mgt.core.*, - io.entgra.device.mgt.core.device.mgt.common.*, - org.wso2.carbon.user.core.*, - org.wso2.carbon.user.api.*, - org.wso2.carbon.ntask.*, - org.quartz.*, - org.wso2.carbon.ndatasource.core, - org.wso2.carbon, + org.quartz;version="[2.1,3)", + org.wso2.carbon.context;version="[4.8,5)", + org.wso2.carbon.ndatasource.core;version="[4.8,5)", + org.wso2.carbon.ntask.common;version="[4.9,5)", + org.wso2.carbon.ntask.core;version="[4.9,5)", + org.wso2.carbon.ntask.core.service;version="[4.9,5)", + org.wso2.carbon.user.api;version="[1.0,2)", + org.wso2.carbon.user.core.service;version="[4.8,5)", + org.wso2.carbon.utils;version="[4.8,5)", + org.wso2.carbon.utils.dbcreator;version="[4.8,5)", org.xml.sax, - org.xml.sax.helpers, - org.apache.commons.io, - org.apache.commons.codec.binary;version="${commons-codec.wso2.osgi.version.range}", - org.apache.commons.codec.digest;version="${commons-codec.wso2.osgi.version.range}", - org.wso2.carbon.base, - com.dd.*, - io.entgra.device.mgt.core.identity.jwt.client.extension.*, - io.entgra.device.mgt.core.apimgt.application.extension.*, - org.apache.commons.httpclient, - org.apache.commons.httpclient.methods, - org.apache.commons.validator.routines + org.xml.sax.helpers apk-parser;scope=compile|runtime;inline=false @@ -112,16 +167,9 @@ - org.eclipse.osgi - org.eclipse.osgi - - - org.eclipse.osgi - org.eclipse.osgi.services - - - org.eclipse.equinox - org.eclipse.equinox.common + org.apache.felix + org.apache.felix.scr.ds-annotations + provided org.testng @@ -136,7 +184,6 @@ org.ops4j.pax.logging pax-logging-api provided - org.wso2.carbon diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/config/Configuration.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/config/Configuration.java index b5efa7f99f..6d7c84476b 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/config/Configuration.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/config/Configuration.java @@ -17,14 +17,14 @@ */ package io.entgra.device.mgt.core.application.mgt.core.config; +import io.entgra.device.mgt.core.application.mgt.common.config.LifecycleState; import io.entgra.device.mgt.core.application.mgt.common.config.MDMConfig; import io.entgra.device.mgt.core.application.mgt.common.config.RatingConfiguration; -import io.entgra.device.mgt.core.application.mgt.common.config.LifecycleState; -import java.util.List; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlRootElement; +import java.util.List; /** * Represents the Application Management Configuration. diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/config/ConfigurationManager.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/config/ConfigurationManager.java index 77b75deeab..9b7e56caba 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/config/ConfigurationManager.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/config/ConfigurationManager.java @@ -17,15 +17,15 @@ */ package io.entgra.device.mgt.core.application.mgt.core.config; +import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationManagementException; +import io.entgra.device.mgt.core.application.mgt.common.exception.InvalidConfigurationException; import io.entgra.device.mgt.core.application.mgt.core.util.Constants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationManagementException; -import io.entgra.device.mgt.core.application.mgt.common.exception.InvalidConfigurationException; -import java.io.File; import javax.xml.bind.JAXBContext; import javax.xml.bind.Unmarshaller; +import java.io.File; /** * ConfigurationManager is responsible for the managing Application Management related configurations. diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/config/Extension.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/config/Extension.java index 553ee67172..3436fc04fb 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/config/Extension.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/config/Extension.java @@ -17,11 +17,11 @@ */ package io.entgra.device.mgt.core.application.mgt.core.config; -import java.util.List; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlRootElement; +import java.util.List; /** * Represents a extension in the application management configuration. diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/ApplicationDAO.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/ApplicationDAO.java index 6886e824f2..71e71e2abc 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/ApplicationDAO.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/ApplicationDAO.java @@ -17,7 +17,7 @@ */ package io.entgra.device.mgt.core.application.mgt.core.dao; -import io.entgra.device.mgt.core.application.mgt.common.*; +import io.entgra.device.mgt.core.application.mgt.common.Filter; import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationDTO; import io.entgra.device.mgt.core.application.mgt.common.dto.CategoryDTO; import io.entgra.device.mgt.core.application.mgt.common.dto.TagDTO; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/ApplicationReleaseDAO.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/ApplicationReleaseDAO.java index cd893979dd..aa1aaff816 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/ApplicationReleaseDAO.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/ApplicationReleaseDAO.java @@ -17,8 +17,8 @@ */ package io.entgra.device.mgt.core.application.mgt.core.dao; -import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationReleaseDTO; import io.entgra.device.mgt.core.application.mgt.common.Rating; +import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationReleaseDTO; import io.entgra.device.mgt.core.application.mgt.core.exception.ApplicationManagementDAOException; import java.util.List; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/ReviewDAO.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/ReviewDAO.java index 9a12859b5c..e4db2592f9 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/ReviewDAO.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/ReviewDAO.java @@ -17,9 +17,9 @@ */ package io.entgra.device.mgt.core.application.mgt.core.dao; -import io.entgra.device.mgt.core.application.mgt.common.response.Review; import io.entgra.device.mgt.core.application.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.application.mgt.common.dto.ReviewDTO; +import io.entgra.device.mgt.core.application.mgt.common.response.Review; import io.entgra.device.mgt.core.application.mgt.core.exception.ReviewManagementDAOException; import java.util.List; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/SPApplicationDAO.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/SPApplicationDAO.java index 712a0e28b3..b722030343 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/SPApplicationDAO.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/SPApplicationDAO.java @@ -18,8 +18,8 @@ package io.entgra.device.mgt.core.application.mgt.core.dao; -import io.entgra.device.mgt.core.application.mgt.common.dto.IdentityServerDTO; import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationDTO; +import io.entgra.device.mgt.core.application.mgt.common.dto.IdentityServerDTO; import io.entgra.device.mgt.core.application.mgt.core.exception.ApplicationManagementDAOException; import java.util.List; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/common/ApplicationManagementDAOFactory.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/common/ApplicationManagementDAOFactory.java index e7996ee804..554bd32b1e 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/common/ApplicationManagementDAOFactory.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/common/ApplicationManagementDAOFactory.java @@ -17,38 +17,25 @@ */ package io.entgra.device.mgt.core.application.mgt.core.dao.common; -import io.entgra.device.mgt.core.application.mgt.core.dao.SPApplicationDAO; -import io.entgra.device.mgt.core.application.mgt.core.dao.impl.application.spapplication.GenericSPApplicationDAOImpl; -import io.entgra.device.mgt.core.application.mgt.core.dao.impl.application.spapplication.OracleSPApplicationDAOImpl; -import io.entgra.device.mgt.core.application.mgt.core.dao.impl.application.spapplication.PostgreSQLSPApplicationDAOImpl; -import io.entgra.device.mgt.core.application.mgt.core.dao.impl.application.spapplication.SQLServerSPApplicationDAOImpl; -import io.entgra.device.mgt.core.application.mgt.core.dao.impl.visibility.GenericVisibilityDAOImpl; -import io.entgra.device.mgt.core.application.mgt.core.dao.impl.visibility.OracleVisibilityDAOImpl; -import io.entgra.device.mgt.core.application.mgt.core.dao.impl.visibility.PostgreSQLVisibilityDAOImpl; -import io.entgra.device.mgt.core.application.mgt.core.dao.impl.visibility.SQLServerVisibilityDAOImpl; -import io.entgra.device.mgt.core.application.mgt.core.util.Constants; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.application.mgt.common.exception.UnsupportedDatabaseEngineException; -import io.entgra.device.mgt.core.application.mgt.core.dao.ApplicationDAO; -import io.entgra.device.mgt.core.application.mgt.core.dao.ApplicationReleaseDAO; -import io.entgra.device.mgt.core.application.mgt.core.dao.LifecycleStateDAO; -import io.entgra.device.mgt.core.application.mgt.core.dao.ReviewDAO; -import io.entgra.device.mgt.core.application.mgt.core.dao.SubscriptionDAO; -import io.entgra.device.mgt.core.application.mgt.core.dao.VisibilityDAO; +import io.entgra.device.mgt.core.application.mgt.core.dao.*; +import io.entgra.device.mgt.core.application.mgt.core.dao.impl.application.GenericApplicationDAOImpl; +import io.entgra.device.mgt.core.application.mgt.core.dao.impl.application.OracleApplicationDAOImpl; import io.entgra.device.mgt.core.application.mgt.core.dao.impl.application.PostgreSQLApplicationDAOImpl; import io.entgra.device.mgt.core.application.mgt.core.dao.impl.application.SQLServerApplicationDAOImpl; +import io.entgra.device.mgt.core.application.mgt.core.dao.impl.application.release.GenericApplicationReleaseDAOImpl; import io.entgra.device.mgt.core.application.mgt.core.dao.impl.application.release.OracleApplicationReleaseDAOImpl; import io.entgra.device.mgt.core.application.mgt.core.dao.impl.application.release.PostgreSQLApplicationReleaseDAOImpl; import io.entgra.device.mgt.core.application.mgt.core.dao.impl.application.release.SQLServerApplicationReleaseDAOImpl; +import io.entgra.device.mgt.core.application.mgt.core.dao.impl.application.spapplication.GenericSPApplicationDAOImpl; +import io.entgra.device.mgt.core.application.mgt.core.dao.impl.application.spapplication.OracleSPApplicationDAOImpl; +import io.entgra.device.mgt.core.application.mgt.core.dao.impl.application.spapplication.PostgreSQLSPApplicationDAOImpl; +import io.entgra.device.mgt.core.application.mgt.core.dao.impl.application.spapplication.SQLServerSPApplicationDAOImpl; +import io.entgra.device.mgt.core.application.mgt.core.dao.impl.lifecyclestate.GenericLifecycleStateDAOImpl; import io.entgra.device.mgt.core.application.mgt.core.dao.impl.lifecyclestate.OracleLifecycleStateDAOImpl; import io.entgra.device.mgt.core.application.mgt.core.dao.impl.lifecyclestate.PostgreSQLLifecycleStateDAOImpl; import io.entgra.device.mgt.core.application.mgt.core.dao.impl.lifecyclestate.SQLServerLifecycleStateDAOImpl; import io.entgra.device.mgt.core.application.mgt.core.dao.impl.review.GenericReviewDAOImpl; -import io.entgra.device.mgt.core.application.mgt.core.dao.impl.application.GenericApplicationDAOImpl; -import io.entgra.device.mgt.core.application.mgt.core.dao.impl.application.release.GenericApplicationReleaseDAOImpl; -import io.entgra.device.mgt.core.application.mgt.core.dao.impl.application.OracleApplicationDAOImpl; -import io.entgra.device.mgt.core.application.mgt.core.dao.impl.lifecyclestate.GenericLifecycleStateDAOImpl; import io.entgra.device.mgt.core.application.mgt.core.dao.impl.review.OracleReviewDAOImpl; import io.entgra.device.mgt.core.application.mgt.core.dao.impl.review.PostgreSQLReviewDAOImpl; import io.entgra.device.mgt.core.application.mgt.core.dao.impl.review.SQLServerReviewDAOImpl; @@ -56,7 +43,14 @@ import io.entgra.device.mgt.core.application.mgt.core.dao.impl.subscription.Gene import io.entgra.device.mgt.core.application.mgt.core.dao.impl.subscription.OracleSubscriptionDAOImpl; import io.entgra.device.mgt.core.application.mgt.core.dao.impl.subscription.PostgreSQLSubscriptionDAOImpl; import io.entgra.device.mgt.core.application.mgt.core.dao.impl.subscription.SQLServerSubscriptionDAOImpl; +import io.entgra.device.mgt.core.application.mgt.core.dao.impl.visibility.GenericVisibilityDAOImpl; +import io.entgra.device.mgt.core.application.mgt.core.dao.impl.visibility.OracleVisibilityDAOImpl; +import io.entgra.device.mgt.core.application.mgt.core.dao.impl.visibility.PostgreSQLVisibilityDAOImpl; +import io.entgra.device.mgt.core.application.mgt.core.dao.impl.visibility.SQLServerVisibilityDAOImpl; import io.entgra.device.mgt.core.application.mgt.core.util.ConnectionManagerUtil; +import io.entgra.device.mgt.core.application.mgt.core.util.Constants; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import javax.sql.DataSource; import java.sql.SQLException; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java index a6abaef4cb..82f4b3d191 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java @@ -17,27 +17,23 @@ */ package io.entgra.device.mgt.core.application.mgt.core.dao.impl.application; +import io.entgra.device.mgt.core.application.mgt.common.AppLifecycleState; +import io.entgra.device.mgt.core.application.mgt.common.Filter; +import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationDTO; +import io.entgra.device.mgt.core.application.mgt.common.dto.CategoryDTO; +import io.entgra.device.mgt.core.application.mgt.common.dto.TagDTO; +import io.entgra.device.mgt.core.application.mgt.common.exception.DBConnectionException; import io.entgra.device.mgt.core.application.mgt.core.dao.ApplicationDAO; import io.entgra.device.mgt.core.application.mgt.core.dao.impl.AbstractDAOImpl; +import io.entgra.device.mgt.core.application.mgt.core.exception.ApplicationManagementDAOException; import io.entgra.device.mgt.core.application.mgt.core.exception.UnexpectedServerErrorException; import io.entgra.device.mgt.core.application.mgt.core.util.Constants; import io.entgra.device.mgt.core.application.mgt.core.util.DAOUtil; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.application.mgt.common.AppLifecycleState; -import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationDTO; -import io.entgra.device.mgt.core.application.mgt.common.dto.CategoryDTO; -import io.entgra.device.mgt.core.application.mgt.common.Filter; -import io.entgra.device.mgt.core.application.mgt.common.dto.TagDTO; -import io.entgra.device.mgt.core.application.mgt.common.exception.DBConnectionException; -import io.entgra.device.mgt.core.application.mgt.core.exception.ApplicationManagementDAOException; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; +import java.sql.*; import java.util.ArrayList; import java.util.List; import java.util.StringJoiner; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/OracleApplicationDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/OracleApplicationDAOImpl.java index 2a9796bfd3..2be1528037 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/OracleApplicationDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/OracleApplicationDAOImpl.java @@ -18,15 +18,15 @@ package io.entgra.device.mgt.core.application.mgt.core.dao.impl.application; +import io.entgra.device.mgt.core.application.mgt.common.Filter; +import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationDTO; +import io.entgra.device.mgt.core.application.mgt.common.exception.DBConnectionException; +import io.entgra.device.mgt.core.application.mgt.core.exception.ApplicationManagementDAOException; import io.entgra.device.mgt.core.application.mgt.core.util.Constants; import io.entgra.device.mgt.core.application.mgt.core.util.DAOUtil; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.application.mgt.common.Filter; -import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationDTO; -import io.entgra.device.mgt.core.application.mgt.common.exception.DBConnectionException; -import io.entgra.device.mgt.core.application.mgt.core.exception.ApplicationManagementDAOException; import java.sql.Connection; import java.sql.PreparedStatement; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/SQLServerApplicationDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/SQLServerApplicationDAOImpl.java index ce912f5dc4..95e7f7e54f 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/SQLServerApplicationDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/SQLServerApplicationDAOImpl.java @@ -18,15 +18,15 @@ package io.entgra.device.mgt.core.application.mgt.core.dao.impl.application; +import io.entgra.device.mgt.core.application.mgt.common.Filter; +import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationDTO; +import io.entgra.device.mgt.core.application.mgt.common.exception.DBConnectionException; +import io.entgra.device.mgt.core.application.mgt.core.exception.ApplicationManagementDAOException; import io.entgra.device.mgt.core.application.mgt.core.util.Constants; import io.entgra.device.mgt.core.application.mgt.core.util.DAOUtil; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.application.mgt.common.Filter; -import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationDTO; -import io.entgra.device.mgt.core.application.mgt.common.exception.DBConnectionException; -import io.entgra.device.mgt.core.application.mgt.core.exception.ApplicationManagementDAOException; import java.sql.Connection; import java.sql.PreparedStatement; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/release/GenericApplicationReleaseDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/release/GenericApplicationReleaseDAOImpl.java index 400ff9e7ef..78d16d56bb 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/release/GenericApplicationReleaseDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/release/GenericApplicationReleaseDAOImpl.java @@ -18,21 +18,17 @@ package io.entgra.device.mgt.core.application.mgt.core.dao.impl.application.release; -import io.entgra.device.mgt.core.application.mgt.core.util.DAOUtil; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationReleaseDTO; import io.entgra.device.mgt.core.application.mgt.common.Rating; +import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationReleaseDTO; import io.entgra.device.mgt.core.application.mgt.common.exception.DBConnectionException; import io.entgra.device.mgt.core.application.mgt.core.dao.ApplicationReleaseDAO; import io.entgra.device.mgt.core.application.mgt.core.dao.impl.AbstractDAOImpl; import io.entgra.device.mgt.core.application.mgt.core.exception.ApplicationManagementDAOException; +import io.entgra.device.mgt.core.application.mgt.core.util.DAOUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; +import java.sql.*; import java.util.ArrayList; import java.util.List; import java.util.StringJoiner; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/release/OracleApplicationReleaseDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/release/OracleApplicationReleaseDAOImpl.java index c772a2baad..37a2c757db 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/release/OracleApplicationReleaseDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/release/OracleApplicationReleaseDAOImpl.java @@ -18,10 +18,10 @@ package io.entgra.device.mgt.core.application.mgt.core.dao.impl.application.release; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.application.mgt.common.exception.DBConnectionException; import io.entgra.device.mgt.core.application.mgt.core.exception.ApplicationManagementDAOException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.sql.Connection; import java.sql.PreparedStatement; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/release/SQLServerApplicationReleaseDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/release/SQLServerApplicationReleaseDAOImpl.java index 9ef21c12e8..7a6a9b1d5b 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/release/SQLServerApplicationReleaseDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/release/SQLServerApplicationReleaseDAOImpl.java @@ -18,10 +18,10 @@ package io.entgra.device.mgt.core.application.mgt.core.dao.impl.application.release; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.application.mgt.common.exception.DBConnectionException; import io.entgra.device.mgt.core.application.mgt.core.exception.ApplicationManagementDAOException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.sql.Connection; import java.sql.PreparedStatement; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/spapplication/GenericSPApplicationDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/spapplication/GenericSPApplicationDAOImpl.java index 5a5b130157..f30cd71da4 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/spapplication/GenericSPApplicationDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/spapplication/GenericSPApplicationDAOImpl.java @@ -18,8 +18,8 @@ package io.entgra.device.mgt.core.application.mgt.core.dao.impl.application.spapplication; -import io.entgra.device.mgt.core.application.mgt.common.dto.IdentityServerDTO; import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationDTO; +import io.entgra.device.mgt.core.application.mgt.common.dto.IdentityServerDTO; import io.entgra.device.mgt.core.application.mgt.common.exception.DBConnectionException; import io.entgra.device.mgt.core.application.mgt.core.dao.SPApplicationDAO; import io.entgra.device.mgt.core.application.mgt.core.dao.impl.AbstractDAOImpl; @@ -30,11 +30,7 @@ import io.entgra.device.mgt.core.application.mgt.core.util.DAOUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; +import java.sql.*; import java.util.List; public class GenericSPApplicationDAOImpl extends AbstractDAOImpl implements SPApplicationDAO { diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/spapplication/OracleSPApplicationDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/spapplication/OracleSPApplicationDAOImpl.java index d190d88296..008f64db89 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/spapplication/OracleSPApplicationDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/spapplication/OracleSPApplicationDAOImpl.java @@ -18,8 +18,8 @@ package io.entgra.device.mgt.core.application.mgt.core.dao.impl.application.spapplication; -import io.entgra.device.mgt.core.application.mgt.common.dto.IdentityServerDTO; import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationDTO; +import io.entgra.device.mgt.core.application.mgt.common.dto.IdentityServerDTO; import io.entgra.device.mgt.core.application.mgt.common.exception.DBConnectionException; import io.entgra.device.mgt.core.application.mgt.core.dao.SPApplicationDAO; import io.entgra.device.mgt.core.application.mgt.core.dao.impl.AbstractDAOImpl; @@ -28,11 +28,8 @@ import io.entgra.device.mgt.core.application.mgt.core.exception.UnexpectedServer import io.entgra.device.mgt.core.application.mgt.core.util.DAOUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; + +import java.sql.*; import java.util.List; public class OracleSPApplicationDAOImpl extends AbstractDAOImpl implements SPApplicationDAO { diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/spapplication/PostgreSQLSPApplicationDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/spapplication/PostgreSQLSPApplicationDAOImpl.java index d599d0db69..2339e92e10 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/spapplication/PostgreSQLSPApplicationDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/spapplication/PostgreSQLSPApplicationDAOImpl.java @@ -18,8 +18,8 @@ package io.entgra.device.mgt.core.application.mgt.core.dao.impl.application.spapplication; -import io.entgra.device.mgt.core.application.mgt.common.dto.IdentityServerDTO; import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationDTO; +import io.entgra.device.mgt.core.application.mgt.common.dto.IdentityServerDTO; import io.entgra.device.mgt.core.application.mgt.common.exception.DBConnectionException; import io.entgra.device.mgt.core.application.mgt.core.dao.SPApplicationDAO; import io.entgra.device.mgt.core.application.mgt.core.dao.impl.AbstractDAOImpl; @@ -28,11 +28,8 @@ import io.entgra.device.mgt.core.application.mgt.core.exception.UnexpectedServer import io.entgra.device.mgt.core.application.mgt.core.util.DAOUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; + +import java.sql.*; import java.util.List; public class PostgreSQLSPApplicationDAOImpl extends AbstractDAOImpl implements SPApplicationDAO { diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/spapplication/SQLServerSPApplicationDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/spapplication/SQLServerSPApplicationDAOImpl.java index 3061b96a86..1b6e7a4e1b 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/spapplication/SQLServerSPApplicationDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/application/spapplication/SQLServerSPApplicationDAOImpl.java @@ -18,8 +18,8 @@ package io.entgra.device.mgt.core.application.mgt.core.dao.impl.application.spapplication; -import io.entgra.device.mgt.core.application.mgt.common.dto.IdentityServerDTO; import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationDTO; +import io.entgra.device.mgt.core.application.mgt.common.dto.IdentityServerDTO; import io.entgra.device.mgt.core.application.mgt.common.exception.DBConnectionException; import io.entgra.device.mgt.core.application.mgt.core.dao.SPApplicationDAO; import io.entgra.device.mgt.core.application.mgt.core.dao.impl.AbstractDAOImpl; @@ -28,11 +28,8 @@ import io.entgra.device.mgt.core.application.mgt.core.exception.UnexpectedServer import io.entgra.device.mgt.core.application.mgt.core.util.DAOUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; + +import java.sql.*; import java.util.List; public class SQLServerSPApplicationDAOImpl extends AbstractDAOImpl implements SPApplicationDAO { diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/lifecyclestate/GenericLifecycleStateDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/lifecyclestate/GenericLifecycleStateDAOImpl.java index f1fdece953..3d40c552ac 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/lifecyclestate/GenericLifecycleStateDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/lifecyclestate/GenericLifecycleStateDAOImpl.java @@ -17,21 +17,17 @@ */ package io.entgra.device.mgt.core.application.mgt.core.dao.impl.lifecyclestate; -import io.entgra.device.mgt.core.application.mgt.core.dao.impl.AbstractDAOImpl; -import io.entgra.device.mgt.core.application.mgt.core.util.DAOUtil; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.application.mgt.common.AppLifecycleState; import io.entgra.device.mgt.core.application.mgt.common.LifecycleState; import io.entgra.device.mgt.core.application.mgt.common.exception.DBConnectionException; import io.entgra.device.mgt.core.application.mgt.core.dao.LifecycleStateDAO; +import io.entgra.device.mgt.core.application.mgt.core.dao.impl.AbstractDAOImpl; import io.entgra.device.mgt.core.application.mgt.core.exception.LifeCycleManagementDAOException; +import io.entgra.device.mgt.core.application.mgt.core.util.DAOUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Timestamp; +import java.sql.*; import java.util.ArrayList; import java.util.List; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/review/GenericReviewDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/review/GenericReviewDAOImpl.java index 075ba6b01f..e6d98993e6 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/review/GenericReviewDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/review/GenericReviewDAOImpl.java @@ -17,24 +17,19 @@ */ package io.entgra.device.mgt.core.application.mgt.core.dao.impl.review; -import io.entgra.device.mgt.core.application.mgt.core.exception.UnexpectedServerErrorException; -import io.entgra.device.mgt.core.application.mgt.core.util.Constants; -import io.entgra.device.mgt.core.application.mgt.core.util.DAOUtil; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - import io.entgra.device.mgt.core.application.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.application.mgt.common.dto.ReviewDTO; import io.entgra.device.mgt.core.application.mgt.common.exception.DBConnectionException; import io.entgra.device.mgt.core.application.mgt.core.dao.ReviewDAO; import io.entgra.device.mgt.core.application.mgt.core.dao.impl.AbstractDAOImpl; import io.entgra.device.mgt.core.application.mgt.core.exception.ReviewManagementDAOException; +import io.entgra.device.mgt.core.application.mgt.core.exception.UnexpectedServerErrorException; +import io.entgra.device.mgt.core.application.mgt.core.util.Constants; +import io.entgra.device.mgt.core.application.mgt.core.util.DAOUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; -import java.sql.SQLException; -import java.sql.ResultSet; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.Timestamp; +import java.sql.*; import java.util.ArrayList; import java.util.List; import java.util.StringJoiner; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/review/OracleReviewDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/review/OracleReviewDAOImpl.java index 162e57a101..7f8d2dbaf6 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/review/OracleReviewDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/review/OracleReviewDAOImpl.java @@ -18,14 +18,14 @@ package io.entgra.device.mgt.core.application.mgt.core.dao.impl.review; -import io.entgra.device.mgt.core.application.mgt.core.util.Constants; -import io.entgra.device.mgt.core.application.mgt.core.util.DAOUtil; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.application.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.application.mgt.common.dto.ReviewDTO; import io.entgra.device.mgt.core.application.mgt.common.exception.DBConnectionException; import io.entgra.device.mgt.core.application.mgt.core.exception.ReviewManagementDAOException; +import io.entgra.device.mgt.core.application.mgt.core.util.Constants; +import io.entgra.device.mgt.core.application.mgt.core.util.DAOUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.sql.Connection; import java.sql.PreparedStatement; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/review/SQLServerReviewDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/review/SQLServerReviewDAOImpl.java index 5a40b11b07..990eea30b3 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/review/SQLServerReviewDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/review/SQLServerReviewDAOImpl.java @@ -18,14 +18,14 @@ package io.entgra.device.mgt.core.application.mgt.core.dao.impl.review; -import io.entgra.device.mgt.core.application.mgt.core.util.Constants; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.application.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.application.mgt.common.dto.ReviewDTO; import io.entgra.device.mgt.core.application.mgt.common.exception.DBConnectionException; import io.entgra.device.mgt.core.application.mgt.core.exception.ReviewManagementDAOException; +import io.entgra.device.mgt.core.application.mgt.core.util.Constants; import io.entgra.device.mgt.core.application.mgt.core.util.DAOUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.sql.Connection; import java.sql.PreparedStatement; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/subscription/GenericSubscriptionDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/subscription/GenericSubscriptionDAOImpl.java index 353340e3d3..bd3bdf3bb6 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/subscription/GenericSubscriptionDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/subscription/GenericSubscriptionDAOImpl.java @@ -17,32 +17,22 @@ */ package io.entgra.device.mgt.core.application.mgt.core.dao.impl.subscription; -import io.entgra.device.mgt.core.application.mgt.core.dao.SubscriptionDAO; -import io.entgra.device.mgt.core.application.mgt.core.dao.impl.AbstractDAOImpl; -import io.entgra.device.mgt.core.application.mgt.core.exception.UnexpectedServerErrorException; -import io.entgra.device.mgt.core.application.mgt.core.util.DAOUtil; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.application.mgt.common.ExecutionStatus; import io.entgra.device.mgt.core.application.mgt.common.SubAction; import io.entgra.device.mgt.core.application.mgt.common.SubscriptionType; import io.entgra.device.mgt.core.application.mgt.common.dto.DeviceSubscriptionDTO; import io.entgra.device.mgt.core.application.mgt.common.dto.ScheduledSubscriptionDTO; import io.entgra.device.mgt.core.application.mgt.common.exception.DBConnectionException; +import io.entgra.device.mgt.core.application.mgt.core.dao.SubscriptionDAO; +import io.entgra.device.mgt.core.application.mgt.core.dao.impl.AbstractDAOImpl; import io.entgra.device.mgt.core.application.mgt.core.exception.ApplicationManagementDAOException; +import io.entgra.device.mgt.core.application.mgt.core.exception.UnexpectedServerErrorException; +import io.entgra.device.mgt.core.application.mgt.core.util.DAOUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Calendar; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.StringJoiner; +import java.sql.*; +import java.util.*; public class GenericSubscriptionDAOImpl extends AbstractDAOImpl implements SubscriptionDAO { private static final Log log = LogFactory.getLog(GenericSubscriptionDAOImpl.class); diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/subscription/OracleSubscriptionDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/subscription/OracleSubscriptionDAOImpl.java index 9181b9b4de..47b5f78799 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/subscription/OracleSubscriptionDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/subscription/OracleSubscriptionDAOImpl.java @@ -18,10 +18,10 @@ package io.entgra.device.mgt.core.application.mgt.core.dao.impl.subscription; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.application.mgt.common.exception.DBConnectionException; import io.entgra.device.mgt.core.application.mgt.core.exception.ApplicationManagementDAOException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.sql.Connection; import java.sql.PreparedStatement; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/subscription/SQLServerSubscriptionDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/subscription/SQLServerSubscriptionDAOImpl.java index fb165ca3e0..f715a244c5 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/subscription/SQLServerSubscriptionDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/subscription/SQLServerSubscriptionDAOImpl.java @@ -18,10 +18,10 @@ package io.entgra.device.mgt.core.application.mgt.core.dao.impl.subscription; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.application.mgt.common.exception.DBConnectionException; import io.entgra.device.mgt.core.application.mgt.core.exception.ApplicationManagementDAOException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.sql.Connection; import java.sql.PreparedStatement; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/visibility/GenericVisibilityDAOImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/visibility/GenericVisibilityDAOImpl.java index ea0b0fb758..4cb37705d5 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/visibility/GenericVisibilityDAOImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/dao/impl/visibility/GenericVisibilityDAOImpl.java @@ -17,12 +17,12 @@ */ package io.entgra.device.mgt.core.application.mgt.core.dao.impl.visibility; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.application.mgt.common.exception.DBConnectionException; import io.entgra.device.mgt.core.application.mgt.core.dao.VisibilityDAO; import io.entgra.device.mgt.core.application.mgt.core.dao.impl.AbstractDAOImpl; import io.entgra.device.mgt.core.application.mgt.core.exception.VisibilityManagementDAOException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.sql.Connection; import java.sql.PreparedStatement; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java index 736613e786..9a50d0d00a 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationManagerImpl.java @@ -18,93 +18,49 @@ package io.entgra.device.mgt.core.application.mgt.core.impl; -import io.entgra.device.mgt.core.application.mgt.core.exception.BadRequestException; -import io.entgra.device.mgt.core.device.mgt.common.Base64File; -import io.entgra.device.mgt.core.application.mgt.core.dao.SPApplicationDAO; -import io.entgra.device.mgt.core.application.mgt.core.util.ApplicationManagementUtil; -import org.apache.commons.codec.digest.DigestUtils; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang.StringEscapeUtils; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.validator.routines.UrlValidator; -import org.apache.cxf.jaxrs.ext.multipart.Attachment; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.CarbonContext; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.application.mgt.common.ApplicationArtifact; -import io.entgra.device.mgt.core.application.mgt.common.ApplicationInstaller; -import io.entgra.device.mgt.core.application.mgt.common.DeviceTypes; -import io.entgra.device.mgt.core.application.mgt.common.LifecycleChanger; -import io.entgra.device.mgt.core.application.mgt.common.Pagination; +import io.entgra.device.mgt.core.application.mgt.common.*; import io.entgra.device.mgt.core.application.mgt.common.config.RatingConfiguration; -import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationDTO; -import io.entgra.device.mgt.core.application.mgt.common.ApplicationList; -import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationReleaseDTO; -import io.entgra.device.mgt.core.application.mgt.common.ApplicationSubscriptionType; -import io.entgra.device.mgt.core.application.mgt.common.ApplicationType; -import io.entgra.device.mgt.core.application.mgt.common.dto.CategoryDTO; -import io.entgra.device.mgt.core.application.mgt.common.Filter; -import io.entgra.device.mgt.core.application.mgt.common.dto.DeviceSubscriptionDTO; -import io.entgra.device.mgt.core.application.mgt.common.LifecycleState; -import io.entgra.device.mgt.core.application.mgt.common.dto.TagDTO; -import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationManagementException; -import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationStorageManagementException; -import io.entgra.device.mgt.core.application.mgt.common.exception.DBConnectionException; -import io.entgra.device.mgt.core.application.mgt.common.exception.LifecycleManagementException; -import io.entgra.device.mgt.core.application.mgt.common.exception.RequestValidatingException; -import io.entgra.device.mgt.core.application.mgt.common.exception.ResourceManagementException; -import io.entgra.device.mgt.core.application.mgt.common.exception.TransactionManagementException; +import io.entgra.device.mgt.core.application.mgt.common.dto.*; +import io.entgra.device.mgt.core.application.mgt.common.exception.*; import io.entgra.device.mgt.core.application.mgt.common.response.Application; import io.entgra.device.mgt.core.application.mgt.common.response.ApplicationRelease; import io.entgra.device.mgt.core.application.mgt.common.response.Category; import io.entgra.device.mgt.core.application.mgt.common.response.Tag; import io.entgra.device.mgt.core.application.mgt.common.services.ApplicationManager; import io.entgra.device.mgt.core.application.mgt.common.services.ApplicationStorageManager; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.CustomAppReleaseWrapper; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.CustomAppWrapper; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.EntAppReleaseWrapper; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.ApplicationUpdateWrapper; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.ApplicationWrapper; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.PublicAppReleaseWrapper; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.PublicAppWrapper; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.WebAppReleaseWrapper; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.WebAppWrapper; +import io.entgra.device.mgt.core.application.mgt.common.wrapper.*; import io.entgra.device.mgt.core.application.mgt.core.config.ConfigurationManager; -import io.entgra.device.mgt.core.application.mgt.core.dao.ApplicationDAO; -import io.entgra.device.mgt.core.application.mgt.core.dao.ApplicationReleaseDAO; -import io.entgra.device.mgt.core.application.mgt.core.dao.LifecycleStateDAO; -import io.entgra.device.mgt.core.application.mgt.core.dao.SubscriptionDAO; -import io.entgra.device.mgt.core.application.mgt.core.dao.VisibilityDAO; +import io.entgra.device.mgt.core.application.mgt.core.dao.*; import io.entgra.device.mgt.core.application.mgt.core.dao.common.ApplicationManagementDAOFactory; -import io.entgra.device.mgt.core.application.mgt.core.util.APIUtil; -import io.entgra.device.mgt.core.application.mgt.core.exception.ApplicationManagementDAOException; -import io.entgra.device.mgt.core.application.mgt.core.exception.ForbiddenException; -import io.entgra.device.mgt.core.application.mgt.core.exception.LifeCycleManagementDAOException; -import io.entgra.device.mgt.core.application.mgt.core.exception.NotFoundException; -import io.entgra.device.mgt.core.application.mgt.core.exception.VisibilityManagementDAOException; +import io.entgra.device.mgt.core.application.mgt.core.exception.*; import io.entgra.device.mgt.core.application.mgt.core.internal.DataHolder; import io.entgra.device.mgt.core.application.mgt.core.lifecycle.LifecycleStateManager; +import io.entgra.device.mgt.core.application.mgt.core.util.APIUtil; +import io.entgra.device.mgt.core.application.mgt.core.util.ApplicationManagementUtil; import io.entgra.device.mgt.core.application.mgt.core.util.ConnectionManagerUtil; import io.entgra.device.mgt.core.application.mgt.core.util.Constants; -import io.entgra.device.mgt.core.device.mgt.core.common.exception.StorageManagementException; +import io.entgra.device.mgt.core.device.mgt.common.Base64File; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; - +import io.entgra.device.mgt.core.device.mgt.core.common.exception.StorageManagementException; import io.entgra.device.mgt.core.device.mgt.core.dto.DeviceType; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; +import org.apache.commons.codec.digest.DigestUtils; +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang.StringEscapeUtils; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.commons.validator.routines.UrlValidator; +import org.apache.cxf.jaxrs.ext.multipart.Attachment; +import org.wso2.carbon.context.CarbonContext; +import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.user.api.UserRealm; import org.wso2.carbon.user.api.UserStoreException; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.UUID; +import java.util.*; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; @@ -1287,6 +1243,9 @@ public class ApplicationManagerImpl implements ApplicationManager { } applicationDTO.setId(appId); applicationDTO.setApplicationReleaseDTOs(applicationReleaseEntities); + if (applicationDTO.getType().equals("ENTERPRISE") || applicationDTO.getType().equals("PUBLIC") ) { + persistAppIconInfo(applicationReleaseDTO); + } return APIUtil.appDtoToAppResponse(applicationDTO); } } catch (LifeCycleManagementDAOException e) { @@ -1313,6 +1272,30 @@ public class ApplicationManagerImpl implements ApplicationManager { } } + /** + * Persist application icon information when creating an application + * + * @param applicationReleaseDTO {@link ApplicationReleaseDTO} + * @throws ApplicationManagementException if error occurred while persisting application icon information + */ + private void persistAppIconInfo(ApplicationReleaseDTO applicationReleaseDTO) + throws ApplicationManagementException { + try { + int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId(true); + String iconPath = APIUtil.createAppIconPath(applicationReleaseDTO, tenantId); + DataHolder.getInstance().getDeviceManagementService().saveApplicationIcon(iconPath, + String.valueOf(applicationReleaseDTO.getPackageName()), applicationReleaseDTO.getVersion(), tenantId); + } catch (ApplicationManagementException e) { + String msg = "Error occurred while creating iconPath. Application package name : " + applicationReleaseDTO.getPackageName(); + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } catch (DeviceManagementException e) { + String msg = "Error occurred while saving application icon info. Application package name : " + applicationReleaseDTO.getPackageName(); + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } + } + @Override public ApplicationRelease createRelease(ApplicationDTO applicationDTO, ApplicationReleaseDTO applicationReleaseDTO, ApplicationType type, boolean isPublished) @@ -1918,6 +1901,13 @@ public class ApplicationManagerImpl implements ApplicationManager { break; } } + try { + deleteAppIconInfo(applicationDTO); + } catch (ApplicationManagementException e) { + String msg = "Error occurred while deleting application icon info. Application package name: " + applicationDTO.getPackageName(); + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } } @Override @@ -4022,4 +4012,32 @@ public class ApplicationManagerImpl implements ApplicationManager { ConnectionManagerUtil.closeDBConnection(); } } + + @Override + public void updateAppIconInfo(ApplicationRelease applicationRelease, String oldPackageName) throws ApplicationManagementException { + try { + DataHolder.getInstance().getDeviceManagementService().updateApplicationIcon(applicationRelease.getIconPath(), + oldPackageName, applicationRelease.getPackageName(), applicationRelease.getVersion()); + } catch (DeviceManagementException e) { + String msg = "Error occurred while updating application icon info. Application package name: " + oldPackageName; + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } + } + + /** + * Delete application icon information when deleting an application + * + * @param applicationDTO {@link ApplicationDTO} + * @throws ApplicationManagementException if error occurred while deleting application icon information + */ + private void deleteAppIconInfo(ApplicationDTO applicationDTO) throws ApplicationManagementException { + try { + DataHolder.getInstance().getDeviceManagementService().deleteApplicationIcon(applicationDTO.getPackageName()); + } catch (DeviceManagementException e) { + String msg = "Error occurred while deleting application icon info. Application package name: " + applicationDTO.getPackageName(); + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } + } } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationStorageManagerImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationStorageManagerImpl.java index a79a3d23ee..4b580f046b 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationStorageManagerImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ApplicationStorageManagerImpl.java @@ -19,24 +19,27 @@ package io.entgra.device.mgt.core.application.mgt.core.impl; import com.dd.plist.NSDictionary; +import io.entgra.device.mgt.core.application.mgt.common.ApplicationInstaller; +import io.entgra.device.mgt.core.application.mgt.common.DeviceTypes; +import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationReleaseDTO; +import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationStorageManagementException; +import io.entgra.device.mgt.core.application.mgt.common.exception.ResourceManagementException; +import io.entgra.device.mgt.core.application.mgt.common.services.ApplicationStorageManager; import io.entgra.device.mgt.core.application.mgt.core.exception.ParsingException; import io.entgra.device.mgt.core.application.mgt.core.util.ArtifactsParser; import io.entgra.device.mgt.core.application.mgt.core.util.Constants; +import io.entgra.device.mgt.core.device.mgt.core.common.exception.StorageManagementException; +import io.entgra.device.mgt.core.device.mgt.core.common.util.StorageManagementUtil; import net.dongliu.apk.parser.bean.ApkMeta; import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.application.mgt.common.ApplicationInstaller; -import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationReleaseDTO; -import io.entgra.device.mgt.core.application.mgt.common.DeviceTypes; -import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationStorageManagementException; -import io.entgra.device.mgt.core.application.mgt.common.exception.ResourceManagementException; -import io.entgra.device.mgt.core.application.mgt.common.services.ApplicationStorageManager; -import io.entgra.device.mgt.core.device.mgt.core.common.exception.StorageManagementException; -import io.entgra.device.mgt.core.device.mgt.core.common.util.StorageManagementUtil; -import java.io.*; +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; import java.util.List; import static io.entgra.device.mgt.core.device.mgt.core.common.util.StorageManagementUtil.saveFile; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/AppmDataHandlerImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/AppmDataHandlerImpl.java index c8c613983e..73bb748c23 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/AppmDataHandlerImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/AppmDataHandlerImpl.java @@ -18,22 +18,22 @@ package io.entgra.device.mgt.core.application.mgt.core.impl; -import io.entgra.device.mgt.core.application.mgt.core.exception.BadRequestException; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.application.mgt.common.config.LifecycleState; import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationManagementException; import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationStorageManagementException; import io.entgra.device.mgt.core.application.mgt.common.exception.LifecycleManagementException; import io.entgra.device.mgt.core.application.mgt.common.services.ApplicationStorageManager; import io.entgra.device.mgt.core.application.mgt.common.services.AppmDataHandler; -import io.entgra.device.mgt.core.application.mgt.core.util.APIUtil; +import io.entgra.device.mgt.core.application.mgt.core.exception.BadRequestException; import io.entgra.device.mgt.core.application.mgt.core.exception.NotFoundException; import io.entgra.device.mgt.core.application.mgt.core.internal.DataHolder; import io.entgra.device.mgt.core.application.mgt.core.lifecycle.LifecycleStateManager; +import io.entgra.device.mgt.core.application.mgt.core.util.APIUtil; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.core.dto.DeviceType; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.io.InputStream; import java.util.Map; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ReviewManagerImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ReviewManagerImpl.java index 050b6743d4..5fbdabae62 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ReviewManagerImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/ReviewManagerImpl.java @@ -18,34 +18,30 @@ package io.entgra.device.mgt.core.application.mgt.core.impl; -import io.entgra.device.mgt.core.application.mgt.core.exception.BadRequestException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.application.mgt.common.Rating; -import io.entgra.device.mgt.core.application.mgt.common.ReviewNode; import io.entgra.device.mgt.core.application.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.application.mgt.common.PaginationResult; +import io.entgra.device.mgt.core.application.mgt.common.Rating; +import io.entgra.device.mgt.core.application.mgt.common.ReviewNode; import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationDTO; import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationReleaseDTO; import io.entgra.device.mgt.core.application.mgt.common.dto.ReviewDTO; import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationManagementException; -import io.entgra.device.mgt.core.application.mgt.common.exception.ReviewManagementException; import io.entgra.device.mgt.core.application.mgt.common.exception.DBConnectionException; +import io.entgra.device.mgt.core.application.mgt.common.exception.ReviewManagementException; import io.entgra.device.mgt.core.application.mgt.common.exception.TransactionManagementException; import io.entgra.device.mgt.core.application.mgt.common.response.Review; -import io.entgra.device.mgt.core.application.mgt.common.services.*; +import io.entgra.device.mgt.core.application.mgt.common.services.ReviewManager; import io.entgra.device.mgt.core.application.mgt.common.wrapper.ReviewWrapper; import io.entgra.device.mgt.core.application.mgt.core.dao.ApplicationDAO; import io.entgra.device.mgt.core.application.mgt.core.dao.ApplicationReleaseDAO; import io.entgra.device.mgt.core.application.mgt.core.dao.ReviewDAO; import io.entgra.device.mgt.core.application.mgt.core.dao.common.ApplicationManagementDAOFactory; -import io.entgra.device.mgt.core.application.mgt.core.exception.ApplicationManagementDAOException; -import io.entgra.device.mgt.core.application.mgt.core.exception.ForbiddenException; -import io.entgra.device.mgt.core.application.mgt.core.exception.NotFoundException; -import io.entgra.device.mgt.core.application.mgt.core.exception.ReviewManagementDAOException; +import io.entgra.device.mgt.core.application.mgt.core.exception.*; import io.entgra.device.mgt.core.application.mgt.core.util.ConnectionManagerUtil; import io.entgra.device.mgt.core.application.mgt.core.util.Constants; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.PrivilegedCarbonContext; import java.util.ArrayList; import java.util.Comparator; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/SPApplicationManagerImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/SPApplicationManagerImpl.java index 279088baa3..b1e7451288 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/SPApplicationManagerImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/SPApplicationManagerImpl.java @@ -19,10 +19,10 @@ package io.entgra.device.mgt.core.application.mgt.core.impl; import io.entgra.device.mgt.core.application.mgt.common.IdentityServerResponse; -import io.entgra.device.mgt.core.application.mgt.common.SPApplicationListResponse; -import io.entgra.device.mgt.core.application.mgt.common.dto.IdentityServerDTO; import io.entgra.device.mgt.core.application.mgt.common.SPApplication; +import io.entgra.device.mgt.core.application.mgt.common.SPApplicationListResponse; import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationDTO; +import io.entgra.device.mgt.core.application.mgt.common.dto.IdentityServerDTO; import io.entgra.device.mgt.core.application.mgt.common.dto.IdentityServiceProviderDTO; import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationManagementException; import io.entgra.device.mgt.core.application.mgt.common.exception.DBConnectionException; @@ -39,18 +39,17 @@ import io.entgra.device.mgt.core.application.mgt.core.dao.common.ApplicationMana import io.entgra.device.mgt.core.application.mgt.core.exception.ApplicationManagementDAOException; import io.entgra.device.mgt.core.application.mgt.core.exception.BadRequestException; import io.entgra.device.mgt.core.application.mgt.core.exception.NotFoundException; -import io.entgra.device.mgt.core.application.mgt.core.serviceprovider.ISServiceProviderApplicationService; import io.entgra.device.mgt.core.application.mgt.core.internal.DataHolder; import io.entgra.device.mgt.core.application.mgt.core.lifecycle.LifecycleStateManager; +import io.entgra.device.mgt.core.application.mgt.core.serviceprovider.ISServiceProviderApplicationService; import io.entgra.device.mgt.core.application.mgt.core.util.APIUtil; import io.entgra.device.mgt.core.application.mgt.core.util.ApplicationManagementUtil; import io.entgra.device.mgt.core.application.mgt.core.util.ConnectionManagerUtil; +import io.entgra.device.mgt.core.device.mgt.core.common.util.HttpUtil; import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.commons.validator.routines.UrlValidator; import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.device.mgt.core.common.util.HttpUtil; import java.util.ArrayList; import java.util.List; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/SubscriptionManagerImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/SubscriptionManagerImpl.java index 2412176b67..cae569bbd3 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/SubscriptionManagerImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/impl/SubscriptionManagerImpl.java @@ -19,54 +19,26 @@ package io.entgra.device.mgt.core.application.mgt.core.impl; import com.google.gson.Gson; -import io.entgra.device.mgt.core.application.mgt.core.exception.BadRequestException; -import org.apache.commons.httpclient.HttpClient; -import org.apache.commons.httpclient.HttpException; -import org.apache.commons.httpclient.HttpMethodBase; -import org.apache.commons.httpclient.methods.PostMethod; -import org.apache.commons.httpclient.methods.StringRequestEntity; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.json.JSONArray; -import org.json.JSONObject; import io.entgra.device.mgt.core.apimgt.application.extension.dto.ApiApplicationKey; import io.entgra.device.mgt.core.apimgt.application.extension.exception.APIManagerException; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.application.mgt.common.ApplicationInstallResponse; -import io.entgra.device.mgt.core.application.mgt.common.ApplicationSubscriptionInfo; -import io.entgra.device.mgt.core.application.mgt.common.ApplicationType; -import io.entgra.device.mgt.core.application.mgt.common.DeviceSubscriptionData; -import io.entgra.device.mgt.core.application.mgt.common.DeviceTypes; -import io.entgra.device.mgt.core.application.mgt.common.ExecutionStatus; -import io.entgra.device.mgt.core.application.mgt.common.SubAction; -import io.entgra.device.mgt.core.application.mgt.common.SubscriptionType; -import io.entgra.device.mgt.core.application.mgt.common.SubscribingDeviceIdHolder; -import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationDTO; -import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationPolicyDTO; -import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationReleaseDTO; -import io.entgra.device.mgt.core.application.mgt.common.dto.DeviceSubscriptionDTO; -import io.entgra.device.mgt.core.application.mgt.common.dto.ScheduledSubscriptionDTO; -import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationManagementException; -import io.entgra.device.mgt.core.application.mgt.common.exception.DBConnectionException; -import io.entgra.device.mgt.core.application.mgt.common.exception.LifecycleManagementException; -import io.entgra.device.mgt.core.application.mgt.common.exception.SubscriptionManagementException; -import io.entgra.device.mgt.core.application.mgt.common.exception.TransactionManagementException; +import io.entgra.device.mgt.core.application.mgt.common.*; +import io.entgra.device.mgt.core.application.mgt.common.dto.*; +import io.entgra.device.mgt.core.application.mgt.common.exception.*; import io.entgra.device.mgt.core.application.mgt.common.response.Application; import io.entgra.device.mgt.core.application.mgt.common.services.SubscriptionManager; import io.entgra.device.mgt.core.application.mgt.core.dao.ApplicationDAO; import io.entgra.device.mgt.core.application.mgt.core.dao.SubscriptionDAO; import io.entgra.device.mgt.core.application.mgt.core.dao.common.ApplicationManagementDAOFactory; import io.entgra.device.mgt.core.application.mgt.core.exception.ApplicationManagementDAOException; +import io.entgra.device.mgt.core.application.mgt.core.exception.BadRequestException; import io.entgra.device.mgt.core.application.mgt.core.exception.ForbiddenException; import io.entgra.device.mgt.core.application.mgt.core.exception.NotFoundException; import io.entgra.device.mgt.core.application.mgt.core.internal.DataHolder; import io.entgra.device.mgt.core.application.mgt.core.lifecycle.LifecycleStateManager; -import io.entgra.device.mgt.core.application.mgt.core.util.APIUtil; -import io.entgra.device.mgt.core.application.mgt.core.util.ConnectionManagerUtil; -import io.entgra.device.mgt.core.application.mgt.core.util.Constants; -import io.entgra.device.mgt.core.application.mgt.core.util.HelperUtil; -import io.entgra.device.mgt.core.application.mgt.core.util.OAuthUtils; +import io.entgra.device.mgt.core.application.mgt.core.util.*; +import io.entgra.device.mgt.core.device.mgt.common.MDMAppConstants; +import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; +import io.entgra.device.mgt.core.device.mgt.common.PaginationResult; import io.entgra.device.mgt.core.device.mgt.common.*; import io.entgra.device.mgt.core.device.mgt.common.app.mgt.App; import io.entgra.device.mgt.core.device.mgt.common.app.mgt.MobileAppTypes; @@ -86,6 +58,17 @@ import io.entgra.device.mgt.core.device.mgt.core.util.MDMAndroidOperationUtil; import io.entgra.device.mgt.core.device.mgt.core.util.MDMIOSOperationUtil; import io.entgra.device.mgt.core.device.mgt.core.util.MDMWindowsOperationUtil; import io.entgra.device.mgt.core.identity.jwt.client.extension.dto.AccessTokenInfo; +import org.apache.commons.httpclient.HttpClient; +import org.apache.commons.httpclient.HttpException; +import org.apache.commons.httpclient.HttpMethodBase; +import org.apache.commons.httpclient.methods.PostMethod; +import org.apache.commons.httpclient.methods.StringRequestEntity; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.json.JSONArray; +import org.json.JSONObject; +import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.user.api.UserStoreException; import javax.ws.rs.core.MediaType; @@ -96,14 +79,7 @@ import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Set; +import java.util.*; import java.util.concurrent.atomic.AtomicBoolean; import java.util.stream.Collectors; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/internal/ApplicationManagementServiceComponent.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/internal/ApplicationManagementServiceComponent.java index d15ae1eb5d..91ea87f66f 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/internal/ApplicationManagementServiceComponent.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/internal/ApplicationManagementServiceComponent.java @@ -17,65 +17,38 @@ */ package io.entgra.device.mgt.core.application.mgt.core.internal; -import io.entgra.device.mgt.core.application.mgt.common.services.SPApplicationManager; -import io.entgra.device.mgt.core.application.mgt.core.impl.AppmDataHandlerImpl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.osgi.framework.BundleContext; -import org.osgi.service.component.ComponentContext; import io.entgra.device.mgt.core.application.mgt.common.config.LifecycleState; -import io.entgra.device.mgt.core.application.mgt.common.services.ApplicationManager; -import io.entgra.device.mgt.core.application.mgt.common.services.ApplicationStorageManager; -import io.entgra.device.mgt.core.application.mgt.common.services.AppmDataHandler; -import io.entgra.device.mgt.core.application.mgt.common.services.ReviewManager; -import io.entgra.device.mgt.core.application.mgt.common.services.SubscriptionManager; +import io.entgra.device.mgt.core.application.mgt.common.services.*; import io.entgra.device.mgt.core.application.mgt.core.config.ConfigurationManager; import io.entgra.device.mgt.core.application.mgt.core.dao.common.ApplicationManagementDAOFactory; +import io.entgra.device.mgt.core.application.mgt.core.impl.AppmDataHandlerImpl; import io.entgra.device.mgt.core.application.mgt.core.lifecycle.LifecycleStateManager; import io.entgra.device.mgt.core.application.mgt.core.task.ScheduledAppSubscriptionTaskManager; import io.entgra.device.mgt.core.application.mgt.core.util.ApplicationManagementUtil; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.osgi.framework.BundleContext; +import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.*; import org.wso2.carbon.ndatasource.core.DataSourceService; import org.wso2.carbon.ntask.core.service.TaskService; import org.wso2.carbon.user.core.service.RealmService; import java.util.List; -/** - * @scr.component name="org.wso2.carbon.application.mgt.service" immediate="true" - * @scr.reference name="org.wso2.carbon.device.manager" - * interface="io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService" - * cardinality="1..1" - * policy="dynamic" - * bind="setDeviceManagementService" - * unbind="unsetDeviceManagementService" - * @scr.reference name="realm.service" - * immediate="true" - * interface="org.wso2.carbon.user.core.service.RealmService" - * cardinality="1..1" - * policy="dynamic" - * bind="setRealmService" - * unbind="unsetRealmService" - * @scr.reference name="datasource.service" - * interface="org.wso2.carbon.ndatasource.core.DataSourceService" - * cardinality="1..1" - * policy="dynamic" - * bind="setDataSourceService" - * unbind="unsetDataSourceService" - * @scr.reference name="app.mgt.ntask.component" - * interface="org.wso2.carbon.ntask.core.service.TaskService" - * cardinality="1..1" - * policy="dynamic" - * bind="setTaskService" - * unbind="unsetTaskService" - */ + @SuppressWarnings("unused") +@Component( + name = "io.entgra.device.mgt.core.application.mgt.core.internal.ApplicationManagementServiceComponent", + immediate = true) public class ApplicationManagementServiceComponent { private static Log log = LogFactory.getLog(ApplicationManagementServiceComponent.class); @SuppressWarnings("unused") + @Activate protected void activate(ComponentContext componentContext) { BundleContext bundleContext = componentContext.getBundleContext(); try { @@ -117,7 +90,7 @@ public class ApplicationManagementServiceComponent { bundleContext.registerService(AppmDataHandler.class.getName(), configManager, null); ScheduledAppSubscriptionTaskManager taskManager = new ScheduledAppSubscriptionTaskManager(); - taskManager.scheduleCleanupTask(); + // todo: taskManager.scheduleCleanupTask(); log.info("ApplicationManagement core bundle has been successfully initialized"); } catch (Throwable e) { @@ -126,11 +99,18 @@ public class ApplicationManagementServiceComponent { } @SuppressWarnings("unused") + @Deactivate protected void deactivate(ComponentContext componentContext) { //do nothing } @SuppressWarnings("unused") + @Reference( + name = "device.mgt.provider.service", + service = io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetDeviceManagementService") protected void setDeviceManagementService(DeviceManagementProviderService deviceManagementProviderService) { if (log.isDebugEnabled()) { log.debug("Setting ApplicationDTO Management OSGI Manager"); @@ -147,6 +127,12 @@ public class ApplicationManagementServiceComponent { } @SuppressWarnings("unused") + @Reference( + name = "realm.service", + service = org.wso2.carbon.user.core.service.RealmService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRealmService") protected void setRealmService(RealmService realmService) { DataHolder.getInstance().setRealmService(realmService); } @@ -157,6 +143,12 @@ public class ApplicationManagementServiceComponent { } @SuppressWarnings("unused") + @Reference( + name = "datasource.service", + service = org.wso2.carbon.ndatasource.core.DataSourceService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetDataSourceService") protected void setDataSourceService(DataSourceService dataSourceService) { /*Not implemented. Not needed but to make sure the datasource service are registered, as it is needed create databases. */ @@ -169,6 +161,12 @@ public class ApplicationManagementServiceComponent { } @SuppressWarnings("unused") + @Reference( + name = "task.service", + service = org.wso2.carbon.ntask.core.service.TaskService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetTaskService") public void setTaskService(TaskService taskService) { if (log.isDebugEnabled()) { log.debug("Setting the task service to Application Management SC."); diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/internal/DataHolder.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/internal/DataHolder.java index 6d5000a986..2484822e7c 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/internal/DataHolder.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/internal/DataHolder.java @@ -17,12 +17,7 @@ */ package io.entgra.device.mgt.core.application.mgt.core.internal; -import io.entgra.device.mgt.core.application.mgt.common.services.ApplicationManager; -import io.entgra.device.mgt.core.application.mgt.common.services.ApplicationStorageManager; -import io.entgra.device.mgt.core.application.mgt.common.services.AppmDataHandler; -import io.entgra.device.mgt.core.application.mgt.common.services.SPApplicationManager; -import io.entgra.device.mgt.core.application.mgt.common.services.ReviewManager; -import io.entgra.device.mgt.core.application.mgt.common.services.SubscriptionManager; +import io.entgra.device.mgt.core.application.mgt.common.services.*; import io.entgra.device.mgt.core.application.mgt.core.lifecycle.LifecycleStateManager; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; import org.wso2.carbon.ntask.core.service.TaskService; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/lifecycle/LifecycleStateManager.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/lifecycle/LifecycleStateManager.java index 5b69013f9c..8e087eb7f5 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/lifecycle/LifecycleStateManager.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/lifecycle/LifecycleStateManager.java @@ -18,14 +18,14 @@ package io.entgra.device.mgt.core.application.mgt.core.lifecycle; -import io.entgra.device.mgt.core.application.mgt.core.internal.DataHolder; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.application.mgt.common.exception.LifecycleManagementException; import io.entgra.device.mgt.core.application.mgt.common.config.LifecycleState; +import io.entgra.device.mgt.core.application.mgt.common.exception.LifecycleManagementException; +import io.entgra.device.mgt.core.application.mgt.core.internal.DataHolder; import io.entgra.device.mgt.core.device.mgt.common.permission.mgt.PermissionManagementException; import io.entgra.device.mgt.core.device.mgt.core.permission.mgt.PermissionUtils; import io.entgra.device.mgt.core.device.mgt.core.search.mgt.Constants; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.wso2.carbon.user.api.UserRealm; import org.wso2.carbon.user.api.UserStoreException; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/serviceprovider/impl/WSO2IAMSPApplicationService.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/serviceprovider/impl/WSO2IAMSPApplicationService.java index 88b8ba803d..8858ff921e 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/serviceprovider/impl/WSO2IAMSPApplicationService.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/serviceprovider/impl/WSO2IAMSPApplicationService.java @@ -26,6 +26,7 @@ import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationMan import io.entgra.device.mgt.core.application.mgt.common.exception.IdentityServerManagementException; import io.entgra.device.mgt.core.application.mgt.core.serviceprovider.ISServiceProviderApplicationService; import io.entgra.device.mgt.core.application.mgt.core.util.Constants; +import io.entgra.device.mgt.core.device.mgt.core.common.util.HttpUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.HttpResponse; @@ -35,7 +36,7 @@ import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpRequestBase; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; -import io.entgra.device.mgt.core.device.mgt.core.common.util.HttpUtil; + import javax.ws.rs.core.HttpHeaders; import java.io.IOException; import java.util.Collections; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/task/ScheduledAppSubscriptionCleanupTask.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/task/ScheduledAppSubscriptionCleanupTask.java index e1ffb3418b..861d1396ad 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/task/ScheduledAppSubscriptionCleanupTask.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/task/ScheduledAppSubscriptionCleanupTask.java @@ -18,12 +18,12 @@ package io.entgra.device.mgt.core.application.mgt.core.task; -import io.entgra.device.mgt.core.application.mgt.core.impl.SubscriptionManagerImpl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.application.mgt.common.exception.SubscriptionManagementException; import io.entgra.device.mgt.core.application.mgt.common.services.SubscriptionManager; +import io.entgra.device.mgt.core.application.mgt.core.impl.SubscriptionManagerImpl; import io.entgra.device.mgt.core.device.mgt.core.task.impl.RandomlyAssignedScheduleTask; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.util.Map; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/task/ScheduledAppSubscriptionTask.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/task/ScheduledAppSubscriptionTask.java index 0a1275b495..69f956e638 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/task/ScheduledAppSubscriptionTask.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/task/ScheduledAppSubscriptionTask.java @@ -20,20 +20,20 @@ package io.entgra.device.mgt.core.application.mgt.core.task; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; -import io.entgra.device.mgt.core.application.mgt.core.impl.SubscriptionManagerImpl; -import io.entgra.device.mgt.core.application.mgt.core.util.Constants; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.application.mgt.common.ExecutionStatus; import io.entgra.device.mgt.core.application.mgt.common.SubscriptionType; import io.entgra.device.mgt.core.application.mgt.common.dto.ScheduledSubscriptionDTO; import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationManagementException; import io.entgra.device.mgt.core.application.mgt.common.exception.SubscriptionManagementException; import io.entgra.device.mgt.core.application.mgt.common.services.SubscriptionManager; +import io.entgra.device.mgt.core.application.mgt.core.impl.SubscriptionManagerImpl; +import io.entgra.device.mgt.core.application.mgt.core.util.Constants; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.core.task.impl.RandomlyAssignedScheduleTask; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.PrivilegedCarbonContext; import java.util.List; import java.util.Map; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/task/ScheduledAppSubscriptionTaskManager.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/task/ScheduledAppSubscriptionTaskManager.java index 2064e1195d..15ddee9618 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/task/ScheduledAppSubscriptionTaskManager.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/task/ScheduledAppSubscriptionTaskManager.java @@ -19,6 +19,12 @@ package io.entgra.device.mgt.core.application.mgt.core.task; import com.google.gson.Gson; +import io.entgra.device.mgt.core.application.mgt.common.SubAction; +import io.entgra.device.mgt.core.application.mgt.common.SubscriptionType; +import io.entgra.device.mgt.core.application.mgt.common.dto.ScheduledSubscriptionDTO; +import io.entgra.device.mgt.core.application.mgt.common.exception.SubscriptionManagementException; +import io.entgra.device.mgt.core.application.mgt.common.services.SubscriptionManager; +import io.entgra.device.mgt.core.application.mgt.core.exception.ApplicationOperationTaskException; import io.entgra.device.mgt.core.application.mgt.core.impl.SubscriptionManagerImpl; import io.entgra.device.mgt.core.application.mgt.core.internal.DataHolder; import io.entgra.device.mgt.core.application.mgt.core.util.Constants; @@ -27,24 +33,12 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.quartz.CronExpression; import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.application.mgt.common.SubAction; -import io.entgra.device.mgt.core.application.mgt.common.SubscriptionType; -import io.entgra.device.mgt.core.application.mgt.common.dto.ScheduledSubscriptionDTO; -import io.entgra.device.mgt.core.application.mgt.common.exception.SubscriptionManagementException; -import io.entgra.device.mgt.core.application.mgt.common.services.SubscriptionManager; -import io.entgra.device.mgt.core.application.mgt.core.exception.ApplicationOperationTaskException; import org.wso2.carbon.ntask.common.TaskException; import org.wso2.carbon.ntask.core.TaskInfo; import org.wso2.carbon.ntask.core.TaskManager; import org.wso2.carbon.ntask.core.service.TaskService; -import java.util.Calendar; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Properties; +import java.util.*; import java.util.stream.Collectors; public class ScheduledAppSubscriptionTaskManager { diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/APIUtil.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/APIUtil.java index 95f402e9cf..4b78b9e1c2 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/APIUtil.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/APIUtil.java @@ -18,40 +18,33 @@ package io.entgra.device.mgt.core.application.mgt.core.util; -import io.entgra.device.mgt.core.application.mgt.common.IdentityServerResponse; -import io.entgra.device.mgt.core.application.mgt.common.dto.IdentityServerDTO; -import io.entgra.device.mgt.core.application.mgt.common.dto.IdentityServiceProviderDTO; -import io.entgra.device.mgt.core.application.mgt.common.exception.InvalidConfigurationException; -import io.entgra.device.mgt.core.application.mgt.core.config.IdentityServiceProvider; -import io.entgra.device.mgt.core.application.mgt.core.serviceprovider.ISServiceProviderApplicationService; -import io.entgra.device.mgt.core.application.mgt.core.exception.BadRequestException; -import io.entgra.device.mgt.core.application.mgt.core.exception.UnexpectedServerErrorException; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.commons.validator.routines.UrlValidator; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.application.mgt.common.ApplicationType; +import io.entgra.device.mgt.core.application.mgt.common.ErrorResponse; +import io.entgra.device.mgt.core.application.mgt.common.IdentityServerResponse; import io.entgra.device.mgt.core.application.mgt.common.config.MDMConfig; import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationDTO; import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationReleaseDTO; +import io.entgra.device.mgt.core.application.mgt.common.dto.IdentityServerDTO; +import io.entgra.device.mgt.core.application.mgt.common.dto.IdentityServiceProviderDTO; import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationManagementException; +import io.entgra.device.mgt.core.application.mgt.common.exception.InvalidConfigurationException; import io.entgra.device.mgt.core.application.mgt.common.response.Application; import io.entgra.device.mgt.core.application.mgt.common.response.ApplicationRelease; import io.entgra.device.mgt.core.application.mgt.common.services.*; -import io.entgra.device.mgt.core.application.mgt.common.ErrorResponse; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.CustomAppReleaseWrapper; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.CustomAppWrapper; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.EntAppReleaseWrapper; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.ApplicationWrapper; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.PublicAppReleaseWrapper; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.PublicAppWrapper; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.WebAppReleaseWrapper; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.WebAppWrapper; +import io.entgra.device.mgt.core.application.mgt.common.wrapper.*; import io.entgra.device.mgt.core.application.mgt.core.config.ConfigurationManager; +import io.entgra.device.mgt.core.application.mgt.core.config.IdentityServiceProvider; +import io.entgra.device.mgt.core.application.mgt.core.exception.BadRequestException; +import io.entgra.device.mgt.core.application.mgt.core.exception.UnexpectedServerErrorException; import io.entgra.device.mgt.core.application.mgt.core.internal.DataHolder; +import io.entgra.device.mgt.core.application.mgt.core.serviceprovider.ISServiceProviderApplicationService; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.core.dto.DeviceType; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.commons.validator.routines.UrlValidator; +import org.wso2.carbon.context.PrivilegedCarbonContext; import javax.ws.rs.core.Response; import java.util.ArrayList; @@ -510,4 +503,18 @@ public class APIUtil { return mdmConfig.getArtifactDownloadProtocol() + "://" + host + ":" + port + artifactDownloadEndpoint + Constants.FORWARD_SLASH; } + + /** + * To create the application icon path. + * + * @param applicationReleaseDTO {@link ApplicationReleaseDTO} + * @param tenantId tenant ID + * @return iconPath constructed icon path. + */ + public static String createAppIconPath(ApplicationReleaseDTO applicationReleaseDTO, int tenantId) throws ApplicationManagementException { + String basePath = getArtifactDownloadBaseURL() + tenantId + Constants.FORWARD_SLASH + applicationReleaseDTO + .getAppHashValue() + Constants.FORWARD_SLASH; + String iconPath = basePath + Constants.ICON_ARTIFACT + Constants.FORWARD_SLASH + applicationReleaseDTO.getIconName(); + return iconPath; + } } diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ApplicationManagementUtil.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ApplicationManagementUtil.java index 55bf0b1a72..4800743abc 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ApplicationManagementUtil.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ApplicationManagementUtil.java @@ -18,40 +18,25 @@ package io.entgra.device.mgt.core.application.mgt.core.util; import io.entgra.device.mgt.core.application.mgt.common.ApplicationArtifact; -import io.entgra.device.mgt.core.application.mgt.core.config.ConfigurationManager; -import io.entgra.device.mgt.core.application.mgt.core.config.Extension; -import io.entgra.device.mgt.core.application.mgt.core.exception.BadRequestException; -import io.entgra.device.mgt.core.device.mgt.common.Base64File; import io.entgra.device.mgt.core.application.mgt.common.FileDataHolder; import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationDTO; import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationManagementException; -import io.entgra.device.mgt.core.application.mgt.common.exception.RequestValidatingException; -import io.entgra.device.mgt.core.application.mgt.common.services.SPApplicationManager; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.ApplicationWrapper; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.CustomAppReleaseWrapper; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.CustomAppWrapper; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.EntAppReleaseWrapper; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.PublicAppReleaseWrapper; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.PublicAppWrapper; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.WebAppReleaseWrapper; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.WebAppWrapper; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.application.mgt.common.exception.InvalidConfigurationException; -import io.entgra.device.mgt.core.application.mgt.common.services.ApplicationManager; -import io.entgra.device.mgt.core.application.mgt.common.services.ApplicationStorageManager; -import io.entgra.device.mgt.core.application.mgt.common.services.ReviewManager; -import io.entgra.device.mgt.core.application.mgt.common.services.SubscriptionManager; +import io.entgra.device.mgt.core.application.mgt.common.exception.RequestValidatingException; +import io.entgra.device.mgt.core.application.mgt.common.services.*; +import io.entgra.device.mgt.core.application.mgt.common.wrapper.*; +import io.entgra.device.mgt.core.application.mgt.core.config.ConfigurationManager; +import io.entgra.device.mgt.core.application.mgt.core.config.Extension; +import io.entgra.device.mgt.core.application.mgt.core.exception.BadRequestException; import io.entgra.device.mgt.core.application.mgt.core.lifecycle.LifecycleStateManager; +import io.entgra.device.mgt.core.device.mgt.common.Base64File; import io.entgra.device.mgt.core.device.mgt.core.common.util.FileUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.io.InputStream; import java.lang.reflect.Constructor; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.TreeMap; +import java.util.*; /** * This DAOUtil class is responsible for making sure single instance of each Extension Manager is used throughout for diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ApplicationMgtDatabaseCreator.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ApplicationMgtDatabaseCreator.java index 7114a1cfef..bea6f41519 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ApplicationMgtDatabaseCreator.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ApplicationMgtDatabaseCreator.java @@ -22,6 +22,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.utils.CarbonUtils; import org.wso2.carbon.utils.dbcreator.DatabaseCreator; + import java.io.File; /** diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ArtifactsParser.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ArtifactsParser.java index 7062a01c1d..16d7d530ba 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ArtifactsParser.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ArtifactsParser.java @@ -22,20 +22,14 @@ import com.dd.plist.BinaryPropertyListParser; import com.dd.plist.NSDictionary; import com.dd.plist.PropertyListFormatException; import com.dd.plist.PropertyListParser; +import io.entgra.device.mgt.core.application.mgt.core.exception.ParsingException; import net.dongliu.apk.parser.ApkFile; import net.dongliu.apk.parser.bean.ApkMeta; +import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.commons.io.IOUtils; -import io.entgra.device.mgt.core.application.mgt.core.exception.ParsingException; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; +import java.io.*; import java.nio.file.Files; import java.util.UUID; import java.util.zip.ZipEntry; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ConnectionManagerUtil.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ConnectionManagerUtil.java index 2d917eb42f..cddf207090 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ConnectionManagerUtil.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/ConnectionManagerUtil.java @@ -17,16 +17,16 @@ */ package io.entgra.device.mgt.core.application.mgt.core.util; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.application.mgt.common.exception.DBConnectionException; import io.entgra.device.mgt.core.application.mgt.common.exception.IllegalTransactionStateException; import io.entgra.device.mgt.core.application.mgt.common.exception.TransactionManagementException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; -import java.sql.Connection; -import java.sql.SQLException; import javax.naming.InitialContext; import javax.sql.DataSource; +import java.sql.Connection; +import java.sql.SQLException; /** * ConnectionManagerUtil is responsible for handling all the datasource connections utilities. diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/DAOUtil.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/DAOUtil.java index 1960230759..4f624f60c8 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/DAOUtil.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/DAOUtil.java @@ -19,20 +19,14 @@ package io.entgra.device.mgt.core.application.mgt.core.util; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; -import io.entgra.device.mgt.core.application.mgt.common.dto.IdentityServerDTO; +import io.entgra.device.mgt.core.application.mgt.common.ExecutionStatus; +import io.entgra.device.mgt.core.application.mgt.common.SubscriptionType; +import io.entgra.device.mgt.core.application.mgt.common.dto.*; import io.entgra.device.mgt.core.application.mgt.core.exception.UnexpectedServerErrorException; +import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.json.JSONException; -import io.entgra.device.mgt.core.application.mgt.common.ExecutionStatus; -import io.entgra.device.mgt.core.application.mgt.common.SubscriptionType; -import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationDTO; - -import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationReleaseDTO; -import io.entgra.device.mgt.core.application.mgt.common.dto.DeviceSubscriptionDTO; -import io.entgra.device.mgt.core.application.mgt.common.dto.ReviewDTO; -import io.entgra.device.mgt.core.application.mgt.common.dto.ScheduledSubscriptionDTO; -import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import java.sql.PreparedStatement; import java.sql.ResultSet; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/HelperUtil.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/HelperUtil.java index d97d8df307..38c939ab34 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/HelperUtil.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/HelperUtil.java @@ -17,11 +17,11 @@ */ package io.entgra.device.mgt.core.application.mgt.core.util; +import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; +import io.entgra.device.mgt.core.device.mgt.core.service.GroupManagementProviderService; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; -import io.entgra.device.mgt.core.device.mgt.core.service.GroupManagementProviderService; /** * Utility methods used in the Application Management. diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/OAuthUtils.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/OAuthUtils.java index 87b04db75a..272a5b45b0 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/OAuthUtils.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/OAuthUtils.java @@ -18,17 +18,17 @@ package io.entgra.device.mgt.core.application.mgt.core.util; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.apimgt.application.extension.APIManagementProviderService; import io.entgra.device.mgt.core.apimgt.application.extension.dto.ApiApplicationKey; import io.entgra.device.mgt.core.apimgt.application.extension.exception.APIManagerException; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.application.mgt.common.dto.ApiRegistrationProfile; import io.entgra.device.mgt.core.identity.jwt.client.extension.JWTClient; import io.entgra.device.mgt.core.identity.jwt.client.extension.dto.AccessTokenInfo; import io.entgra.device.mgt.core.identity.jwt.client.extension.exception.JWTClientException; import io.entgra.device.mgt.core.identity.jwt.client.extension.service.JWTClientManagerService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.utils.multitenancy.MultitenantConstants; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/ArtifactParserTest.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/ArtifactParserTest.java index c067e42775..f21f26f97e 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/ArtifactParserTest.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/ArtifactParserTest.java @@ -19,11 +19,11 @@ package io.entgra.device.mgt.core.application.mgt.core; import com.dd.plist.NSDictionary; +import io.entgra.device.mgt.core.application.mgt.core.exception.ParsingException; +import io.entgra.device.mgt.core.application.mgt.core.util.ArtifactsParser; import net.dongliu.apk.parser.bean.ApkMeta; import org.testng.Assert; import org.testng.annotations.Test; -import io.entgra.device.mgt.core.application.mgt.core.exception.ParsingException; -import io.entgra.device.mgt.core.application.mgt.core.util.ArtifactsParser; import java.io.FileInputStream; import java.io.FileNotFoundException; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/BaseTestCase.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/BaseTestCase.java index 9243cb8930..2984525a4f 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/BaseTestCase.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/BaseTestCase.java @@ -17,13 +17,6 @@ */ package io.entgra.device.mgt.core.application.mgt.core; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.tomcat.jdbc.pool.PoolProperties; -import org.testng.annotations.BeforeSuite; -import org.w3c.dom.Document; -import org.wso2.carbon.base.MultitenantConstants; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.application.mgt.common.config.LifecycleState; import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationManagementException; import io.entgra.device.mgt.core.application.mgt.core.common.DataSourceConfig; @@ -37,6 +30,13 @@ import io.entgra.device.mgt.core.device.mgt.core.config.DeviceConfigurationManag import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHolder; import io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.dao.MetadataManagementDAOFactory; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.tomcat.jdbc.pool.PoolProperties; +import org.testng.annotations.BeforeSuite; +import org.w3c.dom.Document; +import org.wso2.carbon.base.MultitenantConstants; +import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.registry.core.config.RegistryContext; import org.wso2.carbon.registry.core.exceptions.RegistryException; import org.wso2.carbon.registry.core.internal.RegistryDataHolder; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/ConfigurationTest.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/ConfigurationTest.java index 096a36382e..9afe01cb89 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/ConfigurationTest.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/ConfigurationTest.java @@ -17,11 +17,11 @@ */ package io.entgra.device.mgt.core.application.mgt.core; -import org.junit.Assert; -import org.testng.annotations.Test; +import io.entgra.device.mgt.core.application.mgt.common.config.LifecycleState; import io.entgra.device.mgt.core.application.mgt.core.config.Configuration; import io.entgra.device.mgt.core.application.mgt.core.config.ConfigurationManager; -import io.entgra.device.mgt.core.application.mgt.common.config.LifecycleState; +import org.junit.Assert; +import org.testng.annotations.Test; import java.util.List; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/InitTest.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/InitTest.java index b4ec9f3b9d..0674369256 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/InitTest.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/InitTest.java @@ -17,9 +17,9 @@ */ package io.entgra.device.mgt.core.application.mgt.core; -import org.testng.annotations.BeforeSuite; import io.entgra.device.mgt.core.application.mgt.common.exception.InvalidConfigurationException; import io.entgra.device.mgt.core.application.mgt.core.config.ConfigurationManager; +import org.testng.annotations.BeforeSuite; import java.io.File; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/LifeCycleStateManagerTest.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/LifeCycleStateManagerTest.java index 8f2a48f7bd..96dd59ecd3 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/LifeCycleStateManagerTest.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/LifeCycleStateManagerTest.java @@ -17,8 +17,8 @@ */ package io.entgra.device.mgt.core.application.mgt.core; -import io.entgra.device.mgt.core.application.mgt.core.lifecycle.LifecycleStateManager; import io.entgra.device.mgt.core.application.mgt.common.config.LifecycleState; +import io.entgra.device.mgt.core.application.mgt.core.lifecycle.LifecycleStateManager; import java.util.HashMap; import java.util.List; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/LifecycleManagementTest.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/LifecycleManagementTest.java index 605c446491..ef8bc7b3d9 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/LifecycleManagementTest.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/LifecycleManagementTest.java @@ -17,14 +17,14 @@ */ package io.entgra.device.mgt.core.application.mgt.core; -import org.junit.Assert; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; +import io.entgra.device.mgt.core.application.mgt.common.config.LifecycleState; import io.entgra.device.mgt.core.application.mgt.common.exception.LifecycleManagementException; import io.entgra.device.mgt.core.application.mgt.core.config.Configuration; import io.entgra.device.mgt.core.application.mgt.core.config.ConfigurationManager; import io.entgra.device.mgt.core.application.mgt.core.lifecycle.LifecycleStateManager; -import io.entgra.device.mgt.core.application.mgt.common.config.LifecycleState; +import org.junit.Assert; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; import java.util.List; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/StorageManagementUtilTest.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/StorageManagementUtilTest.java index eb26d08551..3448f67ed3 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/StorageManagementUtilTest.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/StorageManagementUtilTest.java @@ -18,13 +18,13 @@ package io.entgra.device.mgt.core.application.mgt.core; +import io.entgra.device.mgt.core.application.mgt.common.exception.ResourceManagementException; +import io.entgra.device.mgt.core.device.mgt.core.common.exception.StorageManagementException; +import io.entgra.device.mgt.core.device.mgt.core.common.util.StorageManagementUtil; import org.junit.Assert; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; -import io.entgra.device.mgt.core.application.mgt.common.exception.ResourceManagementException; -import io.entgra.device.mgt.core.device.mgt.core.common.exception.StorageManagementException; -import io.entgra.device.mgt.core.device.mgt.core.common.util.StorageManagementUtil; import java.io.File; import java.io.FileInputStream; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/dao/ApplicationManagementDAOTest.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/dao/ApplicationManagementDAOTest.java index 3712b8cd27..322d9484ee 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/dao/ApplicationManagementDAOTest.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/dao/ApplicationManagementDAOTest.java @@ -17,11 +17,6 @@ */ package io.entgra.device.mgt.core.application.mgt.core.dao; -import junit.framework.Assert; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; import io.entgra.device.mgt.core.application.mgt.core.BaseTestCase; import io.entgra.device.mgt.core.application.mgt.core.config.ConfigurationManager; import io.entgra.device.mgt.core.application.mgt.core.dao.common.ApplicationManagementDAOFactory; @@ -32,6 +27,11 @@ import io.entgra.device.mgt.core.device.mgt.common.exceptions.TransactionManagem import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOException; import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceTypeDAO; +import junit.framework.Assert; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; public class ApplicationManagementDAOTest extends BaseTestCase { diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/management/ApplicationManagementTest.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/management/ApplicationManagementTest.java index 9eac36785e..2ce7f47775 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/management/ApplicationManagementTest.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/test/java/io/entgra/device/mgt/core/application/mgt/core/management/ApplicationManagementTest.java @@ -21,11 +21,6 @@ import io.entgra.device.mgt.core.application.mgt.common.ApplicationArtifact; import io.entgra.device.mgt.core.application.mgt.common.ApplicationList; import io.entgra.device.mgt.core.application.mgt.common.Filter; import io.entgra.device.mgt.core.application.mgt.common.LifecycleState; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.cxf.jaxrs.ext.multipart.Attachment; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationDTO; import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationManagementException; import io.entgra.device.mgt.core.application.mgt.common.exception.RequestValidatingException; @@ -34,9 +29,9 @@ import io.entgra.device.mgt.core.application.mgt.common.response.ApplicationRele import io.entgra.device.mgt.core.application.mgt.common.response.Category; import io.entgra.device.mgt.core.application.mgt.common.response.Tag; import io.entgra.device.mgt.core.application.mgt.common.services.ApplicationManager; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.EntAppReleaseWrapper; import io.entgra.device.mgt.core.application.mgt.common.wrapper.ApplicationUpdateWrapper; import io.entgra.device.mgt.core.application.mgt.common.wrapper.ApplicationWrapper; +import io.entgra.device.mgt.core.application.mgt.common.wrapper.EntAppReleaseWrapper; import io.entgra.device.mgt.core.application.mgt.core.BaseTestCase; import io.entgra.device.mgt.core.application.mgt.core.dao.ApplicationDAO; import io.entgra.device.mgt.core.application.mgt.core.dao.common.ApplicationManagementDAOFactory; @@ -44,12 +39,17 @@ import io.entgra.device.mgt.core.application.mgt.core.dto.ApplicationsDTO; import io.entgra.device.mgt.core.application.mgt.core.impl.ApplicationManagerImpl; import io.entgra.device.mgt.core.application.mgt.core.internal.DataHolder; import io.entgra.device.mgt.core.application.mgt.core.util.ConnectionManagerUtil; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.common.Base64File; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.core.common.util.FileUtil; import io.entgra.device.mgt.core.device.mgt.core.dto.DeviceType; import io.entgra.device.mgt.core.device.mgt.core.dto.DeviceTypeVersion; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderServiceImpl; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.cxf.jaxrs.ext.multipart.Attachment; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; import java.io.File; import java.util.ArrayList; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.publisher.api/pom.xml b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.publisher.api/pom.xml index 8705b76bc3..47bf5b79b2 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.publisher.api/pom.xml +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.publisher.api/pom.xml @@ -140,7 +140,6 @@ org.ops4j.pax.logging pax-logging-api provided - org.json.wso2 diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.publisher.api/src/main/java/io/entgra/device/mgt/core/application/mgt/publisher/api/ApplicationManagementPublisherAPI.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.publisher.api/src/main/java/io/entgra/device/mgt/core/application/mgt/publisher/api/ApplicationManagementPublisherAPI.java index 1679cadc47..a308359b0d 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.publisher.api/src/main/java/io/entgra/device/mgt/core/application/mgt/publisher/api/ApplicationManagementPublisherAPI.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.publisher.api/src/main/java/io/entgra/device/mgt/core/application/mgt/publisher/api/ApplicationManagementPublisherAPI.java @@ -17,17 +17,6 @@ */ package io.entgra.device.mgt.core.application.mgt.publisher.api; -import io.entgra.device.mgt.core.device.mgt.common.Base64File; -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.SwaggerDefinition; -import io.swagger.annotations.Tag; import io.entgra.device.mgt.core.apimgt.annotations.Scope; import io.entgra.device.mgt.core.apimgt.annotations.Scopes; import io.entgra.device.mgt.core.application.mgt.common.ApplicationList; @@ -37,29 +26,15 @@ import io.entgra.device.mgt.core.application.mgt.common.LifecycleChanger; import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationDTO; import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationReleaseDTO; import io.entgra.device.mgt.core.application.mgt.common.response.ApplicationRelease; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.CustomAppReleaseWrapper; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.CustomAppWrapper; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.EntAppReleaseWrapper; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.ApplicationUpdateWrapper; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.ApplicationWrapper; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.PublicAppReleaseWrapper; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.PublicAppWrapper; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.WebAppReleaseWrapper; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.WebAppWrapper; +import io.entgra.device.mgt.core.application.mgt.common.wrapper.*; +import io.entgra.device.mgt.core.device.mgt.common.Base64File; +import io.swagger.annotations.*; -import java.util.List; import javax.validation.Valid; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +import java.util.List; /** * APIs to handle application management related tasks. diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.publisher.api/src/main/java/io/entgra/device/mgt/core/application/mgt/publisher/api/SPApplicationService.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.publisher.api/src/main/java/io/entgra/device/mgt/core/application/mgt/publisher/api/SPApplicationService.java index 2750362a61..2ec172dbd1 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.publisher.api/src/main/java/io/entgra/device/mgt/core/application/mgt/publisher/api/SPApplicationService.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.publisher.api/src/main/java/io/entgra/device/mgt/core/application/mgt/publisher/api/SPApplicationService.java @@ -18,30 +18,16 @@ package io.entgra.device.mgt.core.application.mgt.publisher.api; +import io.entgra.device.mgt.core.apimgt.annotations.Scope; +import io.entgra.device.mgt.core.apimgt.annotations.Scopes; import io.entgra.device.mgt.core.application.mgt.common.dto.IdentityServerDTO; import io.entgra.device.mgt.core.application.mgt.common.wrapper.ApplicationWrapper; import io.entgra.device.mgt.core.application.mgt.common.wrapper.CustomAppWrapper; import io.entgra.device.mgt.core.application.mgt.common.wrapper.PublicAppWrapper; import io.entgra.device.mgt.core.application.mgt.common.wrapper.WebAppWrapper; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.Extension; -import io.swagger.annotations.ExtensionProperty; -import io.swagger.annotations.Info; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Tag; -import io.entgra.device.mgt.core.apimgt.annotations.Scope; -import io.entgra.device.mgt.core.apimgt.annotations.Scopes; +import io.swagger.annotations.*; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.util.List; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.publisher.api/src/main/java/io/entgra/device/mgt/core/application/mgt/publisher/api/admin/ApplicationManagementPublisherAdminAPI.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.publisher.api/src/main/java/io/entgra/device/mgt/core/application/mgt/publisher/api/admin/ApplicationManagementPublisherAdminAPI.java index 63b3b4c9ee..91e17bef71 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.publisher.api/src/main/java/io/entgra/device/mgt/core/application/mgt/publisher/api/admin/ApplicationManagementPublisherAdminAPI.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.publisher.api/src/main/java/io/entgra/device/mgt/core/application/mgt/publisher/api/admin/ApplicationManagementPublisherAdminAPI.java @@ -17,29 +17,13 @@ */ package io.entgra.device.mgt.core.application.mgt.publisher.api.admin; -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.SwaggerDefinition; -import io.swagger.annotations.Tag; import io.entgra.device.mgt.core.apimgt.annotations.Scope; import io.entgra.device.mgt.core.apimgt.annotations.Scopes; import io.entgra.device.mgt.core.application.mgt.common.ApplicationList; import io.entgra.device.mgt.core.application.mgt.common.ErrorResponse; +import io.swagger.annotations.*; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.util.List; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.publisher.api/src/main/java/io/entgra/device/mgt/core/application/mgt/publisher/api/admin/ReviewManagementPublisherAdminAPI.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.publisher.api/src/main/java/io/entgra/device/mgt/core/application/mgt/publisher/api/admin/ReviewManagementPublisherAdminAPI.java index 1938e32cb2..e984ea9f5e 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.publisher.api/src/main/java/io/entgra/device/mgt/core/application/mgt/publisher/api/admin/ReviewManagementPublisherAdminAPI.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.publisher.api/src/main/java/io/entgra/device/mgt/core/application/mgt/publisher/api/admin/ReviewManagementPublisherAdminAPI.java @@ -17,26 +17,13 @@ */ package io.entgra.device.mgt.core.application.mgt.publisher.api.admin; -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.SwaggerDefinition; -import io.swagger.annotations.Tag; import io.entgra.device.mgt.core.apimgt.annotations.Scope; import io.entgra.device.mgt.core.apimgt.annotations.Scopes; import io.entgra.device.mgt.core.application.mgt.common.ErrorResponse; import io.entgra.device.mgt.core.application.mgt.common.PaginationResult; +import io.swagger.annotations.*; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.util.List; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.publisher.api/src/main/java/io/entgra/device/mgt/core/application/mgt/publisher/api/impl/ApplicationManagementPublisherAPIImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.publisher.api/src/main/java/io/entgra/device/mgt/core/application/mgt/publisher/api/impl/ApplicationManagementPublisherAPIImpl.java index 583d4de17c..606e66fd0a 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.publisher.api/src/main/java/io/entgra/device/mgt/core/application/mgt/publisher/api/impl/ApplicationManagementPublisherAPIImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.publisher.api/src/main/java/io/entgra/device/mgt/core/application/mgt/publisher/api/impl/ApplicationManagementPublisherAPIImpl.java @@ -17,54 +17,34 @@ */ package io.entgra.device.mgt.core.application.mgt.publisher.api.impl; -import io.entgra.device.mgt.core.application.mgt.common.ApplicationArtifact; -import io.entgra.device.mgt.core.application.mgt.common.ApplicationList; -import io.entgra.device.mgt.core.device.mgt.common.Base64File; -import io.entgra.device.mgt.core.application.mgt.common.Filter; -import io.entgra.device.mgt.core.application.mgt.common.LifecycleChanger; -import io.entgra.device.mgt.core.application.mgt.common.exception.ResourceManagementException; -import io.entgra.device.mgt.core.application.mgt.core.util.ApplicationManagementUtil; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.application.mgt.common.LifecycleState; +import io.entgra.device.mgt.core.application.mgt.common.*; +import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationManagementException; import io.entgra.device.mgt.core.application.mgt.common.exception.LifecycleManagementException; import io.entgra.device.mgt.core.application.mgt.common.exception.RequestValidatingException; +import io.entgra.device.mgt.core.application.mgt.common.exception.ResourceManagementException; import io.entgra.device.mgt.core.application.mgt.common.response.Application; import io.entgra.device.mgt.core.application.mgt.common.response.ApplicationRelease; import io.entgra.device.mgt.core.application.mgt.common.response.Category; import io.entgra.device.mgt.core.application.mgt.common.response.Tag; +import io.entgra.device.mgt.core.application.mgt.common.services.ApplicationManager; import io.entgra.device.mgt.core.application.mgt.common.services.AppmDataHandler; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.CustomAppReleaseWrapper; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.CustomAppWrapper; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.EntAppReleaseWrapper; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.ApplicationUpdateWrapper; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.ApplicationWrapper; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.PublicAppReleaseWrapper; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.PublicAppWrapper; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.WebAppReleaseWrapper; -import io.entgra.device.mgt.core.application.mgt.common.wrapper.WebAppWrapper; +import io.entgra.device.mgt.core.application.mgt.common.wrapper.*; import io.entgra.device.mgt.core.application.mgt.core.exception.BadRequestException; import io.entgra.device.mgt.core.application.mgt.core.exception.ForbiddenException; +import io.entgra.device.mgt.core.application.mgt.core.exception.NotFoundException; import io.entgra.device.mgt.core.application.mgt.core.exception.UnexpectedServerErrorException; import io.entgra.device.mgt.core.application.mgt.core.util.APIUtil; +import io.entgra.device.mgt.core.application.mgt.core.util.ApplicationManagementUtil; import io.entgra.device.mgt.core.application.mgt.publisher.api.ApplicationManagementPublisherAPI; -import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationManagementException; -import io.entgra.device.mgt.core.application.mgt.common.services.ApplicationManager; -import io.entgra.device.mgt.core.application.mgt.core.exception.NotFoundException; +import io.entgra.device.mgt.core.device.mgt.common.Base64File; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; -import java.util.List; import javax.validation.Valid; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +import java.util.List; /** * Implementation of Application Management related APIs. @@ -532,6 +512,8 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem log.error(msg); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); } + String oldPackageName = applicationManager.getApplicationByUuid(applicationUUID).getPackageName(); + applicationManager.updateAppIconInfo(applicationRelease, oldPackageName); return Response.status(Response.Status.OK).entity(applicationRelease).build(); } catch (BadRequestException e) { String msg = e.getMessage(); @@ -572,6 +554,8 @@ public class ApplicationManagementPublisherAPIImpl implements ApplicationManagem log.error(msg); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); } + String oldPackageName = applicationManager.getApplicationByUuid(applicationUUID).getPackageName(); + applicationManager.updateAppIconInfo(applicationRelease, oldPackageName); return Response.status(Response.Status.OK).entity(applicationRelease).build(); } catch (BadRequestException e) { String msg = e.getMessage(); diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.publisher.api/src/main/java/io/entgra/device/mgt/core/application/mgt/publisher/api/impl/SPApplicationServiceImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.publisher.api/src/main/java/io/entgra/device/mgt/core/application/mgt/publisher/api/impl/SPApplicationServiceImpl.java index 32bcbafe7a..a1f127080c 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.publisher.api/src/main/java/io/entgra/device/mgt/core/application/mgt/publisher/api/impl/SPApplicationServiceImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.publisher.api/src/main/java/io/entgra/device/mgt/core/application/mgt/publisher/api/impl/SPApplicationServiceImpl.java @@ -19,8 +19,8 @@ package io.entgra.device.mgt.core.application.mgt.publisher.api.impl; import io.entgra.device.mgt.core.application.mgt.common.IdentityServerResponse; -import io.entgra.device.mgt.core.application.mgt.common.dto.IdentityServerDTO; import io.entgra.device.mgt.core.application.mgt.common.SPApplicationListResponse; +import io.entgra.device.mgt.core.application.mgt.common.dto.IdentityServerDTO; import io.entgra.device.mgt.core.application.mgt.common.dto.IdentityServiceProviderDTO; import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationManagementException; import io.entgra.device.mgt.core.application.mgt.common.exception.RequestValidatingException; @@ -37,15 +37,7 @@ import io.entgra.device.mgt.core.application.mgt.publisher.api.SPApplicationServ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import javax.ws.rs.DELETE; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.util.List; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.publisher.api/src/main/java/io/entgra/device/mgt/core/application/mgt/publisher/api/impl/admin/ApplicationManagementPublisherAdminAPIImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.publisher.api/src/main/java/io/entgra/device/mgt/core/application/mgt/publisher/api/impl/admin/ApplicationManagementPublisherAdminAPIImpl.java index 61d2c064fb..c6df8587fb 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.publisher.api/src/main/java/io/entgra/device/mgt/core/application/mgt/publisher/api/impl/admin/ApplicationManagementPublisherAdminAPIImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.publisher.api/src/main/java/io/entgra/device/mgt/core/application/mgt/publisher/api/impl/admin/ApplicationManagementPublisherAdminAPIImpl.java @@ -17,8 +17,6 @@ */ package io.entgra.device.mgt.core.application.mgt.publisher.api.impl.admin; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationManagementException; import io.entgra.device.mgt.core.application.mgt.common.services.ApplicationManager; import io.entgra.device.mgt.core.application.mgt.core.exception.BadRequestException; @@ -26,15 +24,10 @@ import io.entgra.device.mgt.core.application.mgt.core.exception.ForbiddenExcepti import io.entgra.device.mgt.core.application.mgt.core.exception.NotFoundException; import io.entgra.device.mgt.core.application.mgt.core.util.APIUtil; import io.entgra.device.mgt.core.application.mgt.publisher.api.admin.ApplicationManagementPublisherAdminAPI; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.util.List; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.publisher.api/src/main/java/io/entgra/device/mgt/core/application/mgt/publisher/api/impl/admin/ReviewManagementPublisherAdminAPIImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.publisher.api/src/main/java/io/entgra/device/mgt/core/application/mgt/publisher/api/impl/admin/ReviewManagementPublisherAdminAPIImpl.java index 21f8935728..d35092e0dd 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.publisher.api/src/main/java/io/entgra/device/mgt/core/application/mgt/publisher/api/impl/admin/ReviewManagementPublisherAdminAPIImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.publisher.api/src/main/java/io/entgra/device/mgt/core/application/mgt/publisher/api/impl/admin/ReviewManagementPublisherAdminAPIImpl.java @@ -17,8 +17,6 @@ */ package io.entgra.device.mgt.core.application.mgt.publisher.api.impl.admin; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.application.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.application.mgt.common.PaginationResult; import io.entgra.device.mgt.core.application.mgt.common.Rating; @@ -28,12 +26,10 @@ import io.entgra.device.mgt.core.application.mgt.common.services.ReviewManager; import io.entgra.device.mgt.core.application.mgt.core.exception.NotFoundException; import io.entgra.device.mgt.core.application.mgt.core.util.APIUtil; import io.entgra.device.mgt.core.application.mgt.publisher.api.admin.ReviewManagementPublisherAdminAPI; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.QueryParam; +import javax.ws.rs.*; import javax.ws.rs.core.Response; /** diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/pom.xml b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/pom.xml index afc118f59f..d5e113727a 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/pom.xml +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/pom.xml @@ -140,7 +140,6 @@ org.ops4j.pax.logging pax-logging-api provided - org.json.wso2 diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/main/java/io/entgra/device/mgt/core/application/mgt/store/api/services/ApplicationManagementAPI.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/main/java/io/entgra/device/mgt/core/application/mgt/store/api/services/ApplicationManagementAPI.java index 32c2d6b43e..ad46cd70a3 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/main/java/io/entgra/device/mgt/core/application/mgt/store/api/services/ApplicationManagementAPI.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/main/java/io/entgra/device/mgt/core/application/mgt/store/api/services/ApplicationManagementAPI.java @@ -17,32 +17,16 @@ */ package io.entgra.device.mgt.core.application.mgt.store.api.services; -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.SwaggerDefinition; -import io.swagger.annotations.Tag; import io.entgra.device.mgt.core.apimgt.annotations.Scope; import io.entgra.device.mgt.core.apimgt.annotations.Scopes; +import io.entgra.device.mgt.core.application.mgt.common.ApplicationList; import io.entgra.device.mgt.core.application.mgt.common.ErrorResponse; import io.entgra.device.mgt.core.application.mgt.common.Filter; import io.entgra.device.mgt.core.application.mgt.common.dto.ApplicationDTO; -import io.entgra.device.mgt.core.application.mgt.common.ApplicationList; +import io.swagger.annotations.*; import javax.validation.Valid; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/main/java/io/entgra/device/mgt/core/application/mgt/store/api/services/ReviewManagementAPI.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/main/java/io/entgra/device/mgt/core/application/mgt/store/api/services/ReviewManagementAPI.java index 728acaab62..685871f738 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/main/java/io/entgra/device/mgt/core/application/mgt/store/api/services/ReviewManagementAPI.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/main/java/io/entgra/device/mgt/core/application/mgt/store/api/services/ReviewManagementAPI.java @@ -17,33 +17,16 @@ */ package io.entgra.device.mgt.core.application.mgt.store.api.services; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.Api; -import io.swagger.annotations.Info; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Extension; -import io.swagger.annotations.ExtensionProperty; -import io.swagger.annotations.Tag; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; import io.entgra.device.mgt.core.apimgt.annotations.Scope; import io.entgra.device.mgt.core.apimgt.annotations.Scopes; -import io.entgra.device.mgt.core.application.mgt.common.PaginationResult; import io.entgra.device.mgt.core.application.mgt.common.ErrorResponse; +import io.entgra.device.mgt.core.application.mgt.common.PaginationResult; import io.entgra.device.mgt.core.application.mgt.common.response.Review; import io.entgra.device.mgt.core.application.mgt.common.wrapper.ReviewWrapper; +import io.swagger.annotations.*; import javax.validation.Valid; -import javax.ws.rs.Path; -import javax.ws.rs.Consumes; -import javax.ws.rs.PUT; -import javax.ws.rs.GET; -import javax.ws.rs.PathParam; -import javax.ws.rs.QueryParam; -import javax.ws.rs.Produces; -import javax.ws.rs.POST; -import javax.ws.rs.DELETE; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.util.List; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/main/java/io/entgra/device/mgt/core/application/mgt/store/api/services/SubscriptionManagementAPI.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/main/java/io/entgra/device/mgt/core/application/mgt/store/api/services/SubscriptionManagementAPI.java index 32cc120fe9..0ff0e711c0 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/main/java/io/entgra/device/mgt/core/application/mgt/store/api/services/SubscriptionManagementAPI.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/main/java/io/entgra/device/mgt/core/application/mgt/store/api/services/SubscriptionManagementAPI.java @@ -17,30 +17,15 @@ */ package io.entgra.device.mgt.core.application.mgt.store.api.services; -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.SwaggerDefinition; -import io.swagger.annotations.Tag; import io.entgra.device.mgt.core.apimgt.annotations.Scope; import io.entgra.device.mgt.core.apimgt.annotations.Scopes; import io.entgra.device.mgt.core.application.mgt.common.ErrorResponse; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; +import io.swagger.annotations.*; import javax.validation.Valid; import javax.validation.constraints.Size; -import javax.ws.rs.Path; -import javax.ws.rs.Consumes; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.PathParam; -import javax.ws.rs.GET; -import javax.ws.rs.POST; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.util.List; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/main/java/io/entgra/device/mgt/core/application/mgt/store/api/services/admin/ReviewManagementStoreAdminAPI.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/main/java/io/entgra/device/mgt/core/application/mgt/store/api/services/admin/ReviewManagementStoreAdminAPI.java index 52825dc009..8a7840fb68 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/main/java/io/entgra/device/mgt/core/application/mgt/store/api/services/admin/ReviewManagementStoreAdminAPI.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/main/java/io/entgra/device/mgt/core/application/mgt/store/api/services/admin/ReviewManagementStoreAdminAPI.java @@ -17,25 +17,12 @@ */ package io.entgra.device.mgt.core.application.mgt.store.api.services.admin; -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.SwaggerDefinition; -import io.swagger.annotations.Tag; import io.entgra.device.mgt.core.apimgt.annotations.Scope; import io.entgra.device.mgt.core.apimgt.annotations.Scopes; import io.entgra.device.mgt.core.application.mgt.common.ErrorResponse; +import io.swagger.annotations.*; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/main/java/io/entgra/device/mgt/core/application/mgt/store/api/services/admin/SubscriptionManagementAdminAPI.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/main/java/io/entgra/device/mgt/core/application/mgt/store/api/services/admin/SubscriptionManagementAdminAPI.java index a59c209247..1fe7c0255e 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/main/java/io/entgra/device/mgt/core/application/mgt/store/api/services/admin/SubscriptionManagementAdminAPI.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/main/java/io/entgra/device/mgt/core/application/mgt/store/api/services/admin/SubscriptionManagementAdminAPI.java @@ -17,29 +17,14 @@ */ package io.entgra.device.mgt.core.application.mgt.store.api.services.admin; -import io.entgra.device.mgt.core.application.mgt.store.api.beans.SubscriptionStatusBean; -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.SwaggerDefinition; -import io.swagger.annotations.Tag; import io.entgra.device.mgt.core.apimgt.annotations.Scope; import io.entgra.device.mgt.core.apimgt.annotations.Scopes; import io.entgra.device.mgt.core.application.mgt.common.ErrorResponse; +import io.entgra.device.mgt.core.application.mgt.store.api.beans.SubscriptionStatusBean; +import io.swagger.annotations.*; import javax.validation.constraints.Size; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.util.List; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/main/java/io/entgra/device/mgt/core/application/mgt/store/api/services/impl/ApplicationManagementAPIImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/main/java/io/entgra/device/mgt/core/application/mgt/store/api/services/impl/ApplicationManagementAPIImpl.java index 34e2a041e3..9d9a6588dd 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/main/java/io/entgra/device/mgt/core/application/mgt/store/api/services/impl/ApplicationManagementAPIImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/main/java/io/entgra/device/mgt/core/application/mgt/store/api/services/impl/ApplicationManagementAPIImpl.java @@ -17,8 +17,6 @@ */ package io.entgra.device.mgt.core.application.mgt.store.api.services.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.application.mgt.common.ApplicationList; import io.entgra.device.mgt.core.application.mgt.common.Filter; import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationManagementException; @@ -29,14 +27,11 @@ import io.entgra.device.mgt.core.application.mgt.core.exception.NotFoundExceptio import io.entgra.device.mgt.core.application.mgt.core.exception.UnexpectedServerErrorException; import io.entgra.device.mgt.core.application.mgt.core.util.APIUtil; import io.entgra.device.mgt.core.application.mgt.store.api.services.ApplicationManagementAPI; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + import javax.validation.Valid; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/main/java/io/entgra/device/mgt/core/application/mgt/store/api/services/impl/ReviewManagementAPIImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/main/java/io/entgra/device/mgt/core/application/mgt/store/api/services/impl/ReviewManagementAPIImpl.java index d2a0f10913..0e338115c8 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/main/java/io/entgra/device/mgt/core/application/mgt/store/api/services/impl/ReviewManagementAPIImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/main/java/io/entgra/device/mgt/core/application/mgt/store/api/services/impl/ReviewManagementAPIImpl.java @@ -17,32 +17,24 @@ */ package io.entgra.device.mgt.core.application.mgt.store.api.services.impl; -import io.swagger.annotations.ApiParam; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import io.entgra.device.mgt.core.application.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.application.mgt.common.PaginationResult; import io.entgra.device.mgt.core.application.mgt.common.Rating; +import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationManagementException; +import io.entgra.device.mgt.core.application.mgt.common.exception.ReviewManagementException; import io.entgra.device.mgt.core.application.mgt.common.response.Review; import io.entgra.device.mgt.core.application.mgt.common.services.ReviewManager; import io.entgra.device.mgt.core.application.mgt.common.wrapper.ReviewWrapper; import io.entgra.device.mgt.core.application.mgt.core.exception.BadRequestException; import io.entgra.device.mgt.core.application.mgt.core.exception.ForbiddenException; import io.entgra.device.mgt.core.application.mgt.core.exception.NotFoundException; -import io.entgra.device.mgt.core.application.mgt.store.api.services.ReviewManagementAPI; -import io.entgra.device.mgt.core.application.mgt.common.PaginationRequest; -import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationManagementException; -import io.entgra.device.mgt.core.application.mgt.common.exception.ReviewManagementException; import io.entgra.device.mgt.core.application.mgt.core.util.APIUtil; +import io.entgra.device.mgt.core.application.mgt.store.api.services.ReviewManagementAPI; +import io.swagger.annotations.ApiParam; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.Path; -import javax.ws.rs.Consumes; -import javax.ws.rs.PathParam; -import javax.ws.rs.QueryParam; -import javax.ws.rs.PUT; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.DELETE; +import javax.ws.rs.*; import javax.ws.rs.core.Response; /** diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/main/java/io/entgra/device/mgt/core/application/mgt/store/api/services/impl/SubscriptionManagementAPIImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/main/java/io/entgra/device/mgt/core/application/mgt/store/api/services/impl/SubscriptionManagementAPIImpl.java index c68e1e47c9..6a12bffc52 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/main/java/io/entgra/device/mgt/core/application/mgt/store/api/services/impl/SubscriptionManagementAPIImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/main/java/io/entgra/device/mgt/core/application/mgt/store/api/services/impl/SubscriptionManagementAPIImpl.java @@ -18,43 +18,26 @@ package io.entgra.device.mgt.core.application.mgt.store.api.services.impl; -import io.entgra.device.mgt.core.application.mgt.store.api.services.impl.util.RequestValidationUtil; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.application.mgt.common.ApplicationInstallResponse; -import io.entgra.device.mgt.core.application.mgt.common.ErrorResponse; -import io.entgra.device.mgt.core.application.mgt.common.SubAction; -import io.entgra.device.mgt.core.application.mgt.common.SubscriptionType; +import io.entgra.device.mgt.core.application.mgt.common.*; import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationManagementException; import io.entgra.device.mgt.core.application.mgt.common.services.SubscriptionManager; import io.entgra.device.mgt.core.application.mgt.core.exception.ApplicationOperationTaskException; -import io.entgra.device.mgt.core.application.mgt.common.DeviceList; -import io.entgra.device.mgt.core.application.mgt.common.BasicUserInfo; -import io.entgra.device.mgt.core.application.mgt.common.BasicUserInfoList; -import io.entgra.device.mgt.core.application.mgt.common.RoleList; -import io.entgra.device.mgt.core.application.mgt.common.DeviceGroupList; import io.entgra.device.mgt.core.application.mgt.core.exception.BadRequestException; import io.entgra.device.mgt.core.application.mgt.core.exception.ForbiddenException; import io.entgra.device.mgt.core.application.mgt.core.exception.NotFoundException; import io.entgra.device.mgt.core.application.mgt.core.task.ScheduledAppSubscriptionTaskManager; import io.entgra.device.mgt.core.application.mgt.core.util.APIUtil; import io.entgra.device.mgt.core.application.mgt.store.api.services.SubscriptionManagementAPI; -import io.entgra.device.mgt.core.device.mgt.common.Device; -import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; -import io.entgra.device.mgt.core.device.mgt.common.MDMAppConstants; +import io.entgra.device.mgt.core.application.mgt.store.api.services.impl.util.RequestValidationUtil; import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.PaginationResult; +import io.entgra.device.mgt.core.device.mgt.common.*; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import javax.validation.Valid; -import javax.ws.rs.Path; -import javax.ws.rs.Consumes; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.PathParam; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.POST; +import javax.ws.rs.*; import javax.ws.rs.core.Response; import java.util.List; import java.util.Properties; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/main/java/io/entgra/device/mgt/core/application/mgt/store/api/services/impl/admin/ReviewManagementStoreAdminAPIImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/main/java/io/entgra/device/mgt/core/application/mgt/store/api/services/impl/admin/ReviewManagementStoreAdminAPIImpl.java index 44ced320b3..de625df362 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/main/java/io/entgra/device/mgt/core/application/mgt/store/api/services/impl/admin/ReviewManagementStoreAdminAPIImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/main/java/io/entgra/device/mgt/core/application/mgt/store/api/services/impl/admin/ReviewManagementStoreAdminAPIImpl.java @@ -17,20 +17,16 @@ */ package io.entgra.device.mgt.core.application.mgt.store.api.services.impl.admin; -import io.entgra.device.mgt.core.application.mgt.store.api.services.admin.ReviewManagementStoreAdminAPI; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationManagementException; import io.entgra.device.mgt.core.application.mgt.common.exception.ReviewManagementException; import io.entgra.device.mgt.core.application.mgt.common.services.ReviewManager; import io.entgra.device.mgt.core.application.mgt.core.exception.NotFoundException; import io.entgra.device.mgt.core.application.mgt.core.util.APIUtil; +import io.entgra.device.mgt.core.application.mgt.store.api.services.admin.ReviewManagementStoreAdminAPI; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/main/java/io/entgra/device/mgt/core/application/mgt/store/api/services/impl/admin/SubscriptionManagementAdminAPIImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/main/java/io/entgra/device/mgt/core/application/mgt/store/api/services/impl/admin/SubscriptionManagementAdminAPIImpl.java index 1fcb0cb390..e30bf4b0ce 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/main/java/io/entgra/device/mgt/core/application/mgt/store/api/services/impl/admin/SubscriptionManagementAdminAPIImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/main/java/io/entgra/device/mgt/core/application/mgt/store/api/services/impl/admin/SubscriptionManagementAdminAPIImpl.java @@ -18,29 +18,22 @@ package io.entgra.device.mgt.core.application.mgt.store.api.services.impl.admin; -import io.entgra.device.mgt.core.application.mgt.common.exception.SubscriptionManagementException; -import io.entgra.device.mgt.core.application.mgt.store.api.beans.SubscriptionStatusBean; -import io.entgra.device.mgt.core.application.mgt.store.api.services.admin.SubscriptionManagementAdminAPI; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationManagementException; +import io.entgra.device.mgt.core.application.mgt.common.exception.SubscriptionManagementException; import io.entgra.device.mgt.core.application.mgt.common.services.SubscriptionManager; import io.entgra.device.mgt.core.application.mgt.core.exception.BadRequestException; import io.entgra.device.mgt.core.application.mgt.core.exception.NotFoundException; import io.entgra.device.mgt.core.application.mgt.core.util.APIUtil; +import io.entgra.device.mgt.core.application.mgt.store.api.beans.SubscriptionStatusBean; +import io.entgra.device.mgt.core.application.mgt.store.api.services.admin.SubscriptionManagementAdminAPI; import io.entgra.device.mgt.core.application.mgt.store.api.services.impl.util.RequestValidationUtil; import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.PaginationResult; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; -import javax.ws.rs.Consumes; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.util.List; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/main/java/io/entgra/device/mgt/core/application/mgt/store/api/services/impl/util/RequestValidationUtil.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/main/java/io/entgra/device/mgt/core/application/mgt/store/api/services/impl/util/RequestValidationUtil.java index 37cfdbea8d..199f3b5593 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/main/java/io/entgra/device/mgt/core/application/mgt/store/api/services/impl/util/RequestValidationUtil.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/main/java/io/entgra/device/mgt/core/application/mgt/store/api/services/impl/util/RequestValidationUtil.java @@ -17,13 +17,13 @@ */ package io.entgra.device.mgt.core.application.mgt.store.api.services.impl.util; +import io.entgra.device.mgt.core.application.mgt.core.exception.BadRequestException; +import io.entgra.device.mgt.core.application.mgt.store.api.util.Constants; +import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.ActivityStatus; import org.apache.commons.lang3.EnumUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.application.mgt.core.exception.BadRequestException; -import io.entgra.device.mgt.core.application.mgt.store.api.util.Constants; -import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.ActivityStatus; import java.util.List; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/test/java/io/entgra/device/mgt/core/application/mgt/store/api/services/ReviewManagementAPITest.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/test/java/io/entgra/device/mgt/core/application/mgt/store/api/services/ReviewManagementAPITest.java index e2a60600cc..09964562b8 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/test/java/io/entgra/device/mgt/core/application/mgt/store/api/services/ReviewManagementAPITest.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.store.api/src/test/java/io/entgra/device/mgt/core/application/mgt/store/api/services/ReviewManagementAPITest.java @@ -17,6 +17,8 @@ */ package io.entgra.device.mgt.core.application.mgt.store.api.services; +import io.entgra.device.mgt.core.application.mgt.common.services.ReviewManager; +import io.entgra.device.mgt.core.application.mgt.core.util.APIUtil; import junit.framework.TestCase; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -24,8 +26,6 @@ import org.junit.Ignore; import org.powermock.core.classloader.annotations.PowerMockIgnore; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor; -import io.entgra.device.mgt.core.application.mgt.common.services.ReviewManager; -import io.entgra.device.mgt.core.application.mgt.core.util.APIUtil; @PowerMockIgnore("javax.ws.rs.*") @SuppressStaticInitializationFor({ diff --git a/components/application-mgt/pom.xml b/components/application-mgt/pom.xml index 5ef2626f40..a7c00b4e3a 100644 --- a/components/application-mgt/pom.xml +++ b/components/application-mgt/pom.xml @@ -31,7 +31,7 @@ pom WSO2 Carbon - Application Management Component WSO2 Carbon - Application Management Component - http://wso2.org + https://entgra.io io.entgra.device.mgt.core.application.mgt.common @@ -50,22 +50,5 @@ ${maven.checkstyle.vesion} - - - - - - - - - - - - - - - - - diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/pom.xml b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/pom.xml index a90dfea62d..82a035ace6 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/pom.xml +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/pom.xml @@ -31,7 +31,7 @@ war WSO2 Carbon - Certificate Management API WSO2 Carbon - Certificate Management API - http://wso2.org + https://entgra.io diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/api/impl/CertificateMgtServiceImpl.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/api/impl/CertificateMgtServiceImpl.java index 35d0ade404..c0bb953453 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/api/impl/CertificateMgtServiceImpl.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/api/impl/CertificateMgtServiceImpl.java @@ -18,15 +18,15 @@ package io.entgra.device.mgt.core.certificate.mgt.api.impl; +import io.entgra.device.mgt.core.certificate.mgt.api.CertificateMgtService; +import io.entgra.device.mgt.core.certificate.mgt.api.beans.ErrorResponse; +import io.entgra.device.mgt.core.certificate.mgt.api.exception.Message; +import io.entgra.device.mgt.core.certificate.mgt.api.exception.UnexpectedServerErrorException; +import io.entgra.device.mgt.core.certificate.mgt.core.exception.KeystoreException; +import io.entgra.device.mgt.core.certificate.mgt.core.impl.CertificateGenerator; import org.apache.commons.codec.binary.Base64; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.certificate.mgt.core.exception.KeystoreException; -import io.entgra.device.mgt.core.certificate.mgt.core.impl.CertificateGenerator; -import io.entgra.device.mgt.core.certificate.mgt.api.beans.ErrorResponse; -import io.entgra.device.mgt.core.certificate.mgt.api.exception.UnexpectedServerErrorException; -import io.entgra.device.mgt.core.certificate.mgt.api.CertificateMgtService; -import io.entgra.device.mgt.core.certificate.mgt.api.exception.Message; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/pom.xml b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/pom.xml index 107055487a..0691f0648c 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/pom.xml +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/pom.xml @@ -31,7 +31,7 @@ war WSO2 Carbon - Admin Certificate Management API WSO2 Carbon - Admin Certificate Management API - http://wso2.org + https://entgra.io @@ -162,7 +162,6 @@ org.ops4j.pax.logging pax-logging-api provided - io.entgra.device.mgt.core diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/beans/CertificateList.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/beans/CertificateList.java index 68a9a219df..abafec48d7 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/beans/CertificateList.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/beans/CertificateList.java @@ -18,8 +18,8 @@ package io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.beans; import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModelProperty; import io.entgra.device.mgt.core.certificate.mgt.core.dto.CertificateResponse; +import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/impl/CertificateManagementAdminServiceImpl.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/impl/CertificateManagementAdminServiceImpl.java index 0adb7ee601..85b361d33d 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/impl/CertificateManagementAdminServiceImpl.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/impl/CertificateManagementAdminServiceImpl.java @@ -44,12 +44,15 @@ import io.entgra.device.mgt.core.certificate.mgt.core.scep.SCEPManager; import io.entgra.device.mgt.core.certificate.mgt.core.scep.TenantedDeviceWrapper; import io.entgra.device.mgt.core.certificate.mgt.core.service.CertificateManagementService; import io.entgra.device.mgt.core.certificate.mgt.core.service.PaginationResult; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; import io.entgra.device.mgt.core.identity.jwt.client.extension.exception.JWTClientException; import io.entgra.device.mgt.core.identity.jwt.client.extension.service.JWTClientManagerService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.PrivilegedCarbonContext; +import javax.ws.rs.*; import javax.ws.rs.core.Response; import java.security.cert.X509Certificate; import java.util.ArrayList; diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/util/CertificateMgtAPIUtils.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/util/CertificateMgtAPIUtils.java index 737d9820a9..a8fa744869 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/util/CertificateMgtAPIUtils.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/util/CertificateMgtAPIUtils.java @@ -18,13 +18,13 @@ package io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.util; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.certificate.mgt.core.scep.SCEPManager; import io.entgra.device.mgt.core.certificate.mgt.core.service.CertificateManagementService; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.core.search.mgt.SearchManagerService; import io.entgra.device.mgt.core.identity.jwt.client.extension.service.JWTClientManagerService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.PrivilegedCarbonContext; import javax.ws.rs.core.MediaType; diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/util/RequestValidationUtil.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/util/RequestValidationUtil.java index 43f4d1ab48..8dfea3a2e9 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/util/RequestValidationUtil.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api/src/main/java/io/entgra/device/mgt/core/certificate/mgt/cert/admin/api/util/RequestValidationUtil.java @@ -17,8 +17,8 @@ */ package io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.util; -import io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.beans.ErrorResponse; import io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.InputValidationException; +import io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.beans.ErrorResponse; public class RequestValidationUtil { diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml index 24e41f4fa2..d23f1863cd 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/pom.xml @@ -30,13 +30,17 @@ bundle WSO2 Carbon - Certificate Management Core WSO2 Carbon - Certificate Management Core - http://wso2.org + https://entgra.io - org.apache.felix - maven-scr-plugin + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + org.apache.felix @@ -53,49 +57,47 @@ io.entgra.device.mgt.core.certificate.mgt.core.util - org.osgi.framework.*;version="${imp.package.version.osgi.framework}", - org.osgi.service.*;version="${imp.package.version.osgi.service}", - org.apache.commons.logging, - org.apache.commons.collections.map, + io.entgra.device.mgt.core.certificate.mgt.core.*, + io.entgra.device.mgt.core.device.mgt.common;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.exceptions;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.core.config;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.core.config.cache;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.core.service;version="[5.0,6)", + io.swagger.annotations;version="[1.6,2)", + javax.cache;version="[1.0,2)", + javax.naming, + javax.naming.ldap, javax.security.auth.x500, - javax.xml.*, - javax.xml.parsers;version="${javax.xml.parsers.import.pkg.version}";resolution:=optional, - org.apache.commons.codec.binary;version="${commons-codec.wso2.osgi.version.range}", - org.bouncycastle.asn1, - org.bouncycastle.asn1.x500, - org.bouncycastle.asn1.x509, - org.bouncycastle.asn1.pkcs, - org.bouncycastle.cert; version="${bcprov.wso2.version.range}", - org.bouncycastle.cert.jcajce; version="${bcprov.wso2.version.range}", - org.bouncycastle.cms, - org.bouncycastle.jce.provider, - org.bouncycastle.operator, - org.bouncycastle.operator.jcajce, - org.bouncycastle.asn1.x500.style, - org.bouncycastle.pkcs, - org.wso2.carbon.user.core.tenant, - org.wso2.carbon.user.api, - org.wso2.carbon.user.core.service, - - org.bouncycastle.util, + javax.sql, + javax.xml.bind;version="[0.0,1)", + javax.xml.bind.annotation;version="[0.0,1)", + javax.xml.parsers;version="${javax.xml.parsers.import.pkg.version}", + org.apache.commons.codec.binary;version="[1.4,2)", + org.apache.commons.collections.map;version="[3.2,4)", + org.apache.commons.logging;version="[1.2,2)", + org.bouncycastle.asn1;version="[1.70,2)", + org.bouncycastle.asn1.pkcs;version="[1.70,2)", + org.bouncycastle.asn1.x500;version="[1.70,2)", + org.bouncycastle.asn1.x500.style;version="[1.70,2)", + org.bouncycastle.asn1.x509;version="[1.70,2)", + org.bouncycastle.cert;version="[1.70,2)", + org.bouncycastle.cert.jcajce;version="[1.70,2)", + org.bouncycastle.cms;version="[1.70,2)", + org.bouncycastle.jce.provider;version="[1.70,2)", + org.bouncycastle.operator;version="[1.70,2)", + org.bouncycastle.operator.jcajce;version="[1.70,2)", + org.bouncycastle.pkcs;version="[1.70,2)", + org.bouncycastle.util;version="[1.70,2)", org.jscep.message, - org.wso2.carbon.context, org.jscep.transaction, - org.w3c.dom, - org.xml.sax, - javax.sql, - - javax.naming, - javax.xml.bind.annotation, - javax.xml.bind, - org.wso2.carbon.utils.*, - io.entgra.device.mgt.core.device.mgt.common.*, - io.swagger.annotations.*;resolution:=optional, - io.entgra.device.mgt.core.device.mgt.core.*, - org.wso2.carbon.registry.indexing.*, - javax.cache.*, - javax.naming.ldap - + org.osgi.framework.*;version="${imp.package.version.osgi.framework}", + org.osgi.service.*;version="${imp.package.version.osgi.service}", + org.w3c.dom,org.wso2.carbon.context;version="[4.8,5)", + org.wso2.carbon.user.api;version="[1.0,2)", + org.wso2.carbon.user.core.service;version="[4.8,5)", + org.wso2.carbon.user.core.tenant;version="[4.8,5)", + org.wso2.carbon.utils;version="[4.8,5)", + org.wso2.carbon.utils.dbcreator;version="[4.8,5)" !io.entgra.device.mgt.core.certificate.mgt.core.internal.*, @@ -123,18 +125,6 @@ jacoco-maven-plugin ${jacoco.maven.plugin.version} - - - - - - - - - - - - jacoco-initialize @@ -152,32 +142,23 @@ ${basedir}/target/coverage-reports/site - - - - - - + + org.apache.felix + org.apache.felix.scr.ds-annotations + provided + org.jacoco org.jacoco.agent ${jacoco.maven.plugin.version} runtime - - org.eclipse.osgi - org.eclipse.osgi - - - org.eclipse.equinox - org.eclipse.equinox.common - org.testng testng @@ -190,7 +171,6 @@ org.wso2.carbon org.wso2.carbon.securevault - test @@ -207,18 +187,19 @@ org.ops4j.pax.logging pax-logging-api provided - org.wso2.orbit.org.bouncycastle bcprov-jdk15on + provided org.wso2.orbit.org.bouncycastle bcpkix-jdk15on + provided - org.wso2.orbit.com.google.code.jscep + io.entgra.com.google.code.jscep jscep @@ -236,10 +217,12 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.device.mgt.core + provided io.entgra.device.mgt.core io.entgra.device.mgt.core.device.mgt.common + provided io.swagger diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/cache/impl/CertificateCacheManagerImpl.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/cache/impl/CertificateCacheManagerImpl.java index ac02de57a3..0a3129b977 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/cache/impl/CertificateCacheManagerImpl.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/cache/impl/CertificateCacheManagerImpl.java @@ -19,8 +19,8 @@ package io.entgra.device.mgt.core.certificate.mgt.core.cache.impl; -import io.entgra.device.mgt.core.certificate.mgt.core.dto.CertificateResponse; import io.entgra.device.mgt.core.certificate.mgt.core.cache.CertificateCacheManager; +import io.entgra.device.mgt.core.certificate.mgt.core.dto.CertificateResponse; import io.entgra.device.mgt.core.device.mgt.core.config.DeviceConfigurationManager; import io.entgra.device.mgt.core.device.mgt.core.config.DeviceManagementConfig; diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/CertificateManagementDAOFactory.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/CertificateManagementDAOFactory.java index 89f4d8145b..4a2fc9a47f 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/CertificateManagementDAOFactory.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/CertificateManagementDAOFactory.java @@ -18,6 +18,8 @@ package io.entgra.device.mgt.core.certificate.mgt.core.dao; +import io.entgra.device.mgt.core.certificate.mgt.core.config.datasource.DataSourceConfig; +import io.entgra.device.mgt.core.certificate.mgt.core.config.datasource.JNDILookupDefinition; import io.entgra.device.mgt.core.certificate.mgt.core.dao.impl.GenericCertificateDAOImpl; import io.entgra.device.mgt.core.certificate.mgt.core.dao.impl.OracleCertificateDAOImpl; import io.entgra.device.mgt.core.certificate.mgt.core.dao.impl.PostgreSQLCertificateDAOImpl; @@ -28,8 +30,6 @@ import io.entgra.device.mgt.core.certificate.mgt.core.exception.UnsupportedDatab import io.entgra.device.mgt.core.certificate.mgt.core.util.CertificateManagementConstants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.certificate.mgt.core.config.datasource.DataSourceConfig; -import io.entgra.device.mgt.core.certificate.mgt.core.config.datasource.JNDILookupDefinition; import javax.sql.DataSource; import java.sql.Connection; diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/AbstractCertificateDAOImpl.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/AbstractCertificateDAOImpl.java index bd46a00559..45a7e7c56f 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/AbstractCertificateDAOImpl.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/AbstractCertificateDAOImpl.java @@ -19,15 +19,15 @@ package io.entgra.device.mgt.core.certificate.mgt.core.dao.impl; import io.entgra.device.mgt.core.certificate.mgt.core.bean.Certificate; -import io.entgra.device.mgt.core.certificate.mgt.core.dto.CertificateResponse; -import io.entgra.device.mgt.core.certificate.mgt.core.impl.CertificateGenerator; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateDAO; import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateManagementDAOException; import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateManagementDAOFactory; import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateManagementDAOUtil; +import io.entgra.device.mgt.core.certificate.mgt.core.dto.CertificateResponse; +import io.entgra.device.mgt.core.certificate.mgt.core.impl.CertificateGenerator; import io.entgra.device.mgt.core.certificate.mgt.core.util.Serializer; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.wso2.carbon.context.PrivilegedCarbonContext; import java.io.IOException; diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/GenericCertificateDAOImpl.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/GenericCertificateDAOImpl.java index 99bf38c73f..fa5d028afe 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/GenericCertificateDAOImpl.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/GenericCertificateDAOImpl.java @@ -18,14 +18,14 @@ package io.entgra.device.mgt.core.certificate.mgt.core.dao.impl; -import io.entgra.device.mgt.core.certificate.mgt.core.dto.CertificateResponse; -import io.entgra.device.mgt.core.certificate.mgt.core.impl.CertificateGenerator; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateManagementDAOException; import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateManagementDAOFactory; import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateManagementDAOUtil; +import io.entgra.device.mgt.core.certificate.mgt.core.dto.CertificateResponse; +import io.entgra.device.mgt.core.certificate.mgt.core.impl.CertificateGenerator; import io.entgra.device.mgt.core.certificate.mgt.core.service.PaginationResult; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.wso2.carbon.context.PrivilegedCarbonContext; import java.sql.Connection; diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/OracleCertificateDAOImpl.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/OracleCertificateDAOImpl.java index 2b2e934570..78a0fada50 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/OracleCertificateDAOImpl.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/OracleCertificateDAOImpl.java @@ -18,14 +18,14 @@ package io.entgra.device.mgt.core.certificate.mgt.core.dao.impl; -import io.entgra.device.mgt.core.certificate.mgt.core.dto.CertificateResponse; -import io.entgra.device.mgt.core.certificate.mgt.core.impl.CertificateGenerator; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateManagementDAOException; import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateManagementDAOFactory; import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateManagementDAOUtil; +import io.entgra.device.mgt.core.certificate.mgt.core.dto.CertificateResponse; +import io.entgra.device.mgt.core.certificate.mgt.core.impl.CertificateGenerator; import io.entgra.device.mgt.core.certificate.mgt.core.service.PaginationResult; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.wso2.carbon.context.PrivilegedCarbonContext; import java.sql.Connection; diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/PostgreSQLCertificateDAOImpl.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/PostgreSQLCertificateDAOImpl.java index 6e8ea00703..e331402ce1 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/PostgreSQLCertificateDAOImpl.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/PostgreSQLCertificateDAOImpl.java @@ -18,14 +18,14 @@ package io.entgra.device.mgt.core.certificate.mgt.core.dao.impl; -import io.entgra.device.mgt.core.certificate.mgt.core.dto.CertificateResponse; -import io.entgra.device.mgt.core.certificate.mgt.core.impl.CertificateGenerator; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateManagementDAOException; import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateManagementDAOFactory; import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateManagementDAOUtil; +import io.entgra.device.mgt.core.certificate.mgt.core.dto.CertificateResponse; +import io.entgra.device.mgt.core.certificate.mgt.core.impl.CertificateGenerator; import io.entgra.device.mgt.core.certificate.mgt.core.service.PaginationResult; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.wso2.carbon.context.PrivilegedCarbonContext; import java.sql.Connection; diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/SQLServerCertificateDAOImpl.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/SQLServerCertificateDAOImpl.java index de8d911c29..084ab9a1c1 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/SQLServerCertificateDAOImpl.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/dao/impl/SQLServerCertificateDAOImpl.java @@ -18,14 +18,14 @@ package io.entgra.device.mgt.core.certificate.mgt.core.dao.impl; -import io.entgra.device.mgt.core.certificate.mgt.core.dto.CertificateResponse; -import io.entgra.device.mgt.core.certificate.mgt.core.impl.CertificateGenerator; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateManagementDAOException; import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateManagementDAOFactory; import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateManagementDAOUtil; +import io.entgra.device.mgt.core.certificate.mgt.core.dto.CertificateResponse; +import io.entgra.device.mgt.core.certificate.mgt.core.impl.CertificateGenerator; import io.entgra.device.mgt.core.certificate.mgt.core.service.PaginationResult; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.wso2.carbon.context.PrivilegedCarbonContext; import java.sql.Connection; diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateGenerator.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateGenerator.java index cffcec417d..bc98fae4a5 100755 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateGenerator.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateGenerator.java @@ -17,8 +17,17 @@ */ package io.entgra.device.mgt.core.certificate.mgt.core.impl; +import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateDAO; +import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateManagementDAOException; +import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateManagementDAOFactory; +import io.entgra.device.mgt.core.certificate.mgt.core.dto.CAStatus; +import io.entgra.device.mgt.core.certificate.mgt.core.dto.CertificateResponse; +import io.entgra.device.mgt.core.certificate.mgt.core.dto.SCEPResponse; +import io.entgra.device.mgt.core.certificate.mgt.core.exception.KeystoreException; +import io.entgra.device.mgt.core.certificate.mgt.core.exception.TransactionManagementException; import io.entgra.device.mgt.core.certificate.mgt.core.util.CertificateManagementConstants; import io.entgra.device.mgt.core.certificate.mgt.core.util.CommonUtil; +import io.entgra.device.mgt.core.certificate.mgt.core.util.Serializer; import org.apache.commons.codec.binary.Base64; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -46,26 +55,10 @@ import org.bouncycastle.operator.OperatorCreationException; import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder; import org.bouncycastle.pkcs.PKCS10CertificationRequest; import org.bouncycastle.util.Store; -import org.jscep.message.CertRep; -import org.jscep.message.MessageDecodingException; -import org.jscep.message.MessageEncodingException; -import org.jscep.message.PkcsPkiEnvelopeDecoder; -import org.jscep.message.PkcsPkiEnvelopeEncoder; -import org.jscep.message.PkiMessage; -import org.jscep.message.PkiMessageDecoder; -import org.jscep.message.PkiMessageEncoder; +import org.jscep.message.*; import org.jscep.transaction.FailInfo; import org.jscep.transaction.Nonce; import org.jscep.transaction.TransactionId; -import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateDAO; -import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateManagementDAOException; -import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateManagementDAOFactory; -import io.entgra.device.mgt.core.certificate.mgt.core.dto.CAStatus; -import io.entgra.device.mgt.core.certificate.mgt.core.dto.CertificateResponse; -import io.entgra.device.mgt.core.certificate.mgt.core.dto.SCEPResponse; -import io.entgra.device.mgt.core.certificate.mgt.core.exception.KeystoreException; -import io.entgra.device.mgt.core.certificate.mgt.core.exception.TransactionManagementException; -import io.entgra.device.mgt.core.certificate.mgt.core.util.Serializer; import org.wso2.carbon.context.PrivilegedCarbonContext; import javax.naming.InvalidNameException; @@ -77,24 +70,9 @@ import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.math.BigInteger; -import java.security.InvalidKeyException; -import java.security.KeyFactory; -import java.security.KeyPair; -import java.security.KeyPairGenerator; -import java.security.NoSuchAlgorithmException; -import java.security.NoSuchProviderException; -import java.security.PrivateKey; -import java.security.PublicKey; -import java.security.SecureRandom; -import java.security.Security; -import java.security.SignatureException; +import java.security.*; import java.security.cert.Certificate; -import java.security.cert.CertificateEncodingException; -import java.security.cert.CertificateException; -import java.security.cert.CertificateExpiredException; -import java.security.cert.CertificateFactory; -import java.security.cert.CertificateNotYetValidException; -import java.security.cert.X509Certificate; +import java.security.cert.*; import java.security.spec.InvalidKeySpecException; import java.security.spec.X509EncodedKeySpec; import java.util.*; diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/KeyStoreReader.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/KeyStoreReader.java index 8c8ed5e7fc..56ec2bb6f5 100755 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/KeyStoreReader.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/KeyStoreReader.java @@ -17,8 +17,6 @@ */ package io.entgra.device.mgt.core.certificate.mgt.core.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.certificate.mgt.core.cache.CertificateCacheManager; import io.entgra.device.mgt.core.certificate.mgt.core.cache.impl.CertificateCacheManagerImpl; import io.entgra.device.mgt.core.certificate.mgt.core.config.CertificateConfigurationManager; @@ -30,12 +28,10 @@ import io.entgra.device.mgt.core.certificate.mgt.core.dto.CertificateResponse; import io.entgra.device.mgt.core.certificate.mgt.core.exception.CertificateManagementException; import io.entgra.device.mgt.core.certificate.mgt.core.exception.KeystoreException; import io.entgra.device.mgt.core.certificate.mgt.core.util.Serializer; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; +import java.io.*; import java.security.*; import java.security.cert.Certificate; import java.security.cert.CertificateException; diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/internal/CertificateManagementServiceComponent.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/internal/CertificateManagementServiceComponent.java index 956bb4683c..e51febfe88 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/internal/CertificateManagementServiceComponent.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/internal/CertificateManagementServiceComponent.java @@ -18,37 +18,33 @@ package io.entgra.device.mgt.core.certificate.mgt.core.internal; +import io.entgra.device.mgt.core.certificate.mgt.core.config.CertificateConfigurationManager; +import io.entgra.device.mgt.core.certificate.mgt.core.config.CertificateManagementConfig; +import io.entgra.device.mgt.core.certificate.mgt.core.config.datasource.DataSourceConfig; import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateManagementDAOFactory; import io.entgra.device.mgt.core.certificate.mgt.core.exception.CertificateManagementException; import io.entgra.device.mgt.core.certificate.mgt.core.scep.SCEPManager; import io.entgra.device.mgt.core.certificate.mgt.core.scep.SCEPManagerImpl; +import io.entgra.device.mgt.core.certificate.mgt.core.service.CertificateManagementService; +import io.entgra.device.mgt.core.certificate.mgt.core.service.CertificateManagementServiceImpl; import io.entgra.device.mgt.core.certificate.mgt.core.util.CertificateManagementConstants; import io.entgra.device.mgt.core.certificate.mgt.core.util.CertificateMgtSchemaInitializer; +import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.framework.BundleContext; import org.osgi.service.component.ComponentContext; -import io.entgra.device.mgt.core.certificate.mgt.core.config.CertificateConfigurationManager; -import io.entgra.device.mgt.core.certificate.mgt.core.config.CertificateManagementConfig; -import io.entgra.device.mgt.core.certificate.mgt.core.config.datasource.DataSourceConfig; -import io.entgra.device.mgt.core.certificate.mgt.core.service.CertificateManagementService; -import io.entgra.device.mgt.core.certificate.mgt.core.service.CertificateManagementServiceImpl; -import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; +import org.osgi.service.component.annotations.*; -/** - * @scr.component name="org.wso2.carbon.certificate.mgt" immediate="true" - * @scr.reference name="org.wso2.carbon.device.manager" - * interface="io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService" - * cardinality="1..1" - * policy="dynamic" - * bind="setDeviceManagementService" - * unbind="unsetDeviceManagementService" - */ +@Component( + name = "io.entgra.device.mgt.core.certificate.mgt.core.internal.CertificateManagementServiceComponent", + immediate = true) public class CertificateManagementServiceComponent { private static Log log = LogFactory.getLog(CertificateManagementServiceComponent.class); @SuppressWarnings("unused") + @Activate protected void activate(ComponentContext componentContext) { try { if (log.isDebugEnabled()) { @@ -86,10 +82,17 @@ public class CertificateManagementServiceComponent { } @SuppressWarnings("unused") + @Deactivate protected void deactivate(ComponentContext componentContext) { //do nothing } + @Reference( + name = "device.mgt.provider.service", + service = io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetDeviceManagementService") protected void setDeviceManagementService(DeviceManagementProviderService deviceManagerService) { if (log.isDebugEnabled()) { log.debug("Setting Device Management Service"); diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/scep/SCEPManagerImpl.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/scep/SCEPManagerImpl.java index 4d18a19afb..783a234ff7 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/scep/SCEPManagerImpl.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/scep/SCEPManagerImpl.java @@ -18,15 +18,15 @@ package io.entgra.device.mgt.core.certificate.mgt.core.scep; -import org.apache.commons.collections.map.SingletonMap; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.certificate.mgt.core.internal.CertificateManagementDataHolder; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; +import org.apache.commons.collections.map.SingletonMap; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.user.core.service.RealmService; import org.wso2.carbon.utils.multitenancy.MultitenantConstants; diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/util/CertificateManagerUtil.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/util/CertificateManagerUtil.java index cfa613ba5a..4383396448 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/util/CertificateManagerUtil.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/util/CertificateManagerUtil.java @@ -19,15 +19,15 @@ package io.entgra.device.mgt.core.certificate.mgt.core.util; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.w3c.dom.Document; import io.entgra.device.mgt.core.certificate.mgt.core.config.CertificateConfigurationManager; import io.entgra.device.mgt.core.certificate.mgt.core.config.CertificateManagementConfig; import io.entgra.device.mgt.core.certificate.mgt.core.config.datasource.DataSourceConfig; import io.entgra.device.mgt.core.certificate.mgt.core.config.datasource.JNDILookupDefinition; import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateManagementDAOUtil; import io.entgra.device.mgt.core.certificate.mgt.core.exception.CertificateManagementException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.w3c.dom.Document; import javax.sql.DataSource; import javax.xml.XMLConstants; diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/util/CertificateMgtSchemaInitializer.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/util/CertificateMgtSchemaInitializer.java index 9253ac9500..d0e080cc52 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/util/CertificateMgtSchemaInitializer.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/util/CertificateMgtSchemaInitializer.java @@ -18,9 +18,9 @@ package io.entgra.device.mgt.core.certificate.mgt.core.util; +import io.entgra.device.mgt.core.certificate.mgt.core.config.datasource.DataSourceConfig; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.certificate.mgt.core.config.datasource.DataSourceConfig; import org.wso2.carbon.utils.CarbonUtils; import org.wso2.carbon.utils.dbcreator.DatabaseCreator; diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/util/Serializer.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/util/Serializer.java index e5505449fd..4e5bee0518 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/util/Serializer.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/main/java/io/entgra/device/mgt/core/certificate/mgt/core/util/Serializer.java @@ -18,11 +18,7 @@ package io.entgra.device.mgt.core.certificate.mgt.core.util; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; +import java.io.*; /** * Serialize/deserialize a given object to and from a byte array. diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/common/BaseDeviceManagementCertificateTest.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/common/BaseDeviceManagementCertificateTest.java index 74118cb1ba..7ef81c794d 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/common/BaseDeviceManagementCertificateTest.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/common/BaseDeviceManagementCertificateTest.java @@ -19,6 +19,10 @@ package io.entgra.device.mgt.core.certificate.mgt.core.common; import io.entgra.device.mgt.core.certificate.mgt.core.util.TestUtils; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; +import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOFactory; +import io.entgra.device.mgt.core.device.mgt.core.dao.GroupManagementDAOFactory; +import io.entgra.device.mgt.core.device.mgt.core.util.DeviceManagerUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.tomcat.jdbc.pool.PoolProperties; @@ -27,10 +31,6 @@ import org.testng.annotations.BeforeSuite; import org.w3c.dom.Document; import org.wso2.carbon.base.MultitenantConstants; import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; -import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOFactory; -import io.entgra.device.mgt.core.device.mgt.core.dao.GroupManagementDAOFactory; -import io.entgra.device.mgt.core.device.mgt.core.util.DeviceManagerUtil; import javax.sql.DataSource; import javax.xml.bind.JAXBContext; diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateCacheManagerImplTests.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateCacheManagerImplTests.java index 04f5c73713..911c84d763 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateCacheManagerImplTests.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateCacheManagerImplTests.java @@ -18,11 +18,11 @@ package io.entgra.device.mgt.core.certificate.mgt.core.impl; -import org.testng.Assert; -import org.testng.annotations.BeforeClass; import io.entgra.device.mgt.core.certificate.mgt.core.cache.CertificateCacheManager; import io.entgra.device.mgt.core.certificate.mgt.core.common.BaseDeviceManagementCertificateTest; import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateManagementDAOFactory; +import org.testng.Assert; +import org.testng.annotations.BeforeClass; /** * This class tests CertificateCache manager methods diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateGeneratorNegativeTests.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateGeneratorNegativeTests.java index e83917000b..fe87657544 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateGeneratorNegativeTests.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateGeneratorNegativeTests.java @@ -17,7 +17,11 @@ */ package io.entgra.device.mgt.core.certificate.mgt.core.impl; + +import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateManagementDAOFactory; +import io.entgra.device.mgt.core.certificate.mgt.core.exception.KeystoreException; import io.entgra.device.mgt.core.certificate.mgt.core.util.CSRGenerator; +import io.entgra.device.mgt.core.certificate.mgt.core.util.CertificateManagementConstants; import org.bouncycastle.asn1.ASN1Encodable; import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.cert.CertIOException; @@ -36,18 +40,11 @@ import org.powermock.modules.testng.PowerMockTestCase; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import org.wso2.carbon.base.MultitenantConstants; -import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateManagementDAOFactory; -import io.entgra.device.mgt.core.certificate.mgt.core.exception.KeystoreException; -import io.entgra.device.mgt.core.certificate.mgt.core.util.CertificateManagementConstants; import org.wso2.carbon.context.PrivilegedCarbonContext; + import javax.sql.DataSource; import java.io.File; -import java.security.KeyPair; -import java.security.PrivateKey; -import java.security.NoSuchProviderException; -import java.security.NoSuchAlgorithmException; -import java.security.SignatureException; -import java.security.InvalidKeyException; +import java.security.*; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; import java.sql.SQLException; diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateGeneratorTestSuite.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateGeneratorTestSuite.java index b0a752714f..ddad9213b9 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateGeneratorTestSuite.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateGeneratorTestSuite.java @@ -18,13 +18,13 @@ package io.entgra.device.mgt.core.certificate.mgt.core.impl; +import io.entgra.device.mgt.core.certificate.mgt.core.exception.KeystoreException; +import io.entgra.device.mgt.core.certificate.mgt.core.util.CertificateManagementConstants; import org.apache.commons.io.FileUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.testng.Assert; import org.testng.annotations.Test; -import io.entgra.device.mgt.core.certificate.mgt.core.exception.KeystoreException; -import io.entgra.device.mgt.core.certificate.mgt.core.util.CertificateManagementConstants; import java.io.File; import java.io.IOException; diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateGeneratorTests.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateGeneratorTests.java index e192a41864..20a625eee1 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateGeneratorTests.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateGeneratorTests.java @@ -17,11 +17,11 @@ */ package io.entgra.device.mgt.core.certificate.mgt.core.impl; +import io.entgra.device.mgt.core.certificate.mgt.core.exception.KeystoreException; import junit.framework.Assert; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.testng.annotations.Test; -import io.entgra.device.mgt.core.certificate.mgt.core.exception.KeystoreException; public class CertificateGeneratorTests { diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateManagementServiceImplNegativeTests.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateManagementServiceImplNegativeTests.java index b1ce7cb8b6..1f7dbf0f3c 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateManagementServiceImplNegativeTests.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateManagementServiceImplNegativeTests.java @@ -18,6 +18,10 @@ package io.entgra.device.mgt.core.certificate.mgt.core.impl; +import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateManagementDAOFactory; +import io.entgra.device.mgt.core.certificate.mgt.core.exception.CertificateManagementException; +import io.entgra.device.mgt.core.certificate.mgt.core.exception.TransactionManagementException; +import io.entgra.device.mgt.core.certificate.mgt.core.service.CertificateManagementServiceImpl; import org.bouncycastle.cert.jcajce.JcaX509CertificateConverter; import org.mockito.Mockito; import org.powermock.api.mockito.PowerMockito; @@ -29,10 +33,6 @@ import org.testng.annotations.BeforeClass; import org.testng.annotations.ObjectFactory; import org.testng.annotations.Test; import org.wso2.carbon.base.MultitenantConstants; -import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateManagementDAOFactory; -import io.entgra.device.mgt.core.certificate.mgt.core.exception.CertificateManagementException; -import io.entgra.device.mgt.core.certificate.mgt.core.exception.TransactionManagementException; -import io.entgra.device.mgt.core.certificate.mgt.core.service.CertificateManagementServiceImpl; import org.wso2.carbon.context.PrivilegedCarbonContext; import javax.sql.DataSource; diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateManagementServiceImplTests.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateManagementServiceImplTests.java index 56218376bf..6337837ef1 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateManagementServiceImplTests.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateManagementServiceImplTests.java @@ -18,8 +18,20 @@ package io.entgra.device.mgt.core.certificate.mgt.core.impl; +import io.entgra.device.mgt.core.certificate.mgt.core.common.BaseDeviceManagementCertificateTest; +import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateManagementDAOFactory; +import io.entgra.device.mgt.core.certificate.mgt.core.dto.CAStatus; +import io.entgra.device.mgt.core.certificate.mgt.core.dto.CertificateResponse; +import io.entgra.device.mgt.core.certificate.mgt.core.dto.SCEPResponse; +import io.entgra.device.mgt.core.certificate.mgt.core.exception.CertificateManagementException; +import io.entgra.device.mgt.core.certificate.mgt.core.exception.KeystoreException; +import io.entgra.device.mgt.core.certificate.mgt.core.service.CertificateManagementServiceImpl; +import io.entgra.device.mgt.core.certificate.mgt.core.service.PaginationResult; import io.entgra.device.mgt.core.certificate.mgt.core.util.CSRGenerator; +import io.entgra.device.mgt.core.certificate.mgt.core.util.CertificateManagementConstants; import io.entgra.device.mgt.core.certificate.mgt.core.util.DummyCertificate; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; +import io.entgra.device.mgt.core.device.mgt.core.config.DeviceConfigurationManager; import org.apache.commons.io.FileUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -32,19 +44,8 @@ import org.bouncycastle.pkcs.PKCS10CertificationRequest; import org.testng.Assert; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; -import io.entgra.device.mgt.core.certificate.mgt.core.common.BaseDeviceManagementCertificateTest; -import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateManagementDAOFactory; -import io.entgra.device.mgt.core.certificate.mgt.core.dto.CAStatus; -import io.entgra.device.mgt.core.certificate.mgt.core.dto.CertificateResponse; -import io.entgra.device.mgt.core.certificate.mgt.core.dto.SCEPResponse; -import io.entgra.device.mgt.core.certificate.mgt.core.exception.CertificateManagementException; -import io.entgra.device.mgt.core.certificate.mgt.core.exception.KeystoreException; -import io.entgra.device.mgt.core.certificate.mgt.core.service.CertificateManagementServiceImpl; -import io.entgra.device.mgt.core.certificate.mgt.core.service.PaginationResult; -import io.entgra.device.mgt.core.certificate.mgt.core.util.CertificateManagementConstants; import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; -import io.entgra.device.mgt.core.device.mgt.core.config.DeviceConfigurationManager; + import java.io.ByteArrayInputStream; import java.io.File; import java.io.IOException; diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateTests.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateTests.java index 9ece83b78a..e3ef5d8337 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateTests.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/impl/CertificateTests.java @@ -18,10 +18,10 @@ package io.entgra.device.mgt.core.certificate.mgt.core.impl; +import io.entgra.device.mgt.core.certificate.mgt.core.bean.Certificate; import io.entgra.device.mgt.core.certificate.mgt.core.util.DummyCertificate; import org.testng.Assert; import org.testng.annotations.Test; -import io.entgra.device.mgt.core.certificate.mgt.core.bean.Certificate; /** * This class tests the DTO for certificates diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/util/DummyCertificate.java b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/util/DummyCertificate.java index ba4491643a..0a22e7b52b 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/util/DummyCertificate.java +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/java/io/entgra/device/mgt/core/certificate/mgt/core/util/DummyCertificate.java @@ -21,17 +21,8 @@ package io.entgra.device.mgt.core.certificate.mgt.core.util; import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; import java.math.BigInteger; -import java.security.Principal; -import java.security.PublicKey; -import java.security.cert.CertificateEncodingException; -import java.security.cert.CertificateExpiredException; -import java.security.cert.CertificateNotYetValidException; -import java.security.cert.CertificateException; -import java.security.NoSuchAlgorithmException; -import java.security.SignatureException; -import java.security.NoSuchProviderException; -import java.security.cert.X509Certificate; -import java.security.InvalidKeyException; +import java.security.*; +import java.security.cert.*; import java.util.Date; import java.util.Set; diff --git a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/resources/carbon-home/repository/conf/datasources/master-datasources.xml b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/resources/carbon-home/repository/conf/datasources/master-datasources.xml index a901e7a707..010c7a2cc8 100644 --- a/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/resources/carbon-home/repository/conf/datasources/master-datasources.xml +++ b/components/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.core/src/test/resources/carbon-home/repository/conf/datasources/master-datasources.xml @@ -15,7 +15,7 @@ ~ specific language governing permissions and limitations ~ under the License. --> - + org.wso2.carbon.ndatasource.rdbms.RDBMSDataSourceReader diff --git a/components/certificate-mgt/pom.xml b/components/certificate-mgt/pom.xml index 92612bf64d..98c20d369b 100644 --- a/components/certificate-mgt/pom.xml +++ b/components/certificate-mgt/pom.xml @@ -30,7 +30,7 @@ certificate-mgt pom WSO2 Carbon - Certificate Management Component - http://wso2.org + https://entgra.io io.entgra.device.mgt.core.certificate.mgt.core @@ -38,23 +38,4 @@ io.entgra.device.mgt.core.certificate.mgt.cert.admin.api - - - - - - - - - - - - - - - - - - - diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/pom.xml index 2dc0219ce9..38ba36543d 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/pom.xml @@ -35,13 +35,13 @@ - - org.apache.felix - maven-scr-plugin - org.apache.maven.plugins maven-compiler-plugin + + 1.8 + 1.8 + org.apache.felix @@ -55,22 +55,19 @@ IoT - User Roles Management Bundle io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.internal + io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.bean;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.exception;version="[5.0,6)", + javax.xml.bind;version="[0.0,1)", + javax.xml.bind.annotation;version="[0.0,1)", + javax.xml.parsers;version="${javax.xml.parsers.import.pkg.version}", + org.apache.commons.logging;version="[1.2,2)", org.osgi.framework.*;version="${imp.package.version.osgi.framework}", org.osgi.service.*;version="${imp.package.version.osgi.service}", - org.apache.commons.logging, - org.apache.axis2.*;version="${axis2.osgi.version.range}", - org.wso2.carbon.core, - org.wso2.carbon.utils.*, - javax.xml.bind;resolution:=optional, - javax.xml.bind.annotation, - javax.xml.parsers, - org.w3c.dom, - org.wso2.carbon, - org.wso2.carbon.context, - org.wso2.carbon.user.api, - org.wso2.carbon.user.core.common, - org.wso2.carbon.user.core.service, - org.wso2.carbon.user.mgt.common + org.w3c.dom,org.wso2.carbon.context;version="[4.8,5)", + org.wso2.carbon.core;version="[4.8,5)", + org.wso2.carbon.user.api;version="[1.0,2)", + org.wso2.carbon.user.core.service;version="[4.8,5)", + org.wso2.carbon.utils;version="[4.8,5)" !io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.internal, @@ -123,12 +120,9 @@ - org.eclipse.osgi - org.eclipse.osgi - - - org.eclipse.osgi - org.eclipse.osgi.services + org.apache.felix + org.apache.felix.scr.ds-annotations + provided org.wso2.carbon @@ -138,7 +132,6 @@ org.ops4j.pax.logging pax-logging-api provided - org.wso2.carbon @@ -188,7 +181,6 @@ org.wso2.carbon org.wso2.carbon.securevault - test diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/defaultrole/manager/internal/RoleManagerServiceComponent.java b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/defaultrole/manager/internal/RoleManagerServiceComponent.java index 095fca95e4..6b802591ce 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/defaultrole/manager/internal/RoleManagerServiceComponent.java +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/defaultrole/manager/internal/RoleManagerServiceComponent.java @@ -19,35 +19,24 @@ package io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.internal; import io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.DefaultRolesConfigManager; +import io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.IoTSStartupHandler; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.framework.BundleContext; import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.*; import org.wso2.carbon.core.ServerStartupObserver; -import io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.IoTSStartupHandler; import org.wso2.carbon.user.core.service.RealmService; import org.wso2.carbon.utils.ConfigurationContextService; -/** - * @scr.component name="io.entgra.device.mgt.role.manager.RoleManagerServiceComponent" - * immediate="true" - * @scr.reference name="user.realmservice.default" - * interface="org.wso2.carbon.user.core.service.RealmService" - * cardinality="1..1" - * policy="dynamic" - * bind="setRealmService" - * unbind="unsetRealmService" - * @scr.reference name="config.context.service" - * interface="org.wso2.carbon.utils.ConfigurationContextService" - * cardinality="0..1" - * policy="dynamic" - * bind="setConfigurationContextService" - * unbind="unsetConfigurationContextService" - */ +@Component( + name = "io.entgra.device.mgt.core.device.mgt.extensions.defaultrole.manager.internal.RoleManagerServiceComponent", + immediate = true) public class RoleManagerServiceComponent { private static final Log log = LogFactory.getLog(RoleManagerServiceComponent.class); + @Activate protected void activate(ComponentContext ctx) { if (log.isDebugEnabled()) { log.debug("Activating Role Management Service Component"); @@ -63,13 +52,19 @@ public class RoleManagerServiceComponent { log.error("Error occurred while activating Role Management Service Component", e); } } - + @Deactivate protected void deactivate(ComponentContext ctx) { if (log.isDebugEnabled()) { log.debug("De-activating Role Manager Service Component"); } } + @Reference( + name = "configuration.context.service", + service = org.wso2.carbon.utils.ConfigurationContextService.class, + cardinality = ReferenceCardinality.OPTIONAL, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetConfigurationContextService") protected void setConfigurationContextService(ConfigurationContextService configurationContextService) { if (log.isDebugEnabled()) { log.debug("Setting ConfigurationContextService"); @@ -90,6 +85,12 @@ public class RoleManagerServiceComponent { * * @param realmService An instance of RealmService */ + @Reference( + name = "realm.service", + service = org.wso2.carbon.user.core.service.RealmService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRealmService") protected void setRealmService(RealmService realmService) { if (log.isDebugEnabled()) { log.debug("Setting Realm Service"); diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml index ae988a7f2d..8b1dc93e22 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/pom.xml @@ -31,9 +31,14 @@ bundle WSO2 Carbon - Device Type Deployer WSO2 Carbon - Device Type Deployer Implementation - http://wso2.org + https://entgra.io + + org.apache.felix + org.apache.felix.scr.ds-annotations + provided + commons-lang.wso2 commons-lang @@ -46,14 +51,6 @@ org.wso2.carbon org.wso2.carbon.utils - - org.eclipse.osgi - org.eclipse.osgi - - - org.eclipse.osgi - org.eclipse.osgi.services - commons-logging commons-logging @@ -112,8 +109,12 @@ - org.apache.felix - maven-scr-plugin + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + org.apache.felix @@ -130,34 +131,29 @@ io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.* - javax.naming, - javax.sql, - javax.xml, - javax.xml.bind, - javax.xml.bind.annotation, - javax.xml.parsers; version="${javax.xml.parsers.import.pkg.version}", - org.apache.axis2.context, - org.apache.axis2.deployment.*, - org.apache.commons.lang;version="${commons-lang.wso2.osgi.version.range}", - org.apache.commons.logging, + io.entgra.device.mgt.core.device.mgt.common.spi;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.util, + io.entgra.device.mgt.core.device.mgt.extensions.device.type.template;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.exception;version="[5.0,6)", + javax.xml.bind;version="[0.0,1)", + javax.xml.parsers;version="${javax.xml.parsers.import.pkg.version}", + org.apache.axis2.context;version="[1.6,2)", + org.apache.axis2.deployment;version="[1.6,2)", + org.apache.axis2.deployment.repository.util;version="[1.6,2)", + org.apache.axis2.engine;version="[1.6,2)", + org.apache.commons.logging;version="[1.2,2)", org.osgi.framework.*;version="${imp.package.version.osgi.framework}", org.osgi.service.*;version="${imp.package.version.osgi.service}", - org.w3c.dom, - org.wso2.carbon.context, - io.entgra.device.mgt.core.device.mgt.common.*, - io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.*, - org.wso2.carbon.registry.api, - org.wso2.carbon.registry.core, - org.wso2.carbon.registry.core.*, - org.wso2.carbon.utils.*, - javax.xml.namespace, - org.apache.commons.io, - org.wso2.carbon.application.deployer.*, - org.apache.axis2.engine, - org.wso2.carbon.ndatasource.core, + org.w3c.dom,org.wso2.carbon.application.deployer;version="[4.8,5)", + org.wso2.carbon.application.deployer.config;version="[4.8,5)", + org.wso2.carbon.application.deployer.handler;version="[4.8,5)", + org.wso2.carbon.context;version="[4.8,5)", + org.wso2.carbon.ndatasource.core;version="[4.8,5)", + org.wso2.carbon.registry.core.service;version="[1.0,2)", + org.wso2.carbon.utils;version="[4.8,5)" DeviceTypeDeployer - diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/deployer/DeviceTypeCAppDeployer.java b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/deployer/DeviceTypeCAppDeployer.java index b4dd226289..ee2c7a7367 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/deployer/DeviceTypeCAppDeployer.java +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/deployer/DeviceTypeCAppDeployer.java @@ -17,6 +17,7 @@ */ package io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer; +import io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.util.DeviceTypePluginConstants; import org.apache.axis2.deployment.Deployer; import org.apache.axis2.deployment.DeploymentException; import org.apache.axis2.deployment.repository.util.DeploymentFileData; @@ -29,7 +30,6 @@ import org.wso2.carbon.application.deployer.CarbonApplication; import org.wso2.carbon.application.deployer.config.Artifact; import org.wso2.carbon.application.deployer.config.CappFile; import org.wso2.carbon.application.deployer.handler.AppDeploymentHandler; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.util.DeviceTypePluginConstants; import java.io.File; import java.util.ArrayList; diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/deployer/DeviceTypePluginDeployer.java b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/deployer/DeviceTypePluginDeployer.java index 51da5d8687..fe5a4488e1 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/deployer/DeviceTypePluginDeployer.java +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/deployer/DeviceTypePluginDeployer.java @@ -17,6 +17,13 @@ */ package io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer; +import io.entgra.device.mgt.core.device.mgt.common.spi.DeviceManagementService; +import io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.internal.DeviceTypeManagementDataHolder; +import io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.util.DeviceTypeConfigUtil; +import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.DeviceTypeConfigIdentifier; +import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.DeviceTypeManagerService; +import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.DeviceTypeConfiguration; +import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.exception.DeviceTypeConfigurationException; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.deployment.AbstractDeployer; import org.apache.axis2.deployment.DeploymentException; @@ -27,13 +34,6 @@ import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceRegistration; import org.w3c.dom.Document; import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.device.mgt.common.spi.DeviceManagementService; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.internal.DeviceTypeManagementDataHolder; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.util.DeviceTypeConfigUtil; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.DeviceTypeConfigIdentifier; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.DeviceTypeManagerService; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.DeviceTypeConfiguration; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.exception.DeviceTypeConfigurationException; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/deployer/internal/DeviceTypeManagementServiceComponent.java b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/deployer/internal/DeviceTypeManagementServiceComponent.java index e1a8e560c1..6d5b0a7002 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/deployer/internal/DeviceTypeManagementServiceComponent.java +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/deployer/internal/DeviceTypeManagementServiceComponent.java @@ -21,34 +21,19 @@ package io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.int import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.service.component.ComponentContext; -import org.wso2.carbon.application.deployer.handler.AppDeploymentHandler; +import org.osgi.service.component.annotations.*; import org.wso2.carbon.ndatasource.core.DataSourceService; import org.wso2.carbon.registry.core.service.RegistryService; import org.wso2.carbon.utils.ConfigurationContextService; -/** - * @scr.component name="io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.internal.DeviceTypeManagementServiceComponent" - * immediate="true" - * @scr.reference name="config.context.service" - * interface="org.wso2.carbon.utils.ConfigurationContextService" - * cardinality="0..1" - * policy="dynamic" - * bind="setConfigurationContextService" - * unbind="unsetConfigurationContextService" - * @scr.reference name="registry.service" - * interface="org.wso2.carbon.registry.core.service.RegistryService" cardinality="0..1" - * policy="dynamic" bind="setRegistryService" unbind="unsetRegistryService" - * @scr.reference name="org.wso2.carbon.ndatasource" - * interface="org.wso2.carbon.ndatasource.core.DataSourceService" - * cardinality="1..1" - * policy="dynamic" - * bind="setDataSourceService" - * unbind="unsetDataSourceService" - */ +@Component( + name = "io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.internal.DeviceTypeManagementServiceComponent", + immediate = true) public class DeviceTypeManagementServiceComponent { private static final Log log = LogFactory.getLog(DeviceTypeManagementServiceComponent.class); + @Activate protected void activate(ComponentContext ctx) { if (log.isDebugEnabled()) { log.debug("Activating DeviceType Deployer Service Component"); @@ -56,13 +41,19 @@ public class DeviceTypeManagementServiceComponent { // ctx.getBundleContext().registerService(AppDeploymentHandler.class.getName(), new DeviceTypeCAppDeployer(), null); DeviceTypeManagementDataHolder.getInstance().setBundleContext(ctx.getBundleContext()); } - + @Deactivate protected void deactivate(ComponentContext ctx) { if (log.isDebugEnabled()) { log.debug("De-activating DeviceType Deployer Service Component"); } } + @Reference( + name = "configuration.context.service", + service = org.wso2.carbon.utils.ConfigurationContextService.class, + cardinality = ReferenceCardinality.OPTIONAL, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetConfigurationContextService") protected void setConfigurationContextService(ConfigurationContextService configurationContextService) { if (log.isDebugEnabled()) { log.debug("Setting ConfigurationContextService"); @@ -79,6 +70,12 @@ public class DeviceTypeManagementServiceComponent { DeviceTypeManagementDataHolder.getInstance().setConfigurationContextService(null); } + @Reference( + name = "registry.service", + service = org.wso2.carbon.registry.core.service.RegistryService.class, + cardinality = ReferenceCardinality.OPTIONAL, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRegistryService") protected void setRegistryService(RegistryService registryService) { if (log.isDebugEnabled()) { log.debug("RegistryService acquired"); @@ -90,6 +87,12 @@ public class DeviceTypeManagementServiceComponent { DeviceTypeManagementDataHolder.getInstance().setRegistryService(null); } + @Reference( + name = "datasource.service", + service = org.wso2.carbon.ndatasource.core.DataSourceService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetDataSourceService") protected void setDataSourceService(DataSourceService dataSourceService) { /* This is to avoid mobile device management component getting initialized before the underlying datasources are registered */ diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/deployer/util/DeviceTypeConfigUtil.java b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/deployer/util/DeviceTypeConfigUtil.java index 4a80afc085..e54ba0265e 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/deployer/util/DeviceTypeConfigUtil.java +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/deployer/util/DeviceTypeConfigUtil.java @@ -17,8 +17,8 @@ */ package io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.util; -import org.w3c.dom.Document; import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.exception.DeviceTypeConfigurationException; +import org.w3c.dom.Document; import javax.xml.XMLConstants; import javax.xml.parsers.DocumentBuilder; diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/deployer/DeviceTypeCAppDeployerTest.java b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/deployer/DeviceTypeCAppDeployerTest.java index ecdc8de691..f188c7af06 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/deployer/DeviceTypeCAppDeployerTest.java +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/deployer/DeviceTypeCAppDeployerTest.java @@ -18,7 +18,7 @@ package io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.DeviceTypeCAppDeployer; +import io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.util.DeviceTypePluginConstants; import org.apache.axis2.deployment.DeploymentException; import org.apache.axis2.engine.AxisConfiguration; import org.mockito.Mockito; @@ -29,8 +29,8 @@ import org.wso2.carbon.application.deployer.config.ApplicationConfiguration; import org.wso2.carbon.application.deployer.config.Artifact; import org.wso2.carbon.application.deployer.config.CappFile; import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.util.DeviceTypePluginConstants; import org.wso2.carbon.registry.core.exceptions.RegistryException; + import java.io.File; import java.io.IOException; import java.lang.reflect.Field; diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/deployer/DeviceTypePluginDeployerTest.java b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/deployer/DeviceTypePluginDeployerTest.java index f452e55b58..2766977aeb 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/deployer/DeviceTypePluginDeployerTest.java +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/deployer/DeviceTypePluginDeployerTest.java @@ -18,7 +18,7 @@ package io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.DeviceTypePluginDeployer; +import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.DeviceTypeConfigIdentifier; import org.apache.axis2.deployment.DeploymentException; import org.apache.axis2.deployment.repository.util.DeploymentFileData; import org.junit.Assert; @@ -27,8 +27,8 @@ import org.osgi.framework.ServiceRegistration; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.DeviceTypeConfigIdentifier; import org.wso2.carbon.registry.core.exceptions.RegistryException; + import java.io.File; import java.io.IOException; import java.lang.reflect.Field; diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger/pom.xml index 193be7eac9..f984260692 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.logger/pom.xml @@ -37,6 +37,10 @@ org.apache.maven.plugins maven-compiler-plugin + + 1.8 + 1.8 + org.apache.felix @@ -50,7 +54,7 @@ Entgra Logger Bundle io.entgra.device.mgt.core.device.mgt.extensions.logger, - org.apache.commons.logging + org.apache.commons.logging;version="[1.2,2)" io.entgra.device.mgt.core.device.mgt.extensions.logger.* @@ -66,7 +70,6 @@ org.ops4j.pax.logging pax-logging-api provided - diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/pom.xml index 9bbbbd9e24..a50c455f80 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/pom.xml @@ -31,9 +31,14 @@ bundle WSO2 Carbon - Pull Notification Provider Implementation WSO2 Carbon - Pull Notification Provider Implementation - http://wso2.org + https://entgra.io + + org.apache.felix + org.apache.felix.scr.ds-annotations + provided + io.entgra.device.mgt.core io.entgra.device.mgt.core.device.mgt.common @@ -42,14 +47,6 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.device.mgt.core - - org.eclipse.osgi - org.eclipse.osgi - - - org.eclipse.osgi - org.eclipse.osgi.services - io.entgra.device.mgt.core io.entgra.device.mgt.core.policy.mgt.core @@ -64,8 +61,12 @@ - org.apache.felix - maven-scr-plugin + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + org.apache.felix @@ -82,17 +83,17 @@ io.entgra.device.mgt.core.device.mgt.extensions.pull.notification.* - org.osgi.framework.*;version="${imp.package.version.osgi.framework}", - org.osgi.service.*;version="${imp.package.version.osgi.service}", - org.apache.commons.logging, - io.entgra.device.mgt.core.device.mgt.common.*, - io.entgra.device.mgt.core.device.mgt.core.service - io.entgra.device.mgt.core.policy.mgt.core.*, - io.entgra.device.mgt.core.policy.mgt.core, - com.google.gson, - io.entgra.device.mgt.core.device.mgt.core.service.*, - io.entgra.device.mgt.core.application.mgt.common.*, - io.entgra.device.mgt.core.application.mgt.common.services.* + com.google.gson;version="[2.9,3)", + io.entgra.device.mgt.core.application.mgt.common.exception;version="[5.0,6)", + io.entgra.device.mgt.core.application.mgt.common.services;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.operation.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.pull.notification;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.core.service;version="[5.0,6)", + io.entgra.device.mgt.core.policy.mgt.core;version="[5.0,6)", + org.apache.commons.logging;version="[1.2,2)", + org.osgi.service.*;version="${imp.package.version.osgi.service}" diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/pull/notification/PullNotificationSubscriberImpl.java b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/pull/notification/PullNotificationSubscriberImpl.java index 3967b5eed3..8826e8019d 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/pull/notification/PullNotificationSubscriberImpl.java +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/pull/notification/PullNotificationSubscriberImpl.java @@ -21,11 +21,9 @@ import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonParser; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationManagementException; -import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.application.mgt.common.services.ApplicationManager; +import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Operation; import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.OperationManagementException; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.ComplianceFeature; @@ -33,6 +31,8 @@ import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.PolicyComp import io.entgra.device.mgt.core.device.mgt.common.pull.notification.PullNotificationExecutionFailedException; import io.entgra.device.mgt.core.device.mgt.common.pull.notification.PullNotificationSubscriber; import io.entgra.device.mgt.core.device.mgt.extensions.pull.notification.internal.PullNotificationDataHolder; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.util.ArrayList; import java.util.List; diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/pull/notification/internal/PullNotificationServiceComponent.java b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/pull/notification/internal/PullNotificationServiceComponent.java index 5a44909555..924c4c6633 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/pull/notification/internal/PullNotificationServiceComponent.java +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.pull.notification/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/pull/notification/internal/PullNotificationServiceComponent.java @@ -17,39 +17,23 @@ */ package io.entgra.device.mgt.core.device.mgt.extensions.pull.notification.internal; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.osgi.service.component.ComponentContext; import io.entgra.device.mgt.core.application.mgt.common.services.ApplicationManager; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; import io.entgra.device.mgt.core.policy.mgt.core.PolicyManagerService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.*; -/** - * @scr.component name="io.entgra.device.mgt.core.device.mgt.extensions.pull.notification.internal.PullNotificationServiceComponent" immediate="true" - * @scr.reference name="carbon.device.mgt.provider" - * interface="io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService" - * cardinality="1..1" - * policy="dynamic" - * bind="setDeviceManagementProviderService" - * unbind="unsetDeviceManagementProviderService" - * @scr.reference name="io.entgra.device.mgt.core.policy.mgt.core" - * interface="io.entgra.device.mgt.core.policy.mgt.core.PolicyManagerService" - * cardinality="1..1" - * policy="dynamic" - * bind="setPolicyManagerService" - * unbind="unsetPolicyManagerService" - * @scr.reference name="org.wso2.carbon.application.mgt.service" - * interface="io.entgra.device.mgt.core.application.mgt.common.services.ApplicationManager" - * cardinality="1..1" - * policy="dynamic" - * bind="setApplicationManagerService" - * unbind="unsetApplicationManagerService" - */ +@Component( + name = "io.entgra.device.mgt.core.device.mgt.extensions.pull.notification.internal.PullNotificationServiceComponent", + immediate = true) public class PullNotificationServiceComponent { private static final Log log = LogFactory.getLog(PullNotificationServiceComponent.class); @SuppressWarnings("unused") + @Activate protected void activate(ComponentContext componentContext) { try { //Do nothing @@ -62,11 +46,17 @@ public class PullNotificationServiceComponent { "implementation bundle", e); } } - + @Deactivate protected void deactivate(ComponentContext componentContext) { //Do nothing } + @Reference( + name = "device.mgt.provider.service", + service = io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetDeviceManagementProviderService") protected void setDeviceManagementProviderService(DeviceManagementProviderService deviceManagementProviderService) { PullNotificationDataHolder.getInstance().setDeviceManagementProviderService(deviceManagementProviderService); } @@ -75,6 +65,12 @@ public class PullNotificationServiceComponent { PullNotificationDataHolder.getInstance().setDeviceManagementProviderService(null); } + @Reference( + name = "policy.mgr.service", + service = io.entgra.device.mgt.core.policy.mgt.core.PolicyManagerService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetPolicyManagerService") protected void setPolicyManagerService(PolicyManagerService policyManagerService) { PullNotificationDataHolder.getInstance().setPolicyManagerService(policyManagerService); } @@ -83,6 +79,12 @@ public class PullNotificationServiceComponent { PullNotificationDataHolder.getInstance().setPolicyManagerService(null); } + @Reference( + name = "applcation.mgr", + service = io.entgra.device.mgt.core.application.mgt.common.services.ApplicationManager.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetApplicationManagerService") protected void setApplicationManagerService(ApplicationManager applicationManagerService){ PullNotificationDataHolder.getInstance().setApplicationManager(applicationManagerService); } diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml index 623573aa5d..c357cd7566 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/pom.xml @@ -31,9 +31,14 @@ bundle WSO2 Carbon - FCM Based Push Notification Provider Implementation WSO2 Carbon - FCM Based Push Notification Provider Implementation - http://wso2.org + https://entgra.io + + org.apache.felix + org.apache.felix.scr.ds-annotations + provided + org.wso2.carbon.governance org.wso2.carbon.governance.api @@ -63,17 +68,9 @@ org.wso2.carbon.utils - org.wso2.orbit.org.scannotation + io.entgra.org.scannotation scannotation - - org.eclipse.osgi - org.eclipse.osgi - - - org.eclipse.osgi - org.eclipse.osgi.services - org.wso2.tomcat tomcat @@ -116,8 +113,12 @@ - org.apache.felix - maven-scr-plugin + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + org.apache.felix @@ -134,14 +135,14 @@ io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.* - com.google.gson, - org.osgi.framework.*;version="${imp.package.version.osgi.framework}", - org.osgi.service.*;version="${imp.package.version.osgi.service}", - io.entgra.device.mgt.core.device.mgt.common.operation.mgt, - io.entgra.device.mgt.core.device.mgt.common.push.notification, - org.apache.commons.logging, - io.entgra.device.mgt.core.device.mgt.common.*, - io.entgra.device.mgt.core.device.mgt.core.service + com.google.gson;version="[2.9,3)", + io.entgra.device.mgt.core.device.mgt.common;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.exceptions;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.operation.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.push.notification;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.core.service;version="[5.0,6)", + org.apache.commons.logging;version="[1.2,2)", + org.osgi.service.*;version="${imp.package.version.osgi.service}" diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/fcm/FCMNotificationStrategy.java b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/fcm/FCMNotificationStrategy.java index c6100aa418..72da99f53c 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/fcm/FCMNotificationStrategy.java +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/fcm/FCMNotificationStrategy.java @@ -20,8 +20,6 @@ package io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provid import com.google.gson.JsonArray; import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.common.push.notification.NotificationContext; @@ -29,6 +27,8 @@ import io.entgra.device.mgt.core.device.mgt.common.push.notification.Notificatio import io.entgra.device.mgt.core.device.mgt.common.push.notification.PushNotificationConfig; import io.entgra.device.mgt.core.device.mgt.common.push.notification.PushNotificationExecutionFailedException; import io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.internal.FCMDataHolder; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.io.IOException; import java.io.OutputStream; diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/fcm/internal/FCMPushNotificationServiceComponent.java b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/fcm/internal/FCMPushNotificationServiceComponent.java index c6ae0128a9..203b1f0cd4 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/fcm/internal/FCMPushNotificationServiceComponent.java +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/fcm/internal/FCMPushNotificationServiceComponent.java @@ -17,25 +17,21 @@ */ package io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.internal; +import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.service.component.ComponentContext; -import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; +import org.osgi.service.component.annotations.*; -/** - * @scr.component name="io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.internal.FCMPushNotificationServiceComponent" immediate="true" - * @scr.reference name="carbon.device.mgt.provider" - * interface="io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService" - * cardinality="1..1" - * policy="dynamic" - * bind="setDeviceManagementProviderService" - * unbind="unsetDeviceManagementProviderService" - */ +@Component( + name = "io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.internal.FCMPushNotificationServiceComponent", + immediate = true) public class FCMPushNotificationServiceComponent { private static final Log log = LogFactory.getLog(FCMPushNotificationServiceComponent.class); @SuppressWarnings("unused") + @Activate protected void activate(ComponentContext componentContext) { try { //Do nothing @@ -48,11 +44,16 @@ public class FCMPushNotificationServiceComponent { "implementation bundle", e); } } - + @Deactivate protected void deactivate(ComponentContext componentContext) { //Do nothing } - + @Reference( + name = "device.mgt.provider.service", + service = io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetDeviceManagementProviderService") protected void setDeviceManagementProviderService( DeviceManagementProviderService deviceManagementProviderService) { FCMDataHolder.getInstance().setDeviceManagementProviderService(deviceManagementProviderService); diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml index 3ee7d9db36..17a7c4b6ff 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/pom.xml @@ -31,9 +31,14 @@ bundle WSO2 Carbon - HTTP Based Push Notification Provider Implementation WSO2 Carbon - HTTP Based Push Notification Provider Implementation - http://wso2.org + https://entgra.io + + org.apache.felix + org.apache.felix.scr.ds-annotations + provided + org.wso2.carbon.governance org.wso2.carbon.governance.api @@ -63,17 +68,9 @@ org.wso2.carbon.utils - org.wso2.orbit.org.scannotation + io.entgra.org.scannotation scannotation - - org.eclipse.osgi - org.eclipse.osgi - - - org.eclipse.osgi - org.eclipse.osgi.services - org.wso2.tomcat tomcat @@ -107,8 +104,12 @@ - org.apache.felix - maven-scr-plugin + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + org.apache.felix @@ -125,18 +126,13 @@ io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.* - org.apache.commons.logging, - org.osgi.framework.*;version="${imp.package.version.osgi.framework}", - org.osgi.service.*;version="${imp.package.version.osgi.service}", - org.wso2.carbon.context, - io.entgra.device.mgt.core.device.mgt.common.operation.mgt, - io.entgra.device.mgt.core.device.mgt.common.push.notification, - io.entgra.device.mgt.core.device.mgt.common, - io.entgra.device.mgt.core.device.mgt.core.service, - io.entgra.device.mgt.core.device.mgt.core.operation.mgt, - org.wso2.carbon.core, - com.google.gson, - org.apache.commons.httpclient.* + com.google.gson;version="[2.9,3)", + io.entgra.device.mgt.core.device.mgt.common.exceptions;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.push.notification;version="[5.0,6)", + org.apache.commons.httpclient;version="[3.1,4)", + org.apache.commons.httpclient.methods;version="[3.1,4)", + org.apache.commons.logging;version="[1.2,2)", + org.osgi.service.*;version="${imp.package.version.osgi.service}" diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/http/HTTPMessageExecutor.java b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/http/HTTPMessageExecutor.java index 3122e727a7..7acf8c42f1 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/http/HTTPMessageExecutor.java +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/http/HTTPMessageExecutor.java @@ -19,6 +19,8 @@ package io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http; import com.google.gson.Gson; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.InvalidConfigurationException; +import io.entgra.device.mgt.core.device.mgt.common.push.notification.NotificationContext; import org.apache.commons.httpclient.HostConfiguration; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.methods.EntityEnclosingMethod; @@ -26,8 +28,6 @@ import org.apache.commons.httpclient.methods.PostMethod; import org.apache.commons.httpclient.methods.StringRequestEntity; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.InvalidConfigurationException; -import io.entgra.device.mgt.core.device.mgt.common.push.notification.NotificationContext; import java.net.UnknownHostException; diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/http/HTTPNotificationStrategy.java b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/http/HTTPNotificationStrategy.java index 5d9ec3bb98..79c7eea49a 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/http/HTTPNotificationStrategy.java +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/http/HTTPNotificationStrategy.java @@ -17,15 +17,15 @@ */ package io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http; -import org.apache.commons.httpclient.HostConfiguration; -import org.apache.commons.httpclient.HttpClient; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.exceptions.InvalidConfigurationException; import io.entgra.device.mgt.core.device.mgt.common.push.notification.NotificationContext; import io.entgra.device.mgt.core.device.mgt.common.push.notification.NotificationStrategy; import io.entgra.device.mgt.core.device.mgt.common.push.notification.PushNotificationConfig; import io.entgra.device.mgt.core.device.mgt.common.push.notification.PushNotificationExecutionFailedException; +import org.apache.commons.httpclient.HostConfiguration; +import org.apache.commons.httpclient.HttpClient; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.net.MalformedURLException; import java.net.URL; diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/http/internal/HTTPPushNotificationServiceComponent.java b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/http/internal/HTTPPushNotificationServiceComponent.java index 4a6dde580c..54e24395b1 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/http/internal/HTTPPushNotificationServiceComponent.java +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/http/internal/HTTPPushNotificationServiceComponent.java @@ -20,15 +20,17 @@ package io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provid import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.service.component.ComponentContext; - -/** - * @scr.component name="io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.internal.HTTPPushNotificationServiceComponent" immediate="true" - */ +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +@Component( + name = "io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.internal.HTTPPushNotificationServiceComponent", + immediate = true) public class HTTPPushNotificationServiceComponent { private static final Log log = LogFactory.getLog(HTTPPushNotificationServiceComponent.class); @SuppressWarnings("unused") + @Activate protected void activate(ComponentContext componentContext) { try { if (log.isDebugEnabled()) { diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml index 5a8d0aef90..ed434c7873 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/pom.xml @@ -31,9 +31,14 @@ bundle WSO2 Carbon - MQTT Based Push Notification Provider Implementation WSO2 Carbon - MQTT Based Push Notification Provider Implementation - http://wso2.org + https://entgra.io + + org.apache.felix + org.apache.felix.scr.ds-annotations + provided + org.wso2.carbon.governance org.wso2.carbon.governance.api @@ -63,17 +68,9 @@ org.wso2.carbon.utils - org.wso2.orbit.org.scannotation + io.entgra.org.scannotation scannotation - - org.eclipse.osgi - org.eclipse.osgi - - - org.eclipse.osgi - org.eclipse.osgi.services - org.wso2.tomcat tomcat @@ -129,8 +126,12 @@ - org.apache.felix - maven-scr-plugin + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + org.apache.felix @@ -147,21 +148,17 @@ io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.* - org.apache.commons.logging, - org.osgi.framework.*;version="${imp.package.version.osgi.framework}", + io.entgra.device.mgt.core.device.mgt.common;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.exceptions;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.operation.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.push.notification;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.core.operation.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.core.service;version="[5.0,6)", + org.apache.commons.logging;version="[1.2,2)", org.osgi.service.*;version="${imp.package.version.osgi.service}", - org.wso2.carbon.context, - io.entgra.device.mgt.core.device.mgt.common.operation.mgt, - io.entgra.device.mgt.core.device.mgt.common.push.notification, - io.entgra.device.mgt.core.device.mgt.common, - io.entgra.device.mgt.core.device.mgt.common.exceptions, - io.entgra.device.mgt.core.device.mgt.core.service, - org.wso2.carbon.event.output.adapter.core, - org.wso2.carbon.event.output.adapter.core.exception, - io.entgra.device.mgt.core.device.mgt.core.operation.mgt, - org.wso2.carbon.core, - io.entgra.device.mgt.core.application.mgt.common.*, - io.entgra.device.mgt.core.application.mgt.common.services.* + org.wso2.carbon.context;version="[4.8,5)", + org.wso2.carbon.event.output.adapter.core;version="[5.3,6)", + org.wso2.carbon.event.output.adapter.core.exception;version="[5.3,6)" diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/mqtt/MQTTNotificationStrategy.java b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/mqtt/MQTTNotificationStrategy.java index e1128f6d8c..8d97facb6b 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/mqtt/MQTTNotificationStrategy.java +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/mqtt/MQTTNotificationStrategy.java @@ -17,22 +17,22 @@ */ package io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.exceptions.InvalidConfigurationException; import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Operation; import io.entgra.device.mgt.core.device.mgt.common.push.notification.NotificationContext; import io.entgra.device.mgt.core.device.mgt.common.push.notification.NotificationStrategy; import io.entgra.device.mgt.core.device.mgt.common.push.notification.PushNotificationConfig; import io.entgra.device.mgt.core.device.mgt.common.push.notification.PushNotificationExecutionFailedException; +import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.PolicyOperation; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.ProfileOperation; import io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.internal.MQTTDataHolder; import io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.internal.util.MQTTAdapterConstants; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.event.output.adapter.core.MessageType; import org.wso2.carbon.event.output.adapter.core.OutputEventAdapterConfiguration; import org.wso2.carbon.event.output.adapter.core.exception.OutputEventAdapterException; -import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.PolicyOperation; import java.util.HashMap; import java.util.List; diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/mqtt/internal/MQTTDataHolder.java b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/mqtt/internal/MQTTDataHolder.java index df2de21783..27124a0949 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/mqtt/internal/MQTTDataHolder.java +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/mqtt/internal/MQTTDataHolder.java @@ -18,7 +18,6 @@ package io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.internal; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; -import org.wso2.carbon.event.output.adapter.core.OutputEventAdapterConfiguration; import org.wso2.carbon.event.output.adapter.core.OutputEventAdapterService; public class MQTTDataHolder { diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/mqtt/internal/MQTTPushNotificationServiceComponent.java b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/mqtt/internal/MQTTPushNotificationServiceComponent.java index cc8215ceaf..1f4413fba8 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/mqtt/internal/MQTTPushNotificationServiceComponent.java +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/mqtt/internal/MQTTPushNotificationServiceComponent.java @@ -17,32 +17,22 @@ */ package io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.internal; +import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.service.component.ComponentContext; -import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; +import org.osgi.service.component.annotations.*; import org.wso2.carbon.event.output.adapter.core.OutputEventAdapterService; -/** - * @scr.component name="io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.internal.MQTTPushNotificationServiceComponent" immediate="true" - * @scr.reference name="carbon.device.mgt.provider" - * interface="io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService" - * cardinality="1..1" - * policy="dynamic" - * bind="setDeviceManagementProviderService" - * unbind="unsetDeviceManagementProviderService" - * @scr.reference name="event.output.adapter.service" - * interface="org.wso2.carbon.event.output.adapter.core.OutputEventAdapterService" - * cardinality="1..1" - * policy="dynamic" - * bind="setOutputEventAdapterService" - * unbind="unsetOutputEventAdapterService" - */ +@Component( + name = "io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.internal.MQTTPushNotificationServiceComponent", + immediate = true) public class MQTTPushNotificationServiceComponent { private static final Log log = LogFactory.getLog(MQTTPushNotificationServiceComponent.class); @SuppressWarnings("unused") + @Activate protected void activate(ComponentContext componentContext) { try { if (log.isDebugEnabled()) { @@ -58,11 +48,17 @@ public class MQTTPushNotificationServiceComponent { "implementation bundle", e); } } - + @Deactivate protected void deactivate(ComponentContext componentContext) { //Do nothing } + @Reference( + name = "device.mgt.provider.service", + service = io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetDeviceManagementProviderService") protected void setDeviceManagementProviderService( DeviceManagementProviderService deviceManagementProviderService) { MQTTDataHolder.getInstance().setDeviceManagementProviderService(deviceManagementProviderService); @@ -73,6 +69,12 @@ public class MQTTPushNotificationServiceComponent { MQTTDataHolder.getInstance().setDeviceManagementProviderService(deviceManagementProviderService); } + @Reference( + name = "output.event.adaptor.service", + service = org.wso2.carbon.event.output.adapter.core.OutputEventAdapterService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetOutputEventAdapterService") protected void setOutputEventAdapterService(OutputEventAdapterService outputEventAdapterService){ MQTTDataHolder.getInstance().setOutputEventAdapterService(outputEventAdapterService); } diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/mqtt/MQTTBasedPushNotificationProviderTest.java b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/mqtt/MQTTBasedPushNotificationProviderTest.java index 6f85027688..c819f7dd6f 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/mqtt/MQTTBasedPushNotificationProviderTest.java +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/mqtt/MQTTBasedPushNotificationProviderTest.java @@ -18,15 +18,14 @@ package io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt; -import org.mockito.Mockito; -import org.testng.Assert; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.push.notification.NotificationStrategy; import io.entgra.device.mgt.core.device.mgt.common.push.notification.PushNotificationConfig; import io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.internal.MQTTDataHolder; import io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.internal.util.MQTTAdapterConstants; +import org.mockito.Mockito; +import org.testng.Assert; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; import org.wso2.carbon.event.output.adapter.core.exception.OutputEventAdapterException; import org.wso2.carbon.event.output.adapter.core.internal.CarbonOutputEventAdapterService; import org.wso2.carbon.registry.core.exceptions.RegistryException; diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/mqtt/MQTTNotificationStrategyTest.java b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/mqtt/MQTTNotificationStrategyTest.java index 164f453157..e32c6af108 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/mqtt/MQTTNotificationStrategyTest.java +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/mqtt/MQTTNotificationStrategyTest.java @@ -18,12 +18,8 @@ package io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt; -import org.mockito.Mockito; -import org.testng.Assert; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; +import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Operation; import io.entgra.device.mgt.core.device.mgt.common.push.notification.NotificationContext; import io.entgra.device.mgt.core.device.mgt.common.push.notification.PushNotificationConfig; import io.entgra.device.mgt.core.device.mgt.common.push.notification.PushNotificationExecutionFailedException; @@ -31,19 +27,19 @@ import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.PolicyOperation; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.ProfileOperation; import io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.internal.MQTTDataHolder; import io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.internal.util.MQTTAdapterConstants; +import org.mockito.Mockito; +import org.testng.Assert; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; import org.wso2.carbon.event.output.adapter.core.exception.OutputEventAdapterException; import org.wso2.carbon.event.output.adapter.core.internal.CarbonOutputEventAdapterService; import org.wso2.carbon.registry.core.exceptions.RegistryException; -import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Operation; -import static io.entgra.device.mgt.core.device.mgt.core.operation.mgt.PolicyOperation.POLICY_OPERATION_CODE; import java.io.IOException; import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Properties; +import java.util.*; + +import static io.entgra.device.mgt.core.device.mgt.core.operation.mgt.PolicyOperation.POLICY_OPERATION_CODE; /* Unit tests for MQTTNotificationStrategy class diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml index 57f2b5362c..6291d849a5 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/pom.xml @@ -31,9 +31,14 @@ bundle WSO2 Carbon - XMPP Based Push Notification Provider Implementation WSO2 Carbon - XMPP Based Push Notification Provider Implementation - http://wso2.org + https://entgra.io + + org.apache.felix + org.apache.felix.scr.ds-annotations + provided + org.wso2.carbon.governance org.wso2.carbon.governance.api @@ -63,17 +68,9 @@ org.wso2.carbon.utils - org.wso2.orbit.org.scannotation + io.entgra.org.scannotation scannotation - - org.eclipse.osgi - org.eclipse.osgi - - - org.eclipse.osgi - org.eclipse.osgi.services - org.wso2.tomcat tomcat @@ -116,8 +113,12 @@ - org.apache.felix - maven-scr-plugin + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + org.apache.felix @@ -134,17 +135,15 @@ io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.* - org.apache.commons.logging, - org.osgi.framework.*;version="${imp.package.version.osgi.framework}", + io.entgra.device.mgt.core.device.mgt.common;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.exceptions;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.operation.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.push.notification;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.core.service;version="[5.0,6)", + org.apache.commons.logging;version="[1.2,2)", org.osgi.service.*;version="${imp.package.version.osgi.service}", - org.wso2.carbon.context, - io.entgra.device.mgt.core.device.mgt.common.operation.mgt, - io.entgra.device.mgt.core.device.mgt.common.push.notification, - io.entgra.device.mgt.core.device.mgt.core.*, - org.wso2.carbon.event.output.adapter.core, - org.wso2.carbon.event.output.adapter.core.exception, - org.wso2.carbon.core, - io.entgra.device.mgt.core.device.mgt.common.* + org.wso2.carbon.event.output.adapter.core;version="[5.3,6)", + org.wso2.carbon.event.output.adapter.core.exception;version="[5.3,6)" diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/xmpp/XMPPNotificationStrategy.java b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/xmpp/XMPPNotificationStrategy.java index 597789dd36..4e5dcde5bf 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/xmpp/XMPPNotificationStrategy.java +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/xmpp/XMPPNotificationStrategy.java @@ -17,8 +17,6 @@ */ package io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.exceptions.InvalidConfigurationException; import io.entgra.device.mgt.core.device.mgt.common.push.notification.NotificationContext; import io.entgra.device.mgt.core.device.mgt.common.push.notification.NotificationStrategy; @@ -26,6 +24,8 @@ import io.entgra.device.mgt.core.device.mgt.common.push.notification.PushNotific import io.entgra.device.mgt.core.device.mgt.common.push.notification.PushNotificationExecutionFailedException; import io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.internal.XMPPDataHolder; import io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.internal.util.XMPPAdapterConstants; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.wso2.carbon.event.output.adapter.core.MessageType; import org.wso2.carbon.event.output.adapter.core.OutputEventAdapterConfiguration; import org.wso2.carbon.event.output.adapter.core.exception.OutputEventAdapterException; diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/xmpp/internal/XMPPPushNotificationServiceComponent.java b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/xmpp/internal/XMPPPushNotificationServiceComponent.java index 3a509d03ae..035fa40369 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/xmpp/internal/XMPPPushNotificationServiceComponent.java +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/push/notification/provider/xmpp/internal/XMPPPushNotificationServiceComponent.java @@ -17,32 +17,22 @@ */ package io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.internal; +import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.service.component.ComponentContext; -import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; +import org.osgi.service.component.annotations.*; import org.wso2.carbon.event.output.adapter.core.OutputEventAdapterService; -/** - * @scr.component name="io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.internal.XMPPPushNotificationServiceComponent" immediate="true" - * @scr.reference name="carbon.device.mgt.provider" - * interface="io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService" - * cardinality="1..1" - * policy="dynamic" - * bind="setDeviceManagementProviderService" - * unbind="unsetDeviceManagementProviderService" - * @scr.reference name="event.output.adapter.service" - * interface="org.wso2.carbon.event.output.adapter.core.OutputEventAdapterService" - * cardinality="1..1" - * policy="dynamic" - * bind="setOutputEventAdapterService" - * unbind="unsetOutputEventAdapterService" - */ +@Component( + name = "io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.internal.XMPPPushNotificationServiceComponent", + immediate = true) public class XMPPPushNotificationServiceComponent { private static final Log log = LogFactory.getLog(XMPPPushNotificationServiceComponent.class); @SuppressWarnings("unused") + @Activate protected void activate(ComponentContext componentContext) { try { if (log.isDebugEnabled()) { @@ -58,11 +48,17 @@ public class XMPPPushNotificationServiceComponent { "implementation bundle", e); } } - + @Deactivate protected void deactivate(ComponentContext componentContext) { //Do nothing } + @Reference( + name = "device.mgt.provider.service", + service = io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetDeviceManagementProviderService") protected void setDeviceManagementProviderService( DeviceManagementProviderService deviceManagementProviderService) { XMPPDataHolder.getInstance().setDeviceManagementProviderService(deviceManagementProviderService); @@ -73,6 +69,12 @@ public class XMPPPushNotificationServiceComponent { XMPPDataHolder.getInstance().setDeviceManagementProviderService(deviceManagementProviderService); } + @Reference( + name = "output.event.adaptor.service", + service = org.wso2.carbon.event.output.adapter.core.OutputEventAdapterService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetOutputEventAdapterService") protected void setOutputEventAdapterService(OutputEventAdapterService outputEventAdapterService){ XMPPDataHolder.getInstance().setOutputEventAdapterService(outputEventAdapterService); } diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/pom.xml b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/pom.xml index 41c258eb2c..cab0ec4896 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/pom.xml +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/pom.xml @@ -38,10 +38,10 @@ org.apache.maven.plugins maven-compiler-plugin - - - org.apache.felix - maven-scr-plugin + + 1.8 + 1.8 + org.apache.felix @@ -54,13 +54,13 @@ ${io.entgra.device.mgt.core.version} IoT Device Management State Engine Bundle - org.wso2.carbon.context, - org.wso2.carbon.logging, - org.apache.commons.lang, - org.wso2.carbon.user.api, - org.apache.commons.logging, - org.wso2.carbon.user.core.service, - io.entgra.device.mgt.core.device.mgt.common.* + io.entgra.device.mgt.core.device.mgt.common;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.extensions.stateengine.dto, + io.entgra.device.mgt.core.device.mgt.extensions.stateengine.exception, + org.apache.commons.logging;version="[1.2,2)", + org.wso2.carbon.context;version="[4.8,5)", + org.wso2.carbon.user.api;version="[1.0,2)", + org.wso2.carbon.user.core.service;version="[4.8,5)" io.entgra.device.mgt.core.device.mgt.extensions.stateengine.*, @@ -99,11 +99,15 @@ + + org.apache.felix + org.apache.felix.scr.ds-annotations + provided + org.ops4j.pax.logging pax-logging-api provided - com.google.code.gson diff --git a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/stateengine/spi/DeviceStateMachine.java b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/stateengine/spi/DeviceStateMachine.java index caca232a9b..a9dbd4edd9 100644 --- a/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/stateengine/spi/DeviceStateMachine.java +++ b/components/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.stateengine/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/stateengine/spi/DeviceStateMachine.java @@ -18,10 +18,10 @@ package io.entgra.device.mgt.core.device.mgt.extensions.stateengine.spi; -import io.entgra.device.mgt.core.device.mgt.extensions.stateengine.dto.StateUpdateResult; -import io.entgra.device.mgt.core.device.mgt.extensions.stateengine.exception.StateValidationException; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; +import io.entgra.device.mgt.core.device.mgt.extensions.stateengine.dto.StateUpdateResult; +import io.entgra.device.mgt.core.device.mgt.extensions.stateengine.exception.StateValidationException; public interface DeviceStateMachine { diff --git a/components/device-mgt-extensions/pom.xml b/components/device-mgt-extensions/pom.xml index 5e6269373b..c6914f5733 100644 --- a/components/device-mgt-extensions/pom.xml +++ b/components/device-mgt-extensions/pom.xml @@ -31,7 +31,7 @@ pom WSO2 Carbon - Device Management Extensions WSO2 Carbon - Device Management Extensions - http://wso2.org + https://entgra.io io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml index 1796d11022..09ac87fdb8 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/pom.xml @@ -31,7 +31,7 @@ war WSO2 Carbon - Mobile Device Management API WSO2 Carbon - Mobile Device Management API - http://wso2.org + https://entgra.io @@ -151,18 +151,6 @@ spring-web provided - - org.apache.cxf.wso2 - cxf-bundle - - - - - - - - - org.apache.cxf cxf-bundle-jaxrs @@ -197,7 +185,6 @@ org.ops4j.pax.logging pax-logging-api provided - io.entgra.device.mgt.core @@ -294,10 +281,6 @@ org.slf4j slf4j-api - - org.wso2.orbit.com.fasterxml.jackson.core - jackson-core - @@ -312,10 +295,6 @@ org.slf4j slf4j-api - - org.wso2.orbit.com.fasterxml.jackson.core - jackson-core - @@ -328,29 +307,10 @@ io.entgra.device.mgt.core.apimgt.annotations provided - - org.wso2.orbit.com.fasterxml.jackson.core - jackson-annotations - org.hibernate hibernate-validator - - javax.ws.rs - javax.ws.rs-api - provided - - - javax.ws.rs - jsr311-api - provided - - - org.wso2.carbon.commons - org.wso2.carbon.application.mgt.stub - provided - org.wso2.carbon.analytics org.wso2.carbon.analytics.api @@ -377,11 +337,6 @@ ${carbon.identity.framework.version} provided - - - - - org.wso2.carbon.analytics-common org.wso2.carbon.event.receiver.stub diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/NotificationContext.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/NotificationContext.java index 18e2d43a7e..80c9aba849 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/NotificationContext.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/NotificationContext.java @@ -18,10 +18,10 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs; import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.notification.mgt.Notification; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; @ApiModel(value = "NotificationContext") public class NotificationContext { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/NotificationList.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/NotificationList.java index 4753d0ed6f..853b08a27c 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/NotificationList.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/NotificationList.java @@ -18,9 +18,9 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs; import com.fasterxml.jackson.annotation.JsonProperty; +import io.entgra.device.mgt.core.device.mgt.common.notification.mgt.Notification; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import io.entgra.device.mgt.core.device.mgt.common.notification.mgt.Notification; import java.util.ArrayList; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/ActivityList.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/ActivityList.java index e4a9fce702..ede2a22bbf 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/ActivityList.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/ActivityList.java @@ -19,9 +19,9 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.gson.Gson; +import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Activity; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Activity; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/ApplicationList.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/ApplicationList.java index b57f0ba437..38338f0a8c 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/ApplicationList.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/ApplicationList.java @@ -19,8 +19,8 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans; import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModelProperty; import io.entgra.device.mgt.core.device.mgt.common.app.mgt.Application; +import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/ApplicationWrapper.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/ApplicationWrapper.java index 58177319fc..6aca491d71 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/ApplicationWrapper.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/ApplicationWrapper.java @@ -18,10 +18,10 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.app.mgt.App; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/AuthorizationRequest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/AuthorizationRequest.java index c4e4d0cfa3..bb5c00a12f 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/AuthorizationRequest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/AuthorizationRequest.java @@ -17,9 +17,9 @@ */ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans; +import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/ComplianceDeviceList.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/ComplianceDeviceList.java index 65b823ea61..4712cbedbf 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/ComplianceDeviceList.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/ComplianceDeviceList.java @@ -19,8 +19,8 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans; import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModelProperty; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.ComplianceData; +import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/Credential.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/Credential.java index ef827e26a1..c919d194a0 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/Credential.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/Credential.java @@ -17,11 +17,11 @@ */ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.exception.BadRequestException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.HttpStatus; import org.apache.http.util.TextUtils; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.exception.BadRequestException; public class Credential { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/DeviceCompliance.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/DeviceCompliance.java index 5b6cd49472..26ed612cc2 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/DeviceCompliance.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/DeviceCompliance.java @@ -17,8 +17,8 @@ */ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans; -import io.swagger.annotations.ApiModel; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.NonComplianceData; +import io.swagger.annotations.ApiModel; @ApiModel(value = "DeviceCompliance", description = "Device's policy compliance status") public class DeviceCompliance { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/DeviceConfig.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/DeviceConfig.java index 60b657a1f1..b373dc749d 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/DeviceConfig.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/DeviceConfig.java @@ -17,10 +17,8 @@ */ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans; -import io.swagger.annotations.ApiModel; import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.PlatformConfiguration; - -import java.util.List; +import io.swagger.annotations.ApiModel; @ApiModel(value = "DeviceConfig", description = "Device config") public class DeviceConfig { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/DeviceList.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/DeviceList.java index 7b3e084276..165605ae90 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/DeviceList.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/DeviceList.java @@ -18,8 +18,8 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans; import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModelProperty; import io.entgra.device.mgt.core.device.mgt.common.Device; +import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/DeviceToGroupsAssignment.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/DeviceToGroupsAssignment.java index ef70a0e371..4af0630d8e 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/DeviceToGroupsAssignment.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/DeviceToGroupsAssignment.java @@ -18,9 +18,8 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans; import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModelProperty; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.BasePaginatedResult; +import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/DeviceTypeList.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/DeviceTypeList.java index 39a604fda1..a453dea045 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/DeviceTypeList.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/DeviceTypeList.java @@ -19,7 +19,6 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans; import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.annotations.ApiModelProperty; -import io.entgra.device.mgt.core.device.mgt.common.Device; import java.util.ArrayList; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/MetadataList.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/MetadataList.java index f69fcc259e..44e707212e 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/MetadataList.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/MetadataList.java @@ -18,9 +18,9 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans; import com.fasterxml.jackson.annotation.JsonProperty; +import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.Metadata; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.Metadata; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/NotificationList.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/NotificationList.java index 366733b8b0..05aed976f0 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/NotificationList.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/NotificationList.java @@ -18,9 +18,9 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans; import com.fasterxml.jackson.annotation.JsonProperty; +import io.entgra.device.mgt.core.device.mgt.common.notification.mgt.Notification; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import io.entgra.device.mgt.core.device.mgt.common.notification.mgt.Notification; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/OperationList.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/OperationList.java index 54f41972e8..707cee812a 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/OperationList.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/OperationList.java @@ -18,8 +18,8 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans; import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModelProperty; import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Operation; +import io.swagger.annotations.ApiModelProperty; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/OperationRequest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/OperationRequest.java index 8c9be6f0ed..606dfda252 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/OperationRequest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/OperationRequest.java @@ -17,9 +17,9 @@ */ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans; +import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Operation; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Operation; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/PermissionList.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/PermissionList.java index 06a938cd3f..86f849f8e4 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/PermissionList.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/PermissionList.java @@ -21,6 +21,7 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans; import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; + import java.io.Serializable; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/PolicyList.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/PolicyList.java index 0d98688257..ecf93f3b51 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/PolicyList.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/PolicyList.java @@ -18,9 +18,9 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans; import com.fasterxml.jackson.annotation.JsonProperty; +import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Policy; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Policy; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/PolicyWrapper.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/PolicyWrapper.java index 206590fb0a..8db782b8c0 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/PolicyWrapper.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/PolicyWrapper.java @@ -18,11 +18,11 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.CorrectiveAction; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.DeviceGroupWrapper; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/ProfileFeature.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/ProfileFeature.java index 571619d591..99da050099 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/ProfileFeature.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/ProfileFeature.java @@ -19,9 +19,9 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans; import com.google.gson.Gson; +import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.CorrectiveAction; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.CorrectiveAction; import java.io.Serializable; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/RemoteSessionInfo.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/RemoteSessionInfo.java index 4c5400989a..ef6f71b989 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/RemoteSessionInfo.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/RemoteSessionInfo.java @@ -17,12 +17,8 @@ */ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans; -import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Operation; - -import java.util.List; @ApiModel(value = "RemoteSessionInfo", description = "Template of the remote session") public class RemoteSessionInfo { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/RoleInfo.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/RoleInfo.java index 3ad90c07a6..c67634446d 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/RoleInfo.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/RoleInfo.java @@ -22,8 +22,6 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.wso2.carbon.user.mgt.common.UIPermissionNode; -import java.util.List; - @ApiModel(value = "RoleInfo", description = "Role details including permission and the users in the roles are " + "wrapped here.") public class RoleInfo { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/analytics/AdapterConfiguration.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/analytics/AdapterConfiguration.java index 0e2c2a564a..9df6824c8e 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/analytics/AdapterConfiguration.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/analytics/AdapterConfiguration.java @@ -18,7 +18,7 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.analytics; import io.swagger.annotations.ApiModelProperty; -import java.util.ArrayList; + import java.util.List; /** diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/analytics/DeviceTypeEvent.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/analytics/DeviceTypeEvent.java index d527631e92..f5f9b72732 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/analytics/DeviceTypeEvent.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/analytics/DeviceTypeEvent.java @@ -20,8 +20,6 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.analytics; import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.annotations.ApiModelProperty; -import java.util.List; - /** * This hold stats data record */ diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/analytics/EventAttributeList.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/analytics/EventAttributeList.java index 4fb2e3921d..26847a2153 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/analytics/EventAttributeList.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/analytics/EventAttributeList.java @@ -19,8 +19,6 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.analytics; import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.annotations.ApiModelProperty; -import io.entgra.device.mgt.core.device.mgt.common.Device; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.BasePaginatedResult; import java.util.ArrayList; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/analytics/EventRecords.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/analytics/EventRecords.java index 792e8de652..baa458392d 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/analytics/EventRecords.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/analytics/EventRecords.java @@ -18,13 +18,12 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.analytics; import com.fasterxml.jackson.annotation.JsonProperty; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.BasePaginatedResult; import io.swagger.annotations.ApiModelProperty; -import io.entgra.device.mgt.core.device.mgt.common.Device; +import org.wso2.carbon.analytics.datasource.commons.Record; import java.util.ArrayList; import java.util.List; -import org.wso2.carbon.analytics.datasource.commons.Record; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.BasePaginatedResult; /** * This hold stats data record diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/analytics/EventStream.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/analytics/EventStream.java index 2956fefaa8..b0012cb058 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/analytics/EventStream.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/beans/analytics/EventStream.java @@ -19,7 +19,6 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.analytics; import io.swagger.annotations.ApiModelProperty; -import java.util.ArrayList; import java.util.List; /** diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/exception/GlobalThrowableMapper.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/exception/GlobalThrowableMapper.java index 3384123fac..33411f3748 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/exception/GlobalThrowableMapper.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/exception/GlobalThrowableMapper.java @@ -19,9 +19,9 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.exception; import com.google.gson.JsonParseException; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtUtil; import javax.naming.AuthenticationException; import javax.ws.rs.ClientErrorException; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/ActivityInfoProviderService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/ActivityInfoProviderService.java index 99b56d9fbe..d4f5881670 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/ActivityInfoProviderService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/ActivityInfoProviderService.java @@ -17,35 +17,17 @@ */ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api; -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 io.entgra.device.mgt.core.apimgt.annotations.Scope; import io.entgra.device.mgt.core.apimgt.annotations.Scopes; -import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Activity; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ActivityList; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.common.ActivityIdList; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants; +import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Activity; +import io.swagger.annotations.*; -import javax.validation.Valid; import javax.validation.constraints.Size; -import javax.ws.rs.Consumes; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.HeaderParam; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/AnalyticsArtifactsManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/AnalyticsArtifactsManagementService.java index a6b519d03b..fd03db1080 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/AnalyticsArtifactsManagementService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/AnalyticsArtifactsManagementService.java @@ -17,7 +17,6 @@ */ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api; -import io.swagger.annotations.ApiParam; import io.entgra.device.mgt.core.apimgt.annotations.Scope; import io.entgra.device.mgt.core.apimgt.annotations.Scopes; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; @@ -25,25 +24,10 @@ import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.analytics.Adapter; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.analytics.EventStream; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.analytics.SiddhiExecutionPlan; import io.entgra.device.mgt.core.device.mgt.api.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 io.swagger.annotations.*; import javax.validation.Valid; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.QueryParam; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/ConfigurationManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/ConfigurationManagementService.java index b419564cc3..720b6ea184 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/ConfigurationManagementService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/ConfigurationManagementService.java @@ -17,24 +17,12 @@ */ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Info; -import io.swagger.annotations.ExtensionProperty; -import io.swagger.annotations.Extension; -import io.swagger.annotations.Tag; -import io.swagger.annotations.Api; -import io.swagger.annotations.AuthorizationScope; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.ResponseHeader; import io.entgra.device.mgt.core.apimgt.annotations.Scope; import io.entgra.device.mgt.core.apimgt.annotations.Scopes; -import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.PlatformConfiguration; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants; +import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.PlatformConfiguration; +import io.swagger.annotations.*; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceAgentService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceAgentService.java index b6fb084e24..0dbc238688 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceAgentService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceAgentService.java @@ -17,35 +17,17 @@ */ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api; -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 io.entgra.device.mgt.core.apimgt.annotations.Scope; import io.entgra.device.mgt.core.apimgt.annotations.Scopes; -import io.entgra.device.mgt.core.device.mgt.common.Device; -import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Operation; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.OperationList; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants; +import io.entgra.device.mgt.core.device.mgt.common.Device; +import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Operation; +import io.swagger.annotations.*; import javax.validation.Valid; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceEventManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceEventManagementService.java index 9bb14ff135..8c532f4e23 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceEventManagementService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceEventManagementService.java @@ -18,33 +18,15 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api; -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 io.entgra.device.mgt.core.apimgt.annotations.Scope; import io.entgra.device.mgt.core.apimgt.annotations.Scopes; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.analytics.DeviceTypeEvent; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.analytics.EventRecords; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants; +import io.swagger.annotations.*; import javax.validation.Valid; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceManagementService.java index f37108203f..afd82bfbbf 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceManagementService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceManagementService.java @@ -18,19 +18,10 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api; -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 io.entgra.device.mgt.core.apimgt.annotations.Scope; import io.entgra.device.mgt.core.apimgt.annotations.Scopes; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.*; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; import io.entgra.device.mgt.core.device.mgt.common.Feature; @@ -42,28 +33,13 @@ import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Policy; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.NonComplianceData; import io.entgra.device.mgt.core.device.mgt.common.search.PropertyMap; import io.entgra.device.mgt.core.device.mgt.common.search.SearchContext; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ApplicationList; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.DeviceList; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.OperationRequest; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.OperationStatusBean; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants; +import io.swagger.annotations.*; import javax.validation.Valid; import javax.validation.constraints.Size; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.HeaderParam; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import java.sql.Timestamp; import java.util.List; /** diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceTypeManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceTypeManagementService.java index 73e99d1136..e355c5bfae 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceTypeManagementService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/DeviceTypeManagementService.java @@ -18,33 +18,17 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api; -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 io.entgra.device.mgt.core.apimgt.annotations.Scope; import io.entgra.device.mgt.core.apimgt.annotations.Scopes; -import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.PlatformConfiguration; -import io.entgra.device.mgt.core.device.mgt.core.dto.DeviceType; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.DeviceTypeList; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants; +import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.PlatformConfiguration; +import io.entgra.device.mgt.core.device.mgt.core.dto.DeviceType; +import io.swagger.annotations.*; import javax.validation.constraints.Size; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.HeaderParam; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/GeoLocationBasedService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/GeoLocationBasedService.java index 2c358382d8..5f97523365 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/GeoLocationBasedService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/GeoLocationBasedService.java @@ -18,36 +18,18 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api; -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 io.entgra.device.mgt.core.apimgt.annotations.Scope; import io.entgra.device.mgt.core.apimgt.annotations.Scopes; -import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; -import io.entgra.device.mgt.core.device.mgt.common.geo.service.Alert; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.GeofenceWrapper; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants; +import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; +import io.entgra.device.mgt.core.device.mgt.common.geo.service.Alert; +import io.swagger.annotations.*; import javax.validation.Valid; import javax.validation.constraints.Size; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/GroupManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/GroupManagementService.java index fb348388d5..cfe12bc3f8 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/GroupManagementService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/GroupManagementService.java @@ -18,40 +18,17 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api; -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.apache.axis2.transport.http.HTTPConstants; import io.entgra.device.mgt.core.apimgt.annotations.Scope; import io.entgra.device.mgt.core.apimgt.annotations.Scopes; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.*; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.DeviceGroupList; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.DeviceList; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.DeviceToGroupsAssignment; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.RoleList; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants; +import io.swagger.annotations.*; +import org.apache.axis2.transport.http.HTTPConstants; import javax.validation.Valid; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/MetadataService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/MetadataService.java index aa23780783..5f79032843 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/MetadataService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/MetadataService.java @@ -18,35 +18,16 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api; -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.apache.axis2.transport.http.HTTPConstants; import io.entgra.device.mgt.core.apimgt.annotations.Scope; import io.entgra.device.mgt.core.apimgt.annotations.Scopes; -import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.Metadata; -import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.WhiteLabelThemeCreateRequest; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.MetadataList; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants; +import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.Metadata; +import io.swagger.annotations.*; +import org.apache.axis2.transport.http.HTTPConstants; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/NotificationManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/NotificationManagementService.java index fe2049bd55..5e804c3ce3 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/NotificationManagementService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/NotificationManagementService.java @@ -17,33 +17,16 @@ */ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api; -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 io.entgra.device.mgt.core.apimgt.annotations.Scope; import io.entgra.device.mgt.core.apimgt.annotations.Scopes; -import io.entgra.device.mgt.core.device.mgt.common.notification.mgt.Notification; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.NotificationList; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants; +import io.entgra.device.mgt.core.device.mgt.common.notification.mgt.Notification; +import io.swagger.annotations.*; import javax.validation.constraints.Size; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.HeaderParam; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/PolicyManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/PolicyManagementService.java index ae7f541234..deb3d4c8bb 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/PolicyManagementService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/PolicyManagementService.java @@ -17,37 +17,19 @@ */ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api; -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 io.entgra.device.mgt.core.apimgt.annotations.Scope; import io.entgra.device.mgt.core.apimgt.annotations.Scopes; -import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Policy; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.PolicyWrapper; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.PriorityUpdatedPolicyWrapper; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ProfileFeature; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants; +import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Policy; +import io.swagger.annotations.*; import javax.validation.Valid; import javax.validation.constraints.Size; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.HeaderParam; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/RemoteSessionService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/RemoteSessionService.java index 57c96dc373..e9bd6f6d9f 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/RemoteSessionService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/RemoteSessionService.java @@ -19,20 +19,10 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api; -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 io.entgra.device.mgt.core.apimgt.annotations.Scope; import io.entgra.device.mgt.core.apimgt.annotations.Scopes; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants; +import io.swagger.annotations.*; import javax.validation.constraints.Size; import javax.ws.rs.GET; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/ReportManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/ReportManagementService.java index b2d8bd1b65..89353182ad 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/ReportManagementService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/ReportManagementService.java @@ -17,37 +17,17 @@ */ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api; -import com.google.gson.JsonObject; -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 io.entgra.device.mgt.core.apimgt.annotations.Scope; import io.entgra.device.mgt.core.apimgt.annotations.Scopes; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.ReportManagementException; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.DeviceList; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.ReportManagementException; +import io.swagger.annotations.*; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import javax.ws.rs.core.UriInfo; import java.util.List; @SwaggerDefinition( diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/RoleManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/RoleManagementService.java index 07c2fe962f..f7eb730a8b 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/RoleManagementService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/RoleManagementService.java @@ -17,13 +17,13 @@ */ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api; -import io.swagger.annotations.*; import io.entgra.device.mgt.core.apimgt.annotations.Scope; import io.entgra.device.mgt.core.apimgt.annotations.Scopes; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.RoleInfo; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.RoleList; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants; +import io.swagger.annotations.*; import org.wso2.carbon.user.mgt.common.UIPermissionNode; import javax.ws.rs.*; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/UserManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/UserManagementService.java index b6665cd9ec..e92d4a7081 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/UserManagementService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/UserManagementService.java @@ -18,45 +18,16 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api; import com.google.gson.JsonArray; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Info; -import io.swagger.annotations.ExtensionProperty; -import io.swagger.annotations.Extension; -import io.swagger.annotations.Tag; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.ResponseHeader; -import org.apache.axis2.transport.http.HTTPConstants; -import io.entgra.device.mgt.core.apimgt.annotations.Scopes; import io.entgra.device.mgt.core.apimgt.annotations.Scope; -import io.entgra.device.mgt.core.device.mgt.common.invitation.mgt.DeviceEnrollmentInvitation; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ActivityList; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.BasicUserInfo; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.BasicUserInfoList; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.Credential; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.EnrollmentInvitation; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.OldPasswordResetWrapper; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.PermissionList; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.RoleList; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.UserInfo; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.UserStoreList; +import io.entgra.device.mgt.core.apimgt.annotations.Scopes; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.*; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants; +import io.entgra.device.mgt.core.device.mgt.common.invitation.mgt.DeviceEnrollmentInvitation; +import io.swagger.annotations.*; +import org.apache.axis2.transport.http.HTTPConstants; import javax.validation.Valid; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.HeaderParam; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/WhiteLabelService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/WhiteLabelService.java index ff989bf095..fdf2e62793 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/WhiteLabelService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/WhiteLabelService.java @@ -17,30 +17,17 @@ */ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api; -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 io.swagger.annotations.ApiParam; -import org.apache.axis2.transport.http.HTTPConstants; + import io.entgra.device.mgt.core.apimgt.annotations.Scope; import io.entgra.device.mgt.core.apimgt.annotations.Scopes; -import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.Metadata; -import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.WhiteLabelThemeCreateRequest; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.PathParam; +import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.Metadata; +import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.WhiteLabelThemeCreateRequest; +import io.swagger.annotations.*; +import org.apache.axis2.transport.http.HTTPConstants; + +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/ApplicationManagementAdminService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/ApplicationManagementAdminService.java index 2dbc5f4062..28ec2cb92a 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/ApplicationManagementAdminService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/ApplicationManagementAdminService.java @@ -17,22 +17,13 @@ */ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.admin; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Info; -import io.swagger.annotations.ExtensionProperty; -import io.swagger.annotations.Extension; -import io.swagger.annotations.Tag; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; import io.entgra.device.mgt.core.apimgt.annotations.Scope; import io.entgra.device.mgt.core.apimgt.annotations.Scopes; -import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Activity; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ApplicationWrapper; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants; +import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Activity; +import io.swagger.annotations.*; import javax.ws.rs.Consumes; import javax.ws.rs.POST; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/DeviceAccessAuthorizationAdminService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/DeviceAccessAuthorizationAdminService.java index d361e5ccc1..aabaf7f793 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/DeviceAccessAuthorizationAdminService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/DeviceAccessAuthorizationAdminService.java @@ -17,21 +17,13 @@ */ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.admin; -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.SwaggerDefinition; -import io.swagger.annotations.Tag; import io.entgra.device.mgt.core.apimgt.annotations.Scope; import io.entgra.device.mgt.core.apimgt.annotations.Scopes; -import io.entgra.device.mgt.core.device.mgt.common.authorization.DeviceAuthorizationResult; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.AuthorizationRequest; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants; +import io.entgra.device.mgt.core.device.mgt.common.authorization.DeviceAuthorizationResult; +import io.swagger.annotations.*; import javax.ws.rs.Consumes; import javax.ws.rs.POST; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/DeviceAnalyticsArtifactUploaderAdminService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/DeviceAnalyticsArtifactUploaderAdminService.java index bb88a87d26..286669e1ac 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/DeviceAnalyticsArtifactUploaderAdminService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/DeviceAnalyticsArtifactUploaderAdminService.java @@ -18,17 +18,15 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.admin; -import io.swagger.annotations.*; import io.entgra.device.mgt.core.apimgt.annotations.Scope; import io.entgra.device.mgt.core.apimgt.annotations.Scopes; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants; +import io.swagger.annotations.*; -import javax.ws.rs.GET; 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; @SwaggerDefinition( diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/DeviceManagementAdminService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/DeviceManagementAdminService.java index 73d96fcfe1..20188e87c2 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/DeviceManagementAdminService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/DeviceManagementAdminService.java @@ -17,35 +17,17 @@ */ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.admin; -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.apache.axis2.transport.http.HTTPConstants; import io.entgra.device.mgt.core.apimgt.annotations.Scope; import io.entgra.device.mgt.core.apimgt.annotations.Scopes; -import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.DeviceList; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants; +import io.entgra.device.mgt.core.device.mgt.common.Device; +import io.swagger.annotations.*; +import org.apache.axis2.transport.http.HTTPConstants; import javax.validation.constraints.Size; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.HeaderParam; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.sql.Timestamp; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/DeviceTypeManagementAdminService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/DeviceTypeManagementAdminService.java index 816f52dd6a..4cac83ae6b 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/DeviceTypeManagementAdminService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/DeviceTypeManagementAdminService.java @@ -17,35 +17,18 @@ */ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.admin; -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 io.entgra.device.mgt.core.apimgt.annotations.Scope; import io.entgra.device.mgt.core.apimgt.annotations.Scopes; -import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.PlatformConfiguration; -import io.entgra.device.mgt.core.device.mgt.core.dto.DeviceType; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.DeviceTypeList; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.DeviceTypeVersionWrapper; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants; +import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.PlatformConfiguration; +import io.entgra.device.mgt.core.device.mgt.core.dto.DeviceType; +import io.swagger.annotations.*; import javax.validation.constraints.Size; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/GroupManagementAdminService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/GroupManagementAdminService.java index 2c8571efbe..393389340f 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/GroupManagementAdminService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/GroupManagementAdminService.java @@ -18,24 +18,14 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.admin; -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Info; -import io.swagger.annotations.ExtensionProperty; -import io.swagger.annotations.Extension; -import io.swagger.annotations.Tag; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.ResponseHeader; -import org.apache.axis2.transport.http.HTTPConstants; import io.entgra.device.mgt.core.apimgt.annotations.Scope; import io.entgra.device.mgt.core.apimgt.annotations.Scopes; -import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.DeviceGroupList; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants; +import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup; +import io.swagger.annotations.*; +import org.apache.axis2.transport.http.HTTPConstants; import javax.validation.Valid; import javax.ws.rs.*; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/UserManagementAdminService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/UserManagementAdminService.java index 3929f67b09..a6f2deeec7 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/UserManagementAdminService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/api/admin/UserManagementAdminService.java @@ -17,14 +17,14 @@ */ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.admin; -import io.swagger.annotations.*; -import org.apache.axis2.transport.http.HTTPConstants; import io.entgra.device.mgt.core.apimgt.annotations.Scope; import io.entgra.device.mgt.core.apimgt.annotations.Scopes; -import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.PasswordResetWrapper; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants; +import io.entgra.device.mgt.core.device.mgt.common.Device; +import io.swagger.annotations.*; +import org.apache.axis2.transport.http.HTTPConstants; import javax.validation.constraints.Size; import javax.ws.rs.*; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ActivityProviderServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ActivityProviderServiceImpl.java index db2a8eab31..f9e1a64432 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ActivityProviderServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ActivityProviderServiceImpl.java @@ -18,31 +18,24 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl; import com.google.gson.Gson; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.device.mgt.common.ActivityPaginationRequest; -import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; -import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Activity; -import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Operation; -import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.OperationManagementException; -import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ActivityList; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.common.ActivityIdList; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.ActivityInfoProviderService; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.RequestValidationUtil; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; +import io.entgra.device.mgt.core.device.mgt.common.ActivityPaginationRequest; +import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; +import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Activity; +import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Operation; +import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.OperationManagementException; +import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.wso2.carbon.user.api.UserStoreException; import javax.validation.constraints.Size; -import javax.ws.rs.Consumes; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.HeaderParam; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.text.ParseException; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/AnalyticsArtifactsManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/AnalyticsArtifactsManagementServiceImpl.java index 5be79177af..24f8705876 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/AnalyticsArtifactsManagementServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/AnalyticsArtifactsManagementServiceImpl.java @@ -17,23 +17,18 @@ */ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.analytics.Attribute; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.analytics.AdapterMappingConfiguration; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.analytics.MappingProperty; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.analytics.AdapterConfiguration; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.analytics.AdapterProperty; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.analytics.MessageFormat; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.analytics.SiddhiExecutionPlan; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.exception.ArtifactAlreadyExistsException; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.analytics.*; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.exception.BadRequestException; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.exception.ErrorDTO; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.exception.InvalidExecutionPlanException; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.exception.NotFoundException; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.exception.*; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.AnalyticsArtifactsManagementService; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.analytics.Adapter; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.analytics.EventStream; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; +import io.entgra.device.mgt.core.identity.jwt.client.extension.exception.JWTClientException; +import org.apache.axis2.AxisFault; +import org.apache.axis2.client.Stub; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.PrivilegedCarbonContext; 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; @@ -45,20 +40,10 @@ 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 io.entgra.device.mgt.core.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.DELETE; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.QueryParam; +import javax.ws.rs.*; import javax.ws.rs.core.Response; import java.rmi.RemoteException; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ConfigurationServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ConfigurationServiceImpl.java index 6a3770322e..51c69da4b0 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ConfigurationServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ConfigurationServiceImpl.java @@ -17,22 +17,19 @@ */ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.ConfigurationEntry; -import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.ConfigurationManagementException; -import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.PlatformConfiguration; -import io.entgra.device.mgt.core.device.mgt.core.config.ui.UIConfiguration; -import io.entgra.device.mgt.core.device.mgt.core.config.ui.UIConfigurationManager; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.ConfigurationManagementService; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.RequestValidationUtil; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; import io.entgra.device.mgt.core.device.mgt.common.MDMAppConstants; +import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.ConfigurationEntry; +import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.ConfigurationManagementException; +import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.PlatformConfiguration; import io.entgra.device.mgt.core.policy.mgt.common.PolicyManagementException; import io.entgra.device.mgt.core.policy.mgt.core.util.PolicyManagerUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; -import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.HeaderParam; import javax.ws.rs.PUT; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceAgentServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceAgentServiceImpl.java index 32313062b6..e8fa9cacf9 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceAgentServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceAgentServiceImpl.java @@ -21,10 +21,13 @@ import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonParser; -import org.apache.axis2.AxisFault; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.PrivilegedCarbonContext; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.OperationList; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.analytics.Attribute; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.analytics.AttributeType; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.analytics.EventAttributeList; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.DeviceAgentService; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; @@ -37,29 +40,20 @@ import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.OperationManage import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.ComplianceFeature; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.PolicyComplianceException; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.OperationList; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.analytics.Attribute; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.analytics.AttributeType; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.analytics.EventAttributeList; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.DeviceAgentService; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; -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 io.entgra.device.mgt.core.identity.jwt.client.extension.exception.JWTClientException; import io.entgra.device.mgt.core.policy.mgt.common.PolicyAdministratorPoint; import io.entgra.device.mgt.core.policy.mgt.common.PolicyManagementException; +import org.apache.axis2.AxisFault; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.PrivilegedCarbonContext; +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.user.api.UserStoreException; import javax.validation.Valid; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.QueryParam; +import javax.ws.rs.*; import javax.ws.rs.core.Response; import java.rmi.RemoteException; import java.util.ArrayList; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceEventManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceEventManagementServiceImpl.java index f7f812715d..277be7b9f8 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceEventManagementServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceEventManagementServiceImpl.java @@ -20,9 +20,15 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl; import io.entgra.device.mgt.core.apimgt.analytics.extension.AnalyticsArtifactsDeployer; import io.entgra.device.mgt.core.apimgt.analytics.extension.dto.*; -import io.entgra.device.mgt.core.apimgt.analytics.extension.exception.EventReceiverDeployerException; import io.entgra.device.mgt.core.apimgt.analytics.extension.exception.EventPublisherDeployerException; +import io.entgra.device.mgt.core.apimgt.analytics.extension.exception.EventReceiverDeployerException; import io.entgra.device.mgt.core.apimgt.analytics.extension.exception.EventStreamDeployerException; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.analytics.*; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.DeviceEventManagementService; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; +import io.entgra.device.mgt.core.identity.jwt.client.extension.exception.JWTClientException; import org.apache.axis2.AxisFault; import org.apache.axis2.client.Stub; import org.apache.commons.lang.StringUtils; @@ -32,15 +38,6 @@ import org.wso2.carbon.base.MultitenantConstants; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.databridge.commons.StreamDefinition; import org.wso2.carbon.databridge.commons.exception.MalformedStreamDefinitionException; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.analytics.Attribute; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.analytics.AttributeType; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.analytics.DeviceTypeEvent; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.analytics.EventAttributeList; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.analytics.TransportType; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.DeviceEventManagementService; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; import org.wso2.carbon.event.input.adapter.core.InputEventAdapterConfiguration; import org.wso2.carbon.event.output.adapter.core.OutputEventAdapterConfiguration; import org.wso2.carbon.event.publisher.core.EventPublisherService; @@ -64,7 +61,6 @@ import org.wso2.carbon.event.stream.core.exception.EventStreamConfigurationExcep 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 io.entgra.device.mgt.core.identity.jwt.client.extension.exception.JWTClientException; import org.wso2.carbon.user.api.UserStoreException; import javax.validation.Valid; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceManagementServiceImpl.java index dc4e9b6e36..d1ddfaa44f 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceManagementServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceManagementServiceImpl.java @@ -19,25 +19,24 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl; import com.google.gson.Gson; -import io.entgra.device.mgt.core.application.mgt.common.ApplicationInstallResponse; -import io.entgra.device.mgt.core.application.mgt.common.SubscriptionType; -import io.entgra.device.mgt.core.application.mgt.common.exception.SubscriptionManagementException; -import io.entgra.device.mgt.core.application.mgt.common.services.ApplicationManager; -import io.entgra.device.mgt.core.application.mgt.common.services.SubscriptionManager; -import io.entgra.device.mgt.core.application.mgt.core.util.HelperUtil; -import org.apache.commons.httpclient.HttpStatus; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.json.JSONObject; import io.entgra.device.mgt.core.apimgt.keymgt.extension.DCRResponse; import io.entgra.device.mgt.core.apimgt.keymgt.extension.TokenRequest; import io.entgra.device.mgt.core.apimgt.keymgt.extension.TokenResponse; import io.entgra.device.mgt.core.apimgt.keymgt.extension.exception.KeyMgtException; import io.entgra.device.mgt.core.apimgt.keymgt.extension.service.KeyMgtService; import io.entgra.device.mgt.core.apimgt.keymgt.extension.service.KeyMgtServiceImpl; -import org.wso2.carbon.context.CarbonContext; -import org.wso2.carbon.context.PrivilegedCarbonContext; +import io.entgra.device.mgt.core.application.mgt.common.ApplicationInstallResponse; +import io.entgra.device.mgt.core.application.mgt.common.SubscriptionType; +import io.entgra.device.mgt.core.application.mgt.common.exception.SubscriptionManagementException; +import io.entgra.device.mgt.core.application.mgt.common.services.ApplicationManager; +import io.entgra.device.mgt.core.application.mgt.common.services.SubscriptionManager; +import io.entgra.device.mgt.core.application.mgt.core.util.HelperUtil; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.*; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.DeviceManagementService; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.InputValidationException; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.RequestValidationUtil; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; import io.entgra.device.mgt.core.device.mgt.common.*; import io.entgra.device.mgt.core.device.mgt.common.app.mgt.Application; import io.entgra.device.mgt.core.device.mgt.common.app.mgt.ApplicationManagementException; @@ -64,7 +63,6 @@ import io.entgra.device.mgt.core.device.mgt.common.type.mgt.DeviceStatus; import io.entgra.device.mgt.core.device.mgt.core.app.mgt.ApplicationManagementProviderService; import io.entgra.device.mgt.core.device.mgt.core.config.DeviceConfigurationManager; import io.entgra.device.mgt.core.device.mgt.core.config.DeviceManagementConfig; -import io.entgra.device.mgt.core.device.mgt.core.dao.TrackerManagementDAOException; import io.entgra.device.mgt.core.device.mgt.core.device.details.mgt.DeviceDetailsMgtException; import io.entgra.device.mgt.core.device.mgt.core.device.details.mgt.DeviceInformationManager; import io.entgra.device.mgt.core.device.mgt.core.dto.DeviceType; @@ -75,22 +73,19 @@ import io.entgra.device.mgt.core.device.mgt.core.search.mgt.SearchManagerService import io.entgra.device.mgt.core.device.mgt.core.search.mgt.SearchMgtException; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; import io.entgra.device.mgt.core.device.mgt.core.service.GroupManagementProviderService; -import io.entgra.device.mgt.core.device.mgt.core.traccar.api.service.DeviceAPIClientService; -import io.entgra.device.mgt.core.device.mgt.core.traccar.common.TraccarHandlerConstants; import io.entgra.device.mgt.core.device.mgt.core.util.DeviceManagerUtil; -import io.entgra.device.mgt.core.device.mgt.core.util.HttpReportingUtil; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.*; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.DeviceManagementService; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.InputValidationException; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.RequestValidationUtil; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; import io.entgra.device.mgt.core.identity.jwt.client.extension.JWTClient; import io.entgra.device.mgt.core.identity.jwt.client.extension.dto.AccessTokenInfo; import io.entgra.device.mgt.core.identity.jwt.client.extension.exception.JWTClientException; import io.entgra.device.mgt.core.identity.jwt.client.extension.service.JWTClientManagerService; import io.entgra.device.mgt.core.policy.mgt.common.PolicyManagementException; import io.entgra.device.mgt.core.policy.mgt.core.PolicyManagerService; +import org.apache.commons.httpclient.HttpStatus; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.CarbonContext; +import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.utils.multitenancy.MultitenantUtils; @@ -104,7 +99,6 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Properties; -import java.util.concurrent.ExecutionException; @Path("/devices") public class DeviceManagementServiceImpl implements DeviceManagementService { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceTypeManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceTypeManagementServiceImpl.java index 127c5be203..0d22af9937 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceTypeManagementServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceTypeManagementServiceImpl.java @@ -18,31 +18,27 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceTypeNotFoundException; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.DeviceTypeManagementService; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.InputValidationException; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.RequestValidationUtil; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; import io.entgra.device.mgt.core.device.mgt.common.Feature; import io.entgra.device.mgt.core.device.mgt.common.FeatureManager; +import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.PlatformConfiguration; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceTypeNotFoundException; import io.entgra.device.mgt.core.device.mgt.common.push.notification.PushNotificationConfig; import io.entgra.device.mgt.core.device.mgt.common.type.mgt.DeviceTypeMetaDefinition; import io.entgra.device.mgt.core.device.mgt.core.dto.DeviceType; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.DeviceTypeManagementService; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.InputValidationException; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.RequestValidationUtil; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import javax.validation.constraints.Size; -import javax.ws.rs.GET; -import javax.ws.rs.HeaderParam; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.QueryParam; +import javax.ws.rs.*; import javax.ws.rs.core.Response; import java.util.ArrayList; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GeoLocationBasedServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GeoLocationBasedServiceImpl.java index b45725c5c1..1d410d43d5 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GeoLocationBasedServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GeoLocationBasedServiceImpl.java @@ -22,44 +22,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.google.gson.Gson; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.http.HttpStatus; -import org.wso2.carbon.analytics.api.AnalyticsDataAPI; -import org.wso2.carbon.analytics.api.AnalyticsDataAPIUtil; -//import org.wso2.carbon.analytics.dataservice.commons.AnalyticsDataResponse; -//import org.wso2.carbon.analytics.dataservice.commons.SearchResultEntry; -//import org.wso2.carbon.analytics.dataservice.commons.SortByField; -//import org.wso2.carbon.analytics.dataservice.commons.SortType; -//import org.wso2.carbon.analytics.datasource.commons.Record; -//import org.wso2.carbon.analytics.datasource.commons.exception.AnalyticsException; -import org.wso2.carbon.context.CarbonContext; -import io.entgra.device.mgt.core.device.mgt.common.Device; -import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; -import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; -import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants.GeoServices; -import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; -import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; -import io.entgra.device.mgt.core.device.mgt.common.PaginationResult; -import io.entgra.device.mgt.core.device.mgt.common.authorization.DeviceAccessAuthorizationException; -import io.entgra.device.mgt.core.device.mgt.common.event.config.EventConfig; -import io.entgra.device.mgt.core.device.mgt.common.event.config.EventConfigurationException; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; -import io.entgra.device.mgt.core.device.mgt.common.geo.service.Alert; -import io.entgra.device.mgt.core.device.mgt.common.geo.service.AlertAlreadyExistException; -import io.entgra.device.mgt.core.device.mgt.common.geo.service.Event; -import io.entgra.device.mgt.core.device.mgt.common.geo.service.GeoCluster; -import io.entgra.device.mgt.core.device.mgt.common.geo.service.GeoCoordinate; -import io.entgra.device.mgt.core.device.mgt.common.geo.service.GeoFence; -import io.entgra.device.mgt.core.device.mgt.common.geo.service.GeoLocationBasedServiceException; -import io.entgra.device.mgt.core.device.mgt.common.geo.service.GeoLocationProviderService; -import io.entgra.device.mgt.core.device.mgt.common.geo.service.GeoQuery; -import io.entgra.device.mgt.core.device.mgt.common.geo.service.GeofenceData; -import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroupConstants; -import io.entgra.device.mgt.core.device.mgt.core.geo.geoHash.geoHashStrategy.GeoHashLengthStrategy; -import io.entgra.device.mgt.core.device.mgt.core.geo.geoHash.geoHashStrategy.ZoomGeoHashLengthStrategy; -import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; -import io.entgra.device.mgt.core.device.mgt.core.util.DeviceManagerUtil; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.EventAction; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.GeofenceWrapper; @@ -70,27 +32,31 @@ import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.RequestV import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtUtil; -import org.wso2.carbon.user.api.UserStoreException; -import org.wso2.carbon.utils.multitenancy.MultitenantUtils; - -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; +import io.entgra.device.mgt.core.device.mgt.common.*; +import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants.GeoServices; +import io.entgra.device.mgt.core.device.mgt.common.authorization.DeviceAccessAuthorizationException; +import io.entgra.device.mgt.core.device.mgt.common.event.config.EventConfig; +import io.entgra.device.mgt.core.device.mgt.common.event.config.EventConfigurationException; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; +import io.entgra.device.mgt.core.device.mgt.common.geo.service.*; +import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroupConstants; +import io.entgra.device.mgt.core.device.mgt.core.geo.geoHash.geoHashStrategy.GeoHashLengthStrategy; +import io.entgra.device.mgt.core.device.mgt.core.geo.geoHash.geoHashStrategy.ZoomGeoHashLengthStrategy; +import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; +import io.entgra.device.mgt.core.device.mgt.core.util.DeviceManagerUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.http.HttpStatus; +import org.wso2.carbon.analytics.api.AnalyticsDataAPI; + +import javax.ws.rs.*; import javax.ws.rs.core.Response; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Date; -import java.util.HashMap; import java.util.List; -import java.util.Map; /** * The api for diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImpl.java index 1e6f525cb3..f0122835e1 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImpl.java @@ -18,26 +18,6 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.CarbonConstants; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.device.mgt.common.Device; -import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; -import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; -import io.entgra.device.mgt.core.device.mgt.common.GroupPaginationRequest; -import io.entgra.device.mgt.core.device.mgt.common.PaginationResult; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceNotFoundException; -import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup; -import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroupConstants; -import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceTypesOfGroups; -import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupAlreadyExistException; -import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupManagementException; -import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupNotExistException; -import io.entgra.device.mgt.core.device.mgt.common.group.mgt.RoleDoesNotExistException; -import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; -import io.entgra.device.mgt.core.device.mgt.core.service.GroupManagementProviderService; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.DeviceGroupList; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.DeviceList; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.DeviceToGroupsAssignment; @@ -45,14 +25,20 @@ import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.RoleList; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.GroupManagementService; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.RequestValidationUtil; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; +import io.entgra.device.mgt.core.device.mgt.common.*; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceNotFoundException; +import io.entgra.device.mgt.core.device.mgt.common.group.mgt.*; +import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; +import io.entgra.device.mgt.core.device.mgt.core.service.GroupManagementProviderService; import io.entgra.device.mgt.core.policy.mgt.common.PolicyAdministratorPoint; import io.entgra.device.mgt.core.policy.mgt.common.PolicyManagementException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.CarbonConstants; +import org.wso2.carbon.context.PrivilegedCarbonContext; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.QueryParam; +import javax.ws.rs.*; import javax.ws.rs.core.Response; import java.util.ArrayList; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/MetadataServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/MetadataServiceImpl.java index 0cf4f662f1..761957f7b6 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/MetadataServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/MetadataServiceImpl.java @@ -18,43 +18,28 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl; -import org.apache.commons.io.IOUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.MetadataList; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.MetadataService; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.RequestValidationUtil; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.PaginationResult; import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataKeyAlreadyExistsException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataKeyNotFoundException; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.NotFoundException; -import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.Metadata; import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataManagementException; +import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.Metadata; import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.MetadataManagementService; -import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.WhiteLabelTheme; -import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.WhiteLabelThemeCreateRequest; import io.entgra.device.mgt.core.device.mgt.core.util.DeviceManagerUtil; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.MetadataList; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.MetadataService; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.RequestValidationUtil; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import javax.ws.rs.*; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; import java.io.ByteArrayInputStream; import java.io.IOException; -import java.io.InputStream; import java.util.List; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - /** * This is the service class for metadata management. */ diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/NotificationManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/NotificationManagementServiceImpl.java index cfcf8f7d82..2880e91cb0 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/NotificationManagementServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/NotificationManagementServiceImpl.java @@ -17,28 +17,21 @@ */ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.CarbonContext; -import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; -import io.entgra.device.mgt.core.device.mgt.common.PaginationResult; -import io.entgra.device.mgt.core.device.mgt.common.notification.mgt.Notification; -import io.entgra.device.mgt.core.device.mgt.common.notification.mgt.NotificationManagementException; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.NotificationList; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.NotificationManagementService; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.RequestValidationUtil; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; +import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; +import io.entgra.device.mgt.core.device.mgt.common.PaginationResult; +import io.entgra.device.mgt.core.device.mgt.common.notification.mgt.Notification; +import io.entgra.device.mgt.core.device.mgt.common.notification.mgt.NotificationManagementException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.CarbonContext; import javax.validation.constraints.Size; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.HeaderParam; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/PolicyManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/PolicyManagementServiceImpl.java index 2a8e6357cc..fb16a529e4 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/PolicyManagementServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/PolicyManagementServiceImpl.java @@ -33,15 +33,26 @@ import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.PolicyList; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.PolicyWrapper; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.PriorityUpdatedPolicyWrapper; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ProfileFeature; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.*; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.PolicyManagementService; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.FilteringUtil; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.RequestValidationUtil; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtUtil; +import io.entgra.device.mgt.core.device.mgt.common.Device; +import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; +import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; +import io.entgra.device.mgt.core.device.mgt.common.authorization.DeviceAccessAuthorizationException; +import io.entgra.device.mgt.core.device.mgt.common.authorization.DeviceAccessAuthorizationService; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Policy; +import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHolder; import io.entgra.device.mgt.core.policy.mgt.common.PolicyAdministratorPoint; import io.entgra.device.mgt.core.policy.mgt.common.PolicyManagementException; import io.entgra.device.mgt.core.policy.mgt.core.PolicyManagerService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.PrivilegedCarbonContext; import javax.validation.Valid; import javax.ws.rs.*; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RemoteSessionServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RemoteSessionServiceImpl.java index 3928123029..3db3061101 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RemoteSessionServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RemoteSessionServiceImpl.java @@ -18,19 +18,15 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.RemoteSessionInfo; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.RemoteSessionService; import io.entgra.device.mgt.core.device.mgt.core.config.DeviceConfigurationManager; import io.entgra.device.mgt.core.device.mgt.core.config.DeviceManagementConfig; import io.entgra.device.mgt.core.device.mgt.core.config.remote.session.RemoteSessionConfiguration; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.RemoteSessionInfo; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.RemoteSessionService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; +import javax.ws.rs.*; import javax.ws.rs.core.Response; /** diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ReportManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ReportManagementServiceImpl.java index 8a143a66ae..3cb2aa1b20 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ReportManagementServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ReportManagementServiceImpl.java @@ -19,30 +19,24 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl; import com.google.gson.JsonObject; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.DeviceList; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.ReportManagementService; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.RequestValidationUtil; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.PaginationResult; +import io.entgra.device.mgt.core.device.mgt.common.ReportFiltersList; import io.entgra.device.mgt.core.device.mgt.common.exceptions.BadRequestException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceTypeNotFoundException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.ReportManagementException; import io.entgra.device.mgt.core.device.mgt.core.report.mgt.Constants; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.DeviceList; -import io.entgra.device.mgt.core.device.mgt.common.ReportFiltersList; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.ReportManagementService; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.RequestValidationUtil; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; -import javax.ws.rs.Consumes; -import javax.ws.rs.DefaultValue; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RoleManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RoleManagementServiceImpl.java index 635d89afde..c8df51825e 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RoleManagementServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/RoleManagementServiceImpl.java @@ -17,12 +17,6 @@ */ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.CarbonConstants; -import org.wso2.carbon.base.MultitenantConstants; -import org.wso2.carbon.context.CarbonContext; -import org.wso2.carbon.context.RegistryType; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.RoleInfo; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.RoleList; @@ -32,6 +26,12 @@ import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.RequestV import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.SetReferenceTransformer; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.CarbonConstants; +import org.wso2.carbon.base.MultitenantConstants; +import org.wso2.carbon.context.CarbonContext; +import org.wso2.carbon.context.RegistryType; import org.wso2.carbon.registry.api.Registry; import org.wso2.carbon.registry.core.session.UserRegistry; import org.wso2.carbon.registry.resource.services.utils.ChangeRolePermissionsUtil; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/UserManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/UserManagementServiceImpl.java index d8db5e3776..5209ace472 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/UserManagementServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/UserManagementServiceImpl.java @@ -19,16 +19,16 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl; import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.http.HttpStatus; -import org.eclipse.wst.common.uriresolver.internal.util.URIEncoder; -import org.wso2.carbon.context.CarbonContext; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.*; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.exception.BadRequestException; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.UserManagementService; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.RequestValidationUtil; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.CredentialManagementResponseBuilder; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.ConfigurationManagementException; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.OTPManagementException; import io.entgra.device.mgt.core.device.mgt.common.invitation.mgt.DeviceEnrollmentInvitation; import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Activity; @@ -37,24 +37,13 @@ import io.entgra.device.mgt.core.device.mgt.common.spi.OTPManagementService; import io.entgra.device.mgt.core.device.mgt.core.DeviceManagementConstants; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; import io.entgra.device.mgt.core.device.mgt.core.service.EmailMetaInfo; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ActivityList; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.BasicUserInfo; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.BasicUserInfoList; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.BasicUserInfoWrapper; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.Credential; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.EnrollmentInvitation; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.OldPasswordResetWrapper; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.PermissionList; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.RoleList; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.UserInfo; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.UserStoreList; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.exception.BadRequestException; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.UserManagementService; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.RequestValidationUtil; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.CredentialManagementResponseBuilder; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.http.HttpStatus; +import org.eclipse.wst.common.uriresolver.internal.util.URIEncoder; +import org.wso2.carbon.context.CarbonContext; +import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.identity.claim.metadata.mgt.ClaimMetadataManagementAdminService; import org.wso2.carbon.identity.claim.metadata.mgt.dto.AttributeMappingDTO; import org.wso2.carbon.identity.claim.metadata.mgt.dto.ClaimPropertyDTO; @@ -62,11 +51,7 @@ import org.wso2.carbon.identity.claim.metadata.mgt.dto.LocalClaimDTO; import org.wso2.carbon.identity.claim.metadata.mgt.exception.ClaimMetadataException; import org.wso2.carbon.identity.user.store.count.UserStoreCountRetriever; import org.wso2.carbon.identity.user.store.count.exception.UserStoreCounterException; -import org.wso2.carbon.user.api.Permission; -import org.wso2.carbon.user.api.RealmConfiguration; -import org.wso2.carbon.user.api.UserRealm; -import org.wso2.carbon.user.api.UserStoreException; -import org.wso2.carbon.user.api.UserStoreManager; +import org.wso2.carbon.user.api.*; import org.wso2.carbon.user.core.UserCoreConstants; import org.wso2.carbon.user.core.service.RealmService; import org.wso2.carbon.user.mgt.UserRealmProxy; @@ -75,16 +60,7 @@ import org.wso2.carbon.user.mgt.common.UserAdminException; import org.wso2.carbon.utils.CarbonUtils; import org.wso2.carbon.utils.multitenancy.MultitenantConstants; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.HeaderParam; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.io.File; @@ -95,15 +71,8 @@ import java.security.SecureRandom; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.Instant; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; import java.util.Properties; -import java.util.Set; +import java.util.*; @Path("/users") @Produces(MediaType.APPLICATION_JSON) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/WhiteLabelServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/WhiteLabelServiceImpl.java index 50732fcc15..f818d7a300 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/WhiteLabelServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/WhiteLabelServiceImpl.java @@ -18,24 +18,20 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.PrivilegedCarbonContext; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.WhiteLabelService; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.RequestValidationUtil; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; import io.entgra.device.mgt.core.device.mgt.common.FileResponse; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataManagementException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.NotFoundException; import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.WhiteLabelTheme; import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.WhiteLabelThemeCreateRequest; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.WhiteLabelService; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.RequestValidationUtil; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.PathParam; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.PrivilegedCarbonContext; + +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.io.ByteArrayInputStream; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/ApplicationManagementAdminServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/ApplicationManagementAdminServiceImpl.java index 1d8c145ec6..096c4656cc 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/ApplicationManagementAdminServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/ApplicationManagementAdminServiceImpl.java @@ -17,23 +17,23 @@ */ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.admin; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ApplicationWrapper; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.admin.ApplicationManagementAdminService; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.RequestValidationUtil; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.Platform; +import io.entgra.device.mgt.core.device.mgt.common.app.mgt.App; import io.entgra.device.mgt.core.device.mgt.common.app.mgt.ApplicationManagementException; import io.entgra.device.mgt.core.device.mgt.common.app.mgt.ApplicationManager; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.UnknownApplicationTypeException; import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Activity; import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Operation; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.UnknownApplicationTypeException; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.admin.ApplicationManagementAdminService; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.RequestValidationUtil; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; import io.entgra.device.mgt.core.device.mgt.core.util.MDMAndroidOperationUtil; import io.entgra.device.mgt.core.device.mgt.core.util.MDMIOSOperationUtil; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ApplicationWrapper; -import io.entgra.device.mgt.core.device.mgt.common.app.mgt.App; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import javax.ws.rs.Consumes; import javax.ws.rs.POST; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/DeviceAccessAuthorizationAdminServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/DeviceAccessAuthorizationAdminServiceImpl.java index 38addbb5e8..3255629630 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/DeviceAccessAuthorizationAdminServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/DeviceAccessAuthorizationAdminServiceImpl.java @@ -17,17 +17,17 @@ */ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.admin; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.AuthorizationRequest; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.admin.DeviceAccessAuthorizationAdminService; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; +import io.entgra.device.mgt.core.device.mgt.common.authorization.DeviceAccessAuthorizationException; +import io.entgra.device.mgt.core.device.mgt.common.authorization.DeviceAuthorizationResult; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.base.MultitenantConstants; import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.device.mgt.common.authorization.DeviceAccessAuthorizationException; -import io.entgra.device.mgt.core.device.mgt.common.authorization.DeviceAuthorizationResult; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.AuthorizationRequest; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.admin.DeviceAccessAuthorizationAdminService; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; import javax.ws.rs.Consumes; import javax.ws.rs.POST; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/DeviceAnalyticsArtifactUploaderAdminServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/DeviceAnalyticsArtifactUploaderAdminServiceImpl.java index deb393a612..67372a5e88 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/DeviceAnalyticsArtifactUploaderAdminServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/DeviceAnalyticsArtifactUploaderAdminServiceImpl.java @@ -17,6 +17,10 @@ */ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.admin; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.admin.DeviceAnalyticsArtifactUploaderAdminService; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; +import io.entgra.device.mgt.core.identity.jwt.client.extension.JWTClient; +import io.entgra.device.mgt.core.identity.jwt.client.extension.exception.JWTClientException; import org.apache.axis2.AxisFault; import org.apache.axis2.client.Options; import org.apache.axis2.client.Stub; @@ -31,23 +35,15 @@ import org.apache.commons.logging.LogFactory; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; -import org.wso2.carbon.application.mgt.stub.upload.CarbonAppUploaderStub; -import org.wso2.carbon.application.mgt.stub.upload.types.carbon.UploadedFileItem; import org.wso2.carbon.base.ServerConfiguration; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.core.util.Utils; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.admin.DeviceAnalyticsArtifactUploaderAdminService; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; -import io.entgra.device.mgt.core.identity.jwt.client.extension.JWTClient; -import io.entgra.device.mgt.core.identity.jwt.client.extension.exception.JWTClientException; -import org.wso2.carbon.registry.core.exceptions.RegistryException; -import org.wso2.carbon.user.api.UserStoreException; -import org.wso2.carbon.utils.CarbonUtils; import org.wso2.carbon.event.receiver.stub.EventReceiverAdminServiceStub; import org.wso2.carbon.event.stream.stub.EventStreamAdminServiceStub; +import org.wso2.carbon.user.api.UserStoreException; +import org.wso2.carbon.utils.CarbonUtils; import org.wso2.carbon.utils.multitenancy.MultitenantConstants; -import javax.activation.DataHandler; import javax.net.ssl.KeyManagerFactory; import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManagerFactory; @@ -58,11 +54,7 @@ import javax.ws.rs.core.Response; import java.io.*; import java.nio.file.Files; import java.rmi.RemoteException; -import java.security.KeyManagementException; -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.UnrecoverableKeyException; +import java.security.*; import java.security.cert.CertificateException; import java.util.ArrayList; import java.util.List; @@ -176,10 +168,11 @@ public class DeviceAnalyticsArtifactUploaderAdminServiceImpl implements DeviceAn if (streamFileList != null) { publishDynamicEventStream(type, tenantDomain, streamFileList); } - if (deployAnalyticsCapp(type, list)){ - return Response.status(Response.Status.BAD_REQUEST) - .entity("\"Error, Artifact does not exist.\"").build(); - } + //todo:analytics +// if (deployAnalyticsCapp(type, list)){ +// return Response.status(Response.Status.BAD_REQUEST) +// .entity("\"Error, Artifact does not exist.\"").build(); +// } if (receiverFileList != null) { publishDynamicEventReceivers(type, tenantDomain, receiverFileList); } @@ -201,62 +194,64 @@ public class DeviceAnalyticsArtifactUploaderAdminServiceImpl implements DeviceAn KeyManagementException | IOException | NoSuchAlgorithmException e) { log.error("Failed to access keystore for, tenantDomain: " + tenantDomain, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); - } catch (RegistryException e) { - log.error("Failed to load tenant, tenantDomain: " + tenantDomain, e); - return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); + //todo:analytics +// } catch (RegistryException e) { +// log.error("Failed to load tenant, tenantDomain: " + tenantDomain, e); +// return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); } catch (ParseException e) { log.error("Invalid stream definition for device type" + type + " for tenant, tenantDomain: " + tenantDomain, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); } } - private boolean deployAnalyticsCapp(@PathParam("type") String type, List
list) throws IOException, RegistryException { - CarbonAppUploaderStub carbonAppUploaderStub = null; - try { - File directory = new File(CAR_FILE_LOCATION + File.separator + type); - if (directory.isDirectory() && directory.exists()) { - UploadedFileItem[] uploadedFileItems = loadCappFromFileSystem(type); - if (uploadedFileItems.length > 0) { - if (DEVICE_MANAGEMENT_TYPE.equals(type.toLowerCase())) { - carbonAppUploaderStub = new CarbonAppUploaderStub(Utils.replaceSystemProperty( - IOT_MGT_URL)); - Options appUploaderOptions = carbonAppUploaderStub._getServiceClient().getOptions(); - if (appUploaderOptions == null) { - appUploaderOptions = new Options(); - } - appUploaderOptions.setProperty(HTTPConstants.HTTP_HEADERS, list); - appUploaderOptions.setProperty(HTTPConstants.CUSTOM_PROTOCOL_HANDLER - , new Protocol(DEFAULT_HTTP_PROTOCOL, - (ProtocolSocketFactory) new SSLProtocolSocketFactory - (sslContext), Integer.parseInt(Utils.replaceSystemProperty( - IOT_MGT_PORT)))); - - carbonAppUploaderStub._getServiceClient().setOptions(appUploaderOptions); - carbonAppUploaderStub.uploadApp(uploadedFileItems); - } else { - carbonAppUploaderStub = new CarbonAppUploaderStub(Utils.replaceSystemProperty(DAS_URL)); - Options appUploaderOptions = carbonAppUploaderStub._getServiceClient().getOptions(); - if (appUploaderOptions == null) { - appUploaderOptions = new Options(); - } - appUploaderOptions.setProperty(HTTPConstants.HTTP_HEADERS, list); - appUploaderOptions.setProperty(HTTPConstants.CUSTOM_PROTOCOL_HANDLER - , new Protocol(DEFAULT_HTTP_PROTOCOL - , (ProtocolSocketFactory) new SSLProtocolSocketFactory(sslContext) - , Integer.parseInt(Utils.replaceSystemProperty(DAS_PORT)))); - - carbonAppUploaderStub._getServiceClient().setOptions(appUploaderOptions); - carbonAppUploaderStub.uploadApp(uploadedFileItems); - } - } - } else { - return true; - } - return false; - } finally { - cleanup(carbonAppUploaderStub); - } - } + //todo:analytics +// private boolean deployAnalyticsCapp(@PathParam("type") String type, List
list) throws IOException, RegistryException { +// CarbonAppUploaderStub carbonAppUploaderStub = null; +// try { +// File directory = new File(CAR_FILE_LOCATION + File.separator + type); +// if (directory.isDirectory() && directory.exists()) { +// UploadedFileItem[] uploadedFileItems = loadCappFromFileSystem(type); +// if (uploadedFileItems.length > 0) { +// if (DEVICE_MANAGEMENT_TYPE.equals(type.toLowerCase())) { +// carbonAppUploaderStub = new CarbonAppUploaderStub(Utils.replaceSystemProperty( +// IOT_MGT_URL)); +// Options appUploaderOptions = carbonAppUploaderStub._getServiceClient().getOptions(); +// if (appUploaderOptions == null) { +// appUploaderOptions = new Options(); +// } +// appUploaderOptions.setProperty(HTTPConstants.HTTP_HEADERS, list); +// appUploaderOptions.setProperty(HTTPConstants.CUSTOM_PROTOCOL_HANDLER +// , new Protocol(DEFAULT_HTTP_PROTOCOL, +// (ProtocolSocketFactory) new SSLProtocolSocketFactory +// (sslContext), Integer.parseInt(Utils.replaceSystemProperty( +// IOT_MGT_PORT)))); +// +// carbonAppUploaderStub._getServiceClient().setOptions(appUploaderOptions); +// carbonAppUploaderStub.uploadApp(uploadedFileItems); +// } else { +// carbonAppUploaderStub = new CarbonAppUploaderStub(Utils.replaceSystemProperty(DAS_URL)); +// Options appUploaderOptions = carbonAppUploaderStub._getServiceClient().getOptions(); +// if (appUploaderOptions == null) { +// appUploaderOptions = new Options(); +// } +// appUploaderOptions.setProperty(HTTPConstants.HTTP_HEADERS, list); +// appUploaderOptions.setProperty(HTTPConstants.CUSTOM_PROTOCOL_HANDLER +// , new Protocol(DEFAULT_HTTP_PROTOCOL +// , (ProtocolSocketFactory) new SSLProtocolSocketFactory(sslContext) +// , Integer.parseInt(Utils.replaceSystemProperty(DAS_PORT)))); +// +// carbonAppUploaderStub._getServiceClient().setOptions(appUploaderOptions); +// carbonAppUploaderStub.uploadApp(uploadedFileItems); +// } +// } +// } else { +// return true; +// } +// return false; +// } finally { +// cleanup(carbonAppUploaderStub); +// } +// } private void publishDynamicEventReceivers(String deviceType, String tenantDomain, List receiversList) throws IOException, UserStoreException, JWTClientException { @@ -406,31 +401,32 @@ public class DeviceAnalyticsArtifactUploaderAdminServiceImpl implements DeviceAn return streamList; } - private UploadedFileItem[] loadCappFromFileSystem(String deviceType) throws IOException { - - File directory = new File(CAR_FILE_LOCATION + File.separator + deviceType); - File[] carFiles = directory.listFiles(new FilenameFilter() { - @Override - public boolean accept(File dir, String name) { - return name.toLowerCase().endsWith(".car"); - } - }); - List uploadedFileItemLis = new ArrayList<>(); - if (carFiles != null) { - - for (File carFile : carFiles) { - UploadedFileItem uploadedFileItem = new UploadedFileItem(); - DataHandler param = new DataHandler(carFile.toURI().toURL()); - uploadedFileItem.setDataHandler(param); - uploadedFileItem.setFileName(carFile.getName()); - uploadedFileItem.setFileType("jar"); - uploadedFileItemLis.add(uploadedFileItem); - } - } - UploadedFileItem[] fileItems = new UploadedFileItem[uploadedFileItemLis.size()]; - fileItems = uploadedFileItemLis.toArray(fileItems); - return fileItems; - } + //todo:analytics +// private UploadedFileItem[] loadCappFromFileSystem(String deviceType) throws IOException { +// +// File directory = new File(CAR_FILE_LOCATION + File.separator + deviceType); +// File[] carFiles = directory.listFiles(new FilenameFilter() { +// @Override +// public boolean accept(File dir, String name) { +// return name.toLowerCase().endsWith(".car"); +// } +// }); +// List uploadedFileItemLis = new ArrayList<>(); +// if (carFiles != null) { +// +// for (File carFile : carFiles) { +// UploadedFileItem uploadedFileItem = new UploadedFileItem(); +// DataHandler param = new DataHandler(carFile.toURI().toURL()); +// uploadedFileItem.setDataHandler(param); +// uploadedFileItem.setFileName(carFile.getName()); +// uploadedFileItem.setFileType("jar"); +// uploadedFileItemLis.add(uploadedFileItem); +// } +// } +// UploadedFileItem[] fileItems = new UploadedFileItem[uploadedFileItemLis.size()]; +// fileItems = uploadedFileItemLis.toArray(fileItems); +// return fileItems; +// } /** * Loads the keystore. diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/DeviceManagementAdminServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/DeviceManagementAdminServiceImpl.java index 5a9c4fa55d..7d7e18738e 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/DeviceManagementAdminServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/DeviceManagementAdminServiceImpl.java @@ -17,45 +17,29 @@ */ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.admin; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.base.MultitenantConstants; -import org.wso2.carbon.context.CarbonContext; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.device.mgt.common.Device; -import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; -import io.entgra.device.mgt.core.device.mgt.common.MDMAppConstants; -import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.DeviceList; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.admin.DeviceManagementAdminService; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.RequestValidationUtil; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; +import io.entgra.device.mgt.core.device.mgt.common.*; import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.ConfigurationEntry; import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.ConfigurationManagementException; import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.PlatformConfiguration; import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.PlatformConfigurationManagementService; import io.entgra.device.mgt.core.device.mgt.common.exceptions.BadRequestException; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceNotFoundException; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.InvalidDeviceException; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.UserNotFoundException; -import io.entgra.device.mgt.core.device.mgt.common.PaginationResult; -import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.Metadata; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.*; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.DeviceList; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.admin.DeviceManagementAdminService; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.RequestValidationUtil; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.base.MultitenantConstants; +import org.wso2.carbon.context.CarbonContext; +import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.user.core.service.RealmService; import javax.validation.constraints.Size; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.HeaderParam; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.sql.Timestamp; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/DeviceTypeManagementAdminServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/DeviceTypeManagementAdminServiceImpl.java index bf9214a640..efee063818 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/DeviceTypeManagementAdminServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/DeviceTypeManagementAdminServiceImpl.java @@ -18,31 +18,23 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.admin; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.base.MultitenantConstants; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.DeviceTypeVersionWrapper; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.admin.DeviceTypeManagementAdminService; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.PlatformConfiguration; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.common.spi.DeviceManagementService; import io.entgra.device.mgt.core.device.mgt.common.type.mgt.DeviceTypeMetaDefinition; import io.entgra.device.mgt.core.device.mgt.core.dto.DeviceType; import io.entgra.device.mgt.core.device.mgt.core.dto.DeviceTypeVersion; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.DeviceTypeVersionWrapper; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.admin.DeviceTypeManagementAdminService; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.base.MultitenantConstants; +import org.wso2.carbon.context.PrivilegedCarbonContext; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; +import javax.ws.rs.*; import javax.ws.rs.core.Response; import java.util.List; import java.util.regex.Matcher; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/GroupManagementAdminServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/GroupManagementAdminServiceImpl.java index 20fa85d855..5f6d8a7bae 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/GroupManagementAdminServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/GroupManagementAdminServiceImpl.java @@ -17,18 +17,18 @@ */ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.admin; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.DeviceGroupList; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.admin.GroupManagementAdminService; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.RequestValidationUtil; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; import io.entgra.device.mgt.core.device.mgt.common.GroupPaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.PaginationResult; import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup; import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroupConstants; import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupAlreadyExistException; import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupManagementException; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.DeviceGroupList; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.admin.GroupManagementAdminService; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.RequestValidationUtil; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import javax.ws.rs.DefaultValue; import javax.ws.rs.GET; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/UserManagementAdminServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/UserManagementAdminServiceImpl.java index 26cd8c4c54..a99b19ff7d 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/UserManagementAdminServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/admin/UserManagementAdminServiceImpl.java @@ -17,14 +17,14 @@ */ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.admin; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.PrivacyComplianceException; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.PasswordResetWrapper; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.admin.UserManagementAdminService; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.CredentialManagementResponseBuilder; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; +import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.PrivacyComplianceException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import javax.validation.constraints.Size; import javax.ws.rs.*; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/util/RequestValidationUtil.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/util/RequestValidationUtil.java index c277cbfe56..f958f82766 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/util/RequestValidationUtil.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/util/RequestValidationUtil.java @@ -19,45 +19,33 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util; import com.google.gson.Gson; import com.google.gson.JsonSyntaxException; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.http.HttpStatus; -import io.entgra.device.mgt.core.device.mgt.common.Base64File; -import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; -import io.entgra.device.mgt.core.device.mgt.common.Feature; -import io.entgra.device.mgt.core.device.mgt.common.FeatureManager; -import io.entgra.device.mgt.core.device.mgt.common.OperationLogFilters; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.*; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.exception.BadRequestException; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; +import io.entgra.device.mgt.core.device.mgt.common.*; import io.entgra.device.mgt.core.device.mgt.common.app.mgt.Application; import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.PlatformConfiguration; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceTypeNotFoundException; import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.Metadata; import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.WhiteLabelImageRequestPayload; +import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.WhiteLabelThemeCreateRequest; import io.entgra.device.mgt.core.device.mgt.common.notification.mgt.Notification; import io.entgra.device.mgt.core.device.mgt.core.common.util.HttpUtil; import io.entgra.device.mgt.core.device.mgt.core.dto.DeviceType; -import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.WhiteLabelThemeCreateRequest; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ApplicationWrapper; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.EventConfig; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.GeofenceWrapper; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.OldPasswordResetWrapper; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.PolicyWrapper; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ProfileFeature; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.RoleInfo; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.Scope; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.exception.BadRequestException; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; import io.entgra.device.mgt.core.policy.mgt.common.PolicyPayloadValidator; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.http.HttpStatus; import java.lang.reflect.InvocationTargetException; -import java.util.List; import java.util.ArrayList; -import java.util.Calendar; import java.util.Arrays; +import java.util.Calendar; +import java.util.List; public class RequestValidationUtil { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/swagger/extension/SecurityDefinitionConfigurator.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/swagger/extension/SecurityDefinitionConfigurator.java index 26ad33f207..9687a03779 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/swagger/extension/SecurityDefinitionConfigurator.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/swagger/extension/SecurityDefinitionConfigurator.java @@ -23,11 +23,8 @@ import io.swagger.jaxrs.config.ReaderListener; import io.swagger.models.Swagger; import io.swagger.models.auth.OAuth2Definition; import io.swagger.models.auth.SecuritySchemeDefinition; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.Scope; -import java.util.ArrayList; import java.util.HashMap; -import java.util.List; import java.util.Map; @SwaggerDefinition( diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/util/CredentialManagementResponseBuilder.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/util/CredentialManagementResponseBuilder.java index 570ef69419..43f2459ab8 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/util/CredentialManagementResponseBuilder.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/util/CredentialManagementResponseBuilder.java @@ -18,13 +18,13 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.util; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.CarbonContext; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.OldPasswordResetWrapper; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.PasswordResetWrapper; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.RequestValidationUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.user.api.UserStoreManager; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/util/DeviceMgtAPIUtils.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/util/DeviceMgtAPIUtils.java index 2760482a65..1073737ef5 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/util/DeviceMgtAPIUtils.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/util/DeviceMgtAPIUtils.java @@ -20,24 +20,12 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.util; import io.entgra.device.mgt.core.application.mgt.common.services.ApplicationManager; import io.entgra.device.mgt.core.application.mgt.common.services.SubscriptionManager; -import org.apache.axis2.AxisFault; -import org.apache.axis2.client.Options; -import org.apache.axis2.java.security.SSLProtocolSocketFactory; -import org.apache.axis2.transport.http.HTTPConstants; -import org.apache.commons.codec.binary.Base64; -import org.apache.commons.httpclient.Header; -import org.apache.commons.httpclient.protocol.Protocol; -import org.apache.commons.httpclient.protocol.ProtocolSocketFactory; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.CarbonConstants; -import org.wso2.carbon.analytics.api.AnalyticsDataAPI; -import org.wso2.carbon.analytics.stream.persistence.stub.EventStreamPersistenceAdminServiceStub; -import org.wso2.carbon.authenticator.stub.AuthenticationAdminStub; -import org.wso2.carbon.base.ServerConfiguration; -import org.wso2.carbon.context.CarbonContext; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.core.util.Utils; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.DeviceTypeVersionWrapper; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.OperationStatusBean; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.analytics.EventAttributeList; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.InputValidationException; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.RequestValidationUtil; import io.entgra.device.mgt.core.device.mgt.common.*; import io.entgra.device.mgt.core.device.mgt.common.authorization.DeviceAccessAuthorizationException; import io.entgra.device.mgt.core.device.mgt.common.authorization.DeviceAccessAuthorizationService; @@ -60,7 +48,6 @@ import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Operation; import io.entgra.device.mgt.core.device.mgt.common.report.mgt.ReportManagementService; import io.entgra.device.mgt.core.device.mgt.common.spi.DeviceTypeGeneratorService; import io.entgra.device.mgt.core.device.mgt.common.spi.OTPManagementService; -import io.entgra.device.mgt.core.device.mgt.common.spi.TraccarManagementService; import io.entgra.device.mgt.core.device.mgt.core.app.mgt.ApplicationManagementProviderService; import io.entgra.device.mgt.core.device.mgt.core.device.details.mgt.DeviceInformationManager; import io.entgra.device.mgt.core.device.mgt.core.dto.DeviceTypeVersion; @@ -70,12 +57,29 @@ import io.entgra.device.mgt.core.device.mgt.core.search.mgt.SearchManagerService import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; import io.entgra.device.mgt.core.device.mgt.core.service.GroupManagementProviderService; import io.entgra.device.mgt.core.device.mgt.core.traccar.api.service.DeviceAPIClientService; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.DeviceTypeVersionWrapper; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.OperationStatusBean; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.analytics.EventAttributeList; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.InputValidationException; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.RequestValidationUtil; +import io.entgra.device.mgt.core.identity.jwt.client.extension.JWTClient; +import io.entgra.device.mgt.core.identity.jwt.client.extension.exception.JWTClientException; +import io.entgra.device.mgt.core.identity.jwt.client.extension.service.JWTClientManagerService; +import io.entgra.device.mgt.core.policy.mgt.common.PolicyMonitoringTaskException; +import io.entgra.device.mgt.core.policy.mgt.core.PolicyManagerService; +import io.entgra.device.mgt.core.policy.mgt.core.task.TaskScheduleService; +import org.apache.axis2.AxisFault; +import org.apache.axis2.client.Options; +import org.apache.axis2.java.security.SSLProtocolSocketFactory; +import org.apache.axis2.transport.http.HTTPConstants; +import org.apache.commons.codec.binary.Base64; +import org.apache.commons.httpclient.Header; +import org.apache.commons.httpclient.protocol.Protocol; +import org.apache.commons.httpclient.protocol.ProtocolSocketFactory; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.CarbonConstants; +import org.wso2.carbon.analytics.api.AnalyticsDataAPI; +import org.wso2.carbon.analytics.stream.persistence.stub.EventStreamPersistenceAdminServiceStub; +import org.wso2.carbon.base.ServerConfiguration; +import org.wso2.carbon.context.CarbonContext; +import org.wso2.carbon.context.PrivilegedCarbonContext; +import org.wso2.carbon.core.util.Utils; import org.wso2.carbon.event.processor.stub.EventProcessorAdminServiceStub; import org.wso2.carbon.event.publisher.core.EventPublisherService; import org.wso2.carbon.event.publisher.stub.EventPublisherAdminServiceStub; @@ -84,17 +88,11 @@ import org.wso2.carbon.event.receiver.stub.EventReceiverAdminServiceStub; import org.wso2.carbon.event.stream.core.EventStreamService; import org.wso2.carbon.event.stream.stub.EventStreamAdminServiceStub; import org.wso2.carbon.identity.claim.metadata.mgt.dto.ClaimPropertyDTO; -import io.entgra.device.mgt.core.identity.jwt.client.extension.JWTClient; -import io.entgra.device.mgt.core.identity.jwt.client.extension.exception.JWTClientException; -import io.entgra.device.mgt.core.identity.jwt.client.extension.service.JWTClientManagerService; import org.wso2.carbon.identity.user.store.count.AbstractCountRetrieverFactory; import org.wso2.carbon.identity.user.store.count.UserStoreCountRetriever; import org.wso2.carbon.identity.user.store.count.exception.UserStoreCounterException; import org.wso2.carbon.identity.user.store.count.jdbc.JDBCCountRetrieverFactory; import org.wso2.carbon.identity.user.store.count.jdbc.internal.InternalCountRetrieverFactory; -import io.entgra.device.mgt.core.policy.mgt.common.PolicyMonitoringTaskException; -import io.entgra.device.mgt.core.policy.mgt.core.PolicyManagerService; -import io.entgra.device.mgt.core.policy.mgt.core.task.TaskScheduleService; import org.wso2.carbon.registry.core.service.RegistryService; import org.wso2.carbon.user.api.*; import org.wso2.carbon.user.core.jdbc.JDBCUserStoreManager; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/util/DeviceMgtUtil.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/util/DeviceMgtUtil.java index ab818b32ae..c126c4704a 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/util/DeviceMgtUtil.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/main/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/util/DeviceMgtUtil.java @@ -18,12 +18,12 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.util; -import io.entgra.device.mgt.core.device.mgt.core.config.permission.Scope; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorListItem; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ErrorResponse; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.ProfileFeature; import io.entgra.device.mgt.core.device.mgt.api.jaxrs.exception.BadRequestException; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Profile; +import io.entgra.device.mgt.core.device.mgt.core.config.permission.Scope; import javax.validation.ConstraintViolation; import java.util.ArrayList; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ActivityProviderServiceImplTest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ActivityProviderServiceImplTest.java index f56c673495..6e118a1104 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ActivityProviderServiceImplTest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ActivityProviderServiceImplTest.java @@ -18,6 +18,19 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.common.ActivityIdList; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.ActivityInfoProviderService; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.DeviceManagementService; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.RequestValidationUtil; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; +import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; +import io.entgra.device.mgt.core.device.mgt.common.authorization.DeviceAccessAuthorizationService; +import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Activity; +import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.OperationManagementException; +import io.entgra.device.mgt.core.device.mgt.core.authorization.DeviceAccessAuthorizationServiceImpl; +import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; +import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderServiceImpl; +import io.entgra.device.mgt.core.policy.mgt.core.util.PolicyManagerUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.mockito.Mockito; @@ -31,19 +44,6 @@ import org.testng.annotations.BeforeClass; import org.testng.annotations.ObjectFactory; import org.testng.annotations.Test; import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; -import io.entgra.device.mgt.core.device.mgt.common.authorization.DeviceAccessAuthorizationService; -import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Activity; -import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.OperationManagementException; -import io.entgra.device.mgt.core.device.mgt.core.authorization.DeviceAccessAuthorizationServiceImpl; -import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; -import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderServiceImpl; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.common.ActivityIdList; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.ActivityInfoProviderService; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.DeviceManagementService; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.RequestValidationUtil; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; -import io.entgra.device.mgt.core.policy.mgt.core.util.PolicyManagerUtil; import javax.ws.rs.core.Response; import java.util.ArrayList; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ConfigurationServiceImplTest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ConfigurationServiceImplTest.java index bf4ccaafd4..8bc2f8c0c7 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ConfigurationServiceImplTest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/ConfigurationServiceImplTest.java @@ -18,6 +18,13 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.ConfigurationManagementService; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; +import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.ConfigurationEntry; +import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.ConfigurationManagementException; +import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.PlatformConfiguration; +import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.PlatformConfigurationManagementService; +import io.entgra.device.mgt.core.policy.mgt.core.util.PolicyManagerUtil; import org.mockito.Mockito; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PowerMockIgnore; @@ -28,13 +35,6 @@ import org.testng.IObjectFactory; import org.testng.annotations.BeforeClass; import org.testng.annotations.ObjectFactory; import org.testng.annotations.Test; -import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.ConfigurationEntry; -import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.ConfigurationManagementException; -import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.PlatformConfiguration; -import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.PlatformConfigurationManagementService; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.ConfigurationManagementService; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; -import io.entgra.device.mgt.core.policy.mgt.core.util.PolicyManagerUtil; import javax.ws.rs.core.Response; import java.util.ArrayList; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceAgentServiceTest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceAgentServiceTest.java index e32761b0e6..b61f4254b2 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceAgentServiceTest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceAgentServiceTest.java @@ -17,6 +17,25 @@ */ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.DeviceAgentService; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.admin.DeviceTypeManagementAdminService; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.DeviceMgtAPITestHelper; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; +import io.entgra.device.mgt.core.device.mgt.common.Device; +import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; +import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; +import io.entgra.device.mgt.core.device.mgt.common.authorization.DeviceAccessAuthorizationException; +import io.entgra.device.mgt.core.device.mgt.common.authorization.DeviceAccessAuthorizationService; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; +import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Operation; +import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.OperationManagementException; +import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.PolicyComplianceException; +import io.entgra.device.mgt.core.device.mgt.core.authorization.DeviceAccessAuthorizationServiceImpl; +import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; +import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderServiceImpl; +import io.entgra.device.mgt.core.identity.jwt.client.extension.exception.JWTClientException; +import io.entgra.device.mgt.core.policy.mgt.core.PolicyManagerService; +import io.entgra.device.mgt.core.policy.mgt.core.PolicyManagerServiceImpl; import org.apache.axis2.AxisFault; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -34,28 +53,7 @@ import org.wso2.carbon.base.MultitenantConstants; import org.wso2.carbon.caching.impl.CacheImpl; import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.device.mgt.common.Device; -import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; -import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; -import io.entgra.device.mgt.core.device.mgt.common.authorization.DeviceAccessAuthorizationException; -import io.entgra.device.mgt.core.device.mgt.common.authorization.DeviceAccessAuthorizationService; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; -import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Operation; -import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.OperationManagementException; -import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.PolicyComplianceException; -import io.entgra.device.mgt.core.device.mgt.core.authorization.DeviceAccessAuthorizationServiceImpl; -import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; -import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderServiceImpl; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.DeviceAgentService; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.admin.DeviceTypeManagementAdminService; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.DeviceMgtAPITestHelper; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; 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 io.entgra.device.mgt.core.identity.jwt.client.extension.exception.JWTClientException; -import io.entgra.device.mgt.core.policy.mgt.core.PolicyManagerService; -import io.entgra.device.mgt.core.policy.mgt.core.PolicyManagerServiceImpl; import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.utils.CarbonUtils; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceManagementServiceImplTest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceManagementServiceImplTest.java index 3a24db49f5..dd98043164 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceManagementServiceImplTest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceManagementServiceImplTest.java @@ -18,19 +18,9 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.mockito.Mockito; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PowerMockIgnore; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor; -import org.testng.Assert; -import org.testng.IObjectFactory; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.ObjectFactory; -import org.testng.annotations.Test; -import org.wso2.carbon.context.CarbonContext; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.DeviceManagementService; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.DeviceMgtAPITestHelper; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; @@ -52,11 +42,21 @@ import io.entgra.device.mgt.core.device.mgt.core.search.mgt.SearchMgtException; import io.entgra.device.mgt.core.device.mgt.core.search.mgt.impl.SearchManagerServiceImpl; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderServiceImpl; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.DeviceManagementService; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.DeviceMgtAPITestHelper; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; import io.entgra.device.mgt.core.policy.mgt.common.PolicyManagementException; import io.entgra.device.mgt.core.policy.mgt.core.PolicyManagerService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.mockito.Mockito; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PowerMockIgnore; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor; +import org.testng.Assert; +import org.testng.IObjectFactory; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.ObjectFactory; +import org.testng.annotations.Test; +import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.user.core.service.RealmService; import org.wso2.carbon.utils.multitenancy.MultitenantUtils; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceTypeManagementAdminServiceTest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceTypeManagementAdminServiceTest.java index fb84bc2e59..f18426501c 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceTypeManagementAdminServiceTest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceTypeManagementAdminServiceTest.java @@ -18,6 +18,16 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.admin.DeviceTypeManagementAdminService; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.admin.DeviceTypeManagementAdminServiceImpl; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.DeviceMgtAPITestHelper; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; +import io.entgra.device.mgt.core.device.mgt.common.spi.DeviceTypeGeneratorService; +import io.entgra.device.mgt.core.device.mgt.core.dto.DeviceType; +import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; +import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderServiceImpl; +import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.DeviceTypeGeneratorServiceImpl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.mockito.Mockito; @@ -33,16 +43,6 @@ import org.testng.annotations.Test; import org.wso2.carbon.base.MultitenantConstants; import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; -import io.entgra.device.mgt.core.device.mgt.common.spi.DeviceTypeGeneratorService; -import io.entgra.device.mgt.core.device.mgt.core.dto.DeviceType; -import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; -import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderServiceImpl; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.DeviceTypeGeneratorServiceImpl; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.admin.DeviceTypeManagementAdminService; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.admin.DeviceTypeManagementAdminServiceImpl; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.DeviceMgtAPITestHelper; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; import javax.ws.rs.core.Response; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceTypeManagementServiceTest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceTypeManagementServiceTest.java index 636ecdca33..c6ff5a3b95 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceTypeManagementServiceTest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/DeviceTypeManagementServiceTest.java @@ -17,6 +17,14 @@ */ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.DeviceTypeManagementService; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.DeviceMgtAPITestHelper; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; +import io.entgra.device.mgt.core.device.mgt.common.FeatureManager; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; +import io.entgra.device.mgt.core.device.mgt.core.dto.DeviceType; +import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; +import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderServiceImpl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.mockito.Mockito; @@ -29,14 +37,6 @@ import org.testng.IObjectFactory; import org.testng.annotations.BeforeClass; import org.testng.annotations.ObjectFactory; import org.testng.annotations.Test; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; -import io.entgra.device.mgt.core.device.mgt.common.FeatureManager; -import io.entgra.device.mgt.core.device.mgt.core.dto.DeviceType; -import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; -import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderServiceImpl; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.DeviceTypeManagementService; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl.util.DeviceMgtAPITestHelper; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; import javax.ws.rs.core.Response; import java.lang.reflect.InvocationTargetException; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GeoLocationBasedServiceImplTest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GeoLocationBasedServiceImplTest.java index 53eca5ff87..7ac7b28340 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GeoLocationBasedServiceImplTest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GeoLocationBasedServiceImplTest.java @@ -18,18 +18,18 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.GeoLocationBasedService; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; +import io.entgra.device.mgt.core.device.mgt.common.geo.service.GeoCluster; +import io.entgra.device.mgt.core.device.mgt.common.geo.service.GeoCoordinate; +import io.entgra.device.mgt.core.device.mgt.common.geo.service.GeoQuery; +import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; import org.mockito.Mockito; import org.powermock.core.classloader.annotations.PowerMockIgnore; import org.testng.Assert; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; -import io.entgra.device.mgt.core.device.mgt.common.geo.service.GeoCluster; -import io.entgra.device.mgt.core.device.mgt.common.geo.service.GeoCoordinate; -import io.entgra.device.mgt.core.device.mgt.common.geo.service.GeoQuery; -import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.GeoLocationBasedService; import javax.ws.rs.core.Response; import java.util.ArrayList; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImplTest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImplTest.java index d648120b0d..dc94b03ab8 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImplTest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/GroupManagementServiceImplTest.java @@ -18,6 +18,18 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.DeviceToGroupsAssignment; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.GroupManagementService; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; +import io.entgra.device.mgt.core.device.mgt.common.Device; +import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; +import io.entgra.device.mgt.core.device.mgt.common.GroupPaginationRequest; +import io.entgra.device.mgt.core.device.mgt.common.PaginationResult; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceNotFoundException; +import io.entgra.device.mgt.core.device.mgt.common.group.mgt.*; +import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; +import io.entgra.device.mgt.core.device.mgt.core.service.GroupManagementProviderService; +import io.entgra.device.mgt.core.policy.mgt.core.PolicyManagerService; import org.mockito.Mockito; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PowerMockIgnore; @@ -31,22 +43,6 @@ import org.testng.annotations.Test; import org.wso2.carbon.CarbonConstants; import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.device.mgt.common.Device; -import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceNotFoundException; -import io.entgra.device.mgt.core.device.mgt.common.GroupPaginationRequest; -import io.entgra.device.mgt.core.device.mgt.common.PaginationResult; -import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup; -import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupAlreadyExistException; -import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupManagementException; -import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupNotExistException; -import io.entgra.device.mgt.core.device.mgt.common.group.mgt.RoleDoesNotExistException; -import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; -import io.entgra.device.mgt.core.device.mgt.core.service.GroupManagementProviderService; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.DeviceToGroupsAssignment; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.GroupManagementService; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; -import io.entgra.device.mgt.core.policy.mgt.core.PolicyManagerService; import javax.ws.rs.core.Response; import java.util.ArrayList; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/NotificationManagementServiceImplTest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/NotificationManagementServiceImplTest.java index 6735329a7d..e15c12e677 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/NotificationManagementServiceImplTest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/NotificationManagementServiceImplTest.java @@ -18,6 +18,11 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; +import io.entgra.device.mgt.core.device.mgt.common.PaginationResult; +import io.entgra.device.mgt.core.device.mgt.common.notification.mgt.Notification; +import io.entgra.device.mgt.core.device.mgt.common.notification.mgt.NotificationManagementException; +import io.entgra.device.mgt.core.device.mgt.common.notification.mgt.NotificationManagementService; import org.mockito.Mockito; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PowerMockIgnore; @@ -29,13 +34,9 @@ import org.testng.annotations.BeforeClass; import org.testng.annotations.ObjectFactory; import org.testng.annotations.Test; import org.wso2.carbon.context.CarbonContext; -import io.entgra.device.mgt.core.device.mgt.common.PaginationResult; -import io.entgra.device.mgt.core.device.mgt.common.notification.mgt.Notification; -import io.entgra.device.mgt.core.device.mgt.common.notification.mgt.NotificationManagementException; -import io.entgra.device.mgt.core.device.mgt.common.notification.mgt.NotificationManagementService; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.utils.multitenancy.MultitenantUtils; + import javax.ws.rs.core.Response; import java.util.ArrayList; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/UserManagementServiceImplTest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/UserManagementServiceImplTest.java index e517561279..f584bb31ec 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/UserManagementServiceImplTest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.api/src/test/java/io/entgra/device/mgt/core/device/mgt/api/jaxrs/service/impl/UserManagementServiceImplTest.java @@ -18,6 +18,20 @@ package io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.impl; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.BasicUserInfo; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.EnrollmentInvitation; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.UserInfo; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.UserManagementService; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants; +import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; +import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.ConfigurationManagementException; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.OTPManagementException; +import io.entgra.device.mgt.core.device.mgt.common.invitation.mgt.DeviceEnrollmentInvitation; +import io.entgra.device.mgt.core.device.mgt.common.spi.OTPManagementService; +import io.entgra.device.mgt.core.device.mgt.core.otp.mgt.service.OTPManagementServiceImpl; +import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; +import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderServiceImpl; import org.mockito.Mockito; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; @@ -31,20 +45,6 @@ import org.testng.annotations.BeforeClass; import org.testng.annotations.ObjectFactory; import org.testng.annotations.Test; import org.wso2.carbon.context.CarbonContext; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; -import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.ConfigurationManagementException; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.OTPManagementException; -import io.entgra.device.mgt.core.device.mgt.common.invitation.mgt.DeviceEnrollmentInvitation; -import io.entgra.device.mgt.core.device.mgt.common.spi.OTPManagementService; -import io.entgra.device.mgt.core.device.mgt.core.otp.mgt.service.OTPManagementServiceImpl; -import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; -import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderServiceImpl; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.BasicUserInfo; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.EnrollmentInvitation; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.beans.UserInfo; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.service.api.UserManagementService; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.Constants; -import io.entgra.device.mgt.core.device.mgt.api.jaxrs.util.DeviceMgtAPIUtils; import org.wso2.carbon.user.api.RealmConfiguration; import org.wso2.carbon.user.api.UserRealm; import org.wso2.carbon.user.api.UserStoreException; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/pom.xml index b24ec478c4..d8323a431c 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/pom.xml @@ -30,10 +30,18 @@ bundle WSO2 Carbon - Device Management Commons WSO2 Carbon - Device Management Commons - http://wso2.org + https://entgra.io + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + org.apache.felix maven-bundle-plugin @@ -48,10 +56,28 @@ io.entgra.device.mgt.core.device.mgt.common.* - javax.xml.bind.annotation; version="${javax.xml.bind.imp.pkg.version}", - com.fasterxml.jackson.annotation;version="${jackson-annotations.version}", - io.swagger.annotations; version="${swagger.annotations.version}"; resolution:=optional, - com.google.gson + com.fasterxml.jackson.annotation;version="[2.9,3)", + com.google.gson;version="[2.9,3)", + io.entgra.device.mgt.core.device.mgt.common, + io.entgra.device.mgt.core.device.mgt.common.app.mgt, + io.entgra.device.mgt.core.device.mgt.common.configuration.mgt, + io.entgra.device.mgt.core.device.mgt.common.device.details, + io.entgra.device.mgt.core.device.mgt.common.event.config, + io.entgra.device.mgt.core.device.mgt.common.exceptions, + io.entgra.device.mgt.core.device.mgt.common.general, + io.entgra.device.mgt.core.device.mgt.common.group.mgt, + io.entgra.device.mgt.core.device.mgt.common.invitation.mgt, + io.entgra.device.mgt.core.device.mgt.common.license.mgt, + io.entgra.device.mgt.core.device.mgt.common.metadata.mgt, + io.entgra.device.mgt.core.device.mgt.common.operation.mgt, + io.entgra.device.mgt.core.device.mgt.common.otp.mgt.dto, + io.entgra.device.mgt.core.device.mgt.common.policy.mgt, + io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor, + io.entgra.device.mgt.core.device.mgt.common.pull.notification, + io.entgra.device.mgt.core.device.mgt.common.push.notification, + io.entgra.device.mgt.core.device.mgt.common.type.mgt, + io.swagger.annotations;version="[1.6,2)", + javax.xml.bind.annotation;version="[0.0,1)" diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/Billing.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/Billing.java index 558c74afb0..c1d7b63317 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/Billing.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/Billing.java @@ -20,6 +20,7 @@ package io.entgra.device.mgt.core.device.mgt.common; import com.google.gson.Gson; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; + import java.io.Serializable; @ApiModel(value = "Billing", description = "This class carries all information related to a device billing.") diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/BillingResponse.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/BillingResponse.java index 0dfa45d444..6a6d96d512 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/BillingResponse.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/BillingResponse.java @@ -20,6 +20,7 @@ package io.entgra.device.mgt.core.device.mgt.common; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; + import java.io.Serializable; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/Device.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/Device.java index ffd31e1f33..7b53197118 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/Device.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/Device.java @@ -17,14 +17,14 @@ */ package io.entgra.device.mgt.core.device.mgt.common; -import com.google.gson.Gson; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.gson.Gson; import io.entgra.device.mgt.core.device.mgt.common.app.mgt.Application; import io.entgra.device.mgt.core.device.mgt.common.device.details.DeviceInfo; import io.entgra.device.mgt.core.device.mgt.common.device.details.DeviceLocationHistorySnapshotWrapper; import io.entgra.device.mgt.core.device.mgt.common.type.mgt.DeviceStatus; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import java.io.Serializable; import java.util.ArrayList; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/DeviceBilling.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/DeviceBilling.java index a5442bdb79..863bd8a3f7 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/DeviceBilling.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/DeviceBilling.java @@ -18,10 +18,10 @@ package io.entgra.device.mgt.core.device.mgt.common; import com.google.gson.Gson; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import io.entgra.device.mgt.core.device.mgt.common.device.details.DeviceInfo; import io.entgra.device.mgt.core.device.mgt.common.type.mgt.DeviceStatus; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import java.io.Serializable; import java.util.ArrayList; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/EnrolmentInfo.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/EnrolmentInfo.java index 6cfd4092dc..9085468df0 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/EnrolmentInfo.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/EnrolmentInfo.java @@ -21,7 +21,6 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.Serializable; -import java.math.BigInteger; @ApiModel(value = "EnrolmentInfo", description = "This class carries all information related to a devices enrollment" + " status.") diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/PaginationRequest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/PaginationRequest.java index d9c2c62d47..ab1eeeff80 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/PaginationRequest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/PaginationRequest.java @@ -18,11 +18,7 @@ package io.entgra.device.mgt.core.device.mgt.common; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; /** * This class holds required parameters for a querying a paginated device response. diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/device/details/DeviceDetailsWrapper.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/device/details/DeviceDetailsWrapper.java index 4101f16b96..8f9f7ce0cd 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/device/details/DeviceDetailsWrapper.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/device/details/DeviceDetailsWrapper.java @@ -24,7 +24,6 @@ import io.entgra.device.mgt.core.device.mgt.common.app.mgt.Application; import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup; import java.util.List; -import java.util.Map; public class DeviceDetailsWrapper { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/device/details/DeviceLocation.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/device/details/DeviceLocation.java index 79918dd088..ee2395e390 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/device/details/DeviceLocation.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/device/details/DeviceLocation.java @@ -19,9 +19,9 @@ package io.entgra.device.mgt.core.device.mgt.common.device.details; +import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import java.io.Serializable; import java.util.Date; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/geo/service/Alert.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/geo/service/Alert.java index 61bfd6faa7..d5aa1d4203 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/geo/service/Alert.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/geo/service/Alert.java @@ -17,11 +17,7 @@ */ package io.entgra.device.mgt.core.device.mgt.common.geo.service; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlElementWrapper; -import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.*; /** * The Class Alert Bean. diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/geo/service/Event.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/geo/service/Event.java index d462542e5f..377f62b857 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/geo/service/Event.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/geo/service/Event.java @@ -18,11 +18,7 @@ package io.entgra.device.mgt.core.device.mgt.common.geo.service; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlElementWrapper; -import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.*; import java.util.ArrayList; import java.util.List; import java.util.Map; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/geo/service/GeoLocationProviderService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/geo/service/GeoLocationProviderService.java index 920cdac80e..1d1cbf1d95 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/geo/service/GeoLocationProviderService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/geo/service/GeoLocationProviderService.java @@ -20,11 +20,9 @@ package io.entgra.device.mgt.core.device.mgt.common.geo.service; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; -import io.entgra.device.mgt.core.device.mgt.common.PaginationResult; import io.entgra.device.mgt.core.device.mgt.common.event.config.EventConfig; import io.entgra.device.mgt.core.device.mgt.common.event.config.EventConfigurationException; -import java.util.ArrayList; import java.util.List; /** diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/geo/service/GeofenceData.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/geo/service/GeofenceData.java index b0e97bdb64..7e8c7636c8 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/geo/service/GeofenceData.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/geo/service/GeofenceData.java @@ -19,7 +19,6 @@ package io.entgra.device.mgt.core.device.mgt.common.geo.service; import io.entgra.device.mgt.core.device.mgt.common.event.config.EventConfig; -import io.entgra.device.mgt.core.device.mgt.common.event.config.EventMetaData; import java.util.List; import java.util.Map; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/group/mgt/GroupUser.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/group/mgt/GroupUser.java index 28a459f78e..bb061024b7 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/group/mgt/GroupUser.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/group/mgt/GroupUser.java @@ -20,8 +20,6 @@ package io.entgra.device.mgt.core.device.mgt.common.group.mgt; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; import java.io.Serializable; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/metadata/mgt/MetadataManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/metadata/mgt/MetadataManagementService.java index d02614ce2c..941377f04f 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/metadata/mgt/MetadataManagementService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/metadata/mgt/MetadataManagementService.java @@ -23,6 +23,7 @@ import io.entgra.device.mgt.core.device.mgt.common.PaginationResult; import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataKeyAlreadyExistsException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataKeyNotFoundException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataManagementException; + import java.util.List; /** diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/operation/mgt/ActivityStatus.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/operation/mgt/ActivityStatus.java index a90d69a8c1..a1d9c4f1c5 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/operation/mgt/ActivityStatus.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/operation/mgt/ActivityStatus.java @@ -20,9 +20,9 @@ package io.entgra.device.mgt.core.device.mgt.common.operation.mgt; import com.fasterxml.jackson.annotation.JsonProperty; +import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/operation/mgt/OperationManager.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/operation/mgt/OperationManager.java index 542b5c8450..d53e6c6339 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/operation/mgt/OperationManager.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/operation/mgt/OperationManager.java @@ -17,12 +17,7 @@ */ package io.entgra.device.mgt.core.device.mgt.common.operation.mgt; -import io.entgra.device.mgt.core.device.mgt.common.ActivityPaginationRequest; -import io.entgra.device.mgt.core.device.mgt.common.Device; -import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; -import io.entgra.device.mgt.core.device.mgt.common.DynamicTaskContext; -import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; -import io.entgra.device.mgt.core.device.mgt.common.PaginationResult; +import io.entgra.device.mgt.core.device.mgt.common.*; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.InvalidDeviceException; import io.entgra.device.mgt.core.device.mgt.common.push.notification.NotificationStrategy; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/policy/mgt/Policy.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/policy/mgt/Policy.java index c002a1648d..cd0aee7be7 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/policy/mgt/Policy.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/policy/mgt/Policy.java @@ -17,9 +17,9 @@ */ package io.entgra.device.mgt.core.device.mgt.common.policy.mgt; +import io.entgra.device.mgt.core.device.mgt.common.Device; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import io.entgra.device.mgt.core.device.mgt.common.Device; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/policy/mgt/ui/Modal.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/policy/mgt/ui/Modal.java index 8da35abdb6..093677b8e4 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/policy/mgt/ui/Modal.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/policy/mgt/ui/Modal.java @@ -18,7 +18,6 @@ package io.entgra.device.mgt.core.device.mgt.common.policy.mgt.ui; -import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlRootElement; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/policy/mgt/ui/SearchInput.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/policy/mgt/ui/SearchInput.java index 9491fbefc6..e098520725 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/policy/mgt/ui/SearchInput.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/policy/mgt/ui/SearchInput.java @@ -19,9 +19,7 @@ package io.entgra.device.mgt.core.device.mgt.common.policy.mgt.ui; import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlRootElement; -import java.util.List; @XmlRootElement(name = "SearchInput") public class SearchInput { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/report/mgt/ReportManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/report/mgt/ReportManagementService.java index 747fd8ec60..0874fed6ff 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/report/mgt/ReportManagementService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/report/mgt/ReportManagementService.java @@ -20,7 +20,6 @@ package io.entgra.device.mgt.core.device.mgt.common.report.mgt; import com.google.gson.JsonObject; import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.PaginationResult; -import io.entgra.device.mgt.core.device.mgt.common.app.mgt.ApplicationManagementException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.BadRequestException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceTypeNotFoundException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.ReportManagementException; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/type/mgt/DeviceTypeMetaDefinition.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/type/mgt/DeviceTypeMetaDefinition.java index 7cbd12fa32..7f14f5241b 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/type/mgt/DeviceTypeMetaDefinition.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.common/src/main/java/io/entgra/device/mgt/core/device/mgt/common/type/mgt/DeviceTypeMetaDefinition.java @@ -23,7 +23,6 @@ import io.entgra.device.mgt.core.device.mgt.common.InitialOperationConfig; import io.entgra.device.mgt.core.device.mgt.common.license.mgt.License; import io.entgra.device.mgt.core.device.mgt.common.push.notification.PushNotificationConfig; -import java.util.ArrayList; import java.util.List; public class DeviceTypeMetaDefinition { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/pom.xml index 2290c92c7c..a4673c3e6e 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/pom.xml @@ -189,6 +189,11 @@ + + io.entgra.device.mgt.core + io.entgra.device.mgt.core.device.mgt.common + provided + io.swagger swagger-annotations diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/src/main/java/io/entgra/device/mgt/core/device/mgt/config/api/ApiOriginFilter.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/src/main/java/io/entgra/device/mgt/core/device/mgt/config/api/ApiOriginFilter.java index 32b6cb52cc..75bc8e9805 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/src/main/java/io/entgra/device/mgt/core/device/mgt/config/api/ApiOriginFilter.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/src/main/java/io/entgra/device/mgt/core/device/mgt/config/api/ApiOriginFilter.java @@ -18,12 +18,7 @@ package io.entgra.device.mgt.core.device.mgt.config.api; -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.*; import javax.servlet.http.HttpServletResponse; import java.io.IOException; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/src/main/java/io/entgra/device/mgt/core/device/mgt/config/api/common/GsonMessageBodyHandler.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/src/main/java/io/entgra/device/mgt/core/device/mgt/config/api/common/GsonMessageBodyHandler.java index dfd02e3007..9bc6e7748c 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/src/main/java/io/entgra/device/mgt/core/device/mgt/config/api/common/GsonMessageBodyHandler.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/src/main/java/io/entgra/device/mgt/core/device/mgt/config/api/common/GsonMessageBodyHandler.java @@ -29,11 +29,7 @@ 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.io.*; import java.lang.annotation.Annotation; import java.lang.reflect.Type; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/src/main/java/io/entgra/device/mgt/core/device/mgt/config/api/service/DeviceManagementConfigService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/src/main/java/io/entgra/device/mgt/core/device/mgt/config/api/service/DeviceManagementConfigService.java index f2fc9e436f..eac30a6de6 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/src/main/java/io/entgra/device/mgt/core/device/mgt/config/api/service/DeviceManagementConfigService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/src/main/java/io/entgra/device/mgt/core/device/mgt/config/api/service/DeviceManagementConfigService.java @@ -18,32 +18,15 @@ package io.entgra.device.mgt.core.device.mgt.config.api.service; -import io.entgra.device.mgt.core.device.mgt.common.DeviceTransferRequest; -import io.entgra.device.mgt.core.device.mgt.config.api.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 io.entgra.device.mgt.core.apimgt.annotations.Scope; import io.entgra.device.mgt.core.apimgt.annotations.Scopes; +import io.entgra.device.mgt.core.device.mgt.common.DeviceTransferRequest; import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.DeviceConfiguration; import io.entgra.device.mgt.core.device.mgt.common.general.TenantDetail; +import io.entgra.device.mgt.core.device.mgt.config.api.beans.ErrorResponse; +import io.swagger.annotations.*; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.HeaderParam; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/src/main/java/io/entgra/device/mgt/core/device/mgt/config/api/service/impl/DeviceManagementConfigServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/src/main/java/io/entgra/device/mgt/core/device/mgt/config/api/service/impl/DeviceManagementConfigServiceImpl.java index 713c01e3d3..f387dfea32 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/src/main/java/io/entgra/device/mgt/core/device/mgt/config/api/service/impl/DeviceManagementConfigServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/src/main/java/io/entgra/device/mgt/core/device/mgt/config/api/service/impl/DeviceManagementConfigServiceImpl.java @@ -21,13 +21,6 @@ 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.device.mgt.core.device.mgt.config.api.beans.ErrorResponse; -import io.entgra.device.mgt.core.device.mgt.config.api.service.DeviceManagementConfigService; -import io.entgra.device.mgt.core.device.mgt.config.api.util.DeviceMgtAPIUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.base.MultitenantConstants; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.AppRegistrationCredentials; import io.entgra.device.mgt.core.device.mgt.common.ApplicationRegistrationException; import io.entgra.device.mgt.core.device.mgt.common.DeviceTransferRequest; @@ -37,6 +30,9 @@ import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementEx import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceNotFoundException; import io.entgra.device.mgt.core.device.mgt.common.general.TenantDetail; import io.entgra.device.mgt.core.device.mgt.common.permission.mgt.PermissionManagementException; +import io.entgra.device.mgt.core.device.mgt.config.api.beans.ErrorResponse; +import io.entgra.device.mgt.core.device.mgt.config.api.service.DeviceManagementConfigService; +import io.entgra.device.mgt.core.device.mgt.config.api.util.DeviceMgtAPIUtils; import io.entgra.device.mgt.core.device.mgt.core.DeviceManagementConstants; import io.entgra.device.mgt.core.device.mgt.core.config.DeviceConfigurationManager; import io.entgra.device.mgt.core.device.mgt.core.config.DeviceManagementConfig; @@ -48,18 +44,15 @@ import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProvide import io.entgra.device.mgt.core.device.mgt.core.util.DeviceManagerUtil; import io.entgra.device.mgt.core.identity.jwt.client.extension.dto.AccessTokenInfo; import io.entgra.device.mgt.core.identity.jwt.client.extension.exception.JWTClientException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.base.MultitenantConstants; +import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.user.api.Tenant; import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.user.core.service.RealmService; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.HeaderParam; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; +import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.io.IOException; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/src/main/java/io/entgra/device/mgt/core/device/mgt/config/api/util/DeviceMgtAPIUtils.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/src/main/java/io/entgra/device/mgt/core/device/mgt/config/api/util/DeviceMgtAPIUtils.java index 53d8ee9a3e..1dd6052def 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/src/main/java/io/entgra/device/mgt/core/device/mgt/config/api/util/DeviceMgtAPIUtils.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.config.api/src/main/java/io/entgra/device/mgt/core/device/mgt/config/api/util/DeviceMgtAPIUtils.java @@ -18,10 +18,10 @@ package io.entgra.device.mgt.core.device.mgt.config.api.util; +import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; import org.wso2.carbon.user.core.service.RealmService; /** diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml index 589979f6f6..ae8e99a83d 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/pom.xml @@ -31,14 +31,10 @@ bundle WSO2 Carbon - Device Management Core WSO2 Carbon - Device Management Core - http://wso2.org + https://entgra.io - - org.apache.felix - maven-scr-plugin - org.jacoco jacoco-maven-plugin @@ -65,6 +61,14 @@ + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + org.apache.felix maven-bundle-plugin @@ -77,45 +81,194 @@ Device Management Core Bundle io.entgra.device.mgt.core.device.mgt.core.internal - org.apache.axis2.*;version="${axis2.osgi.version.range}", + com.fasterxml.jackson.databind;version="[2.13,3)", + com.google.common.collect;version="[31.0,32)", + com.google.common.reflect;version="[31.0,32)", + com.google.gson;version="[2.9,3)", + com.google.gson.reflect;version="[2.9,3)", + io.entgra.device.mgt.core.apimgt.annotations;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.app.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.app.mgt.android;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.app.mgt.ios;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.app.mgt.windows;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.authorization;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.configuration.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.cost.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.device.details;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.enrollment.notification;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.event.config;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.exceptions;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.general;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.geo.service;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.group.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.invitation.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.license.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.metadata.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.notification.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.operation.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.otp.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.otp.mgt.dto;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.permission.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.policy.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.pull.notification;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.push.notification;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.report.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.roles.config;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.search;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.spi;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.type.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.core.app.mgt.config, + io.entgra.device.mgt.core.device.mgt.core.archival, + io.entgra.device.mgt.core.device.mgt.core.archival.dao, + io.entgra.device.mgt.core.device.mgt.core.archival.dao.impl, + io.entgra.device.mgt.core.device.mgt.core.cache, + io.entgra.device.mgt.core.device.mgt.core.cache.impl, + io.entgra.device.mgt.core.device.mgt.core.common.exception, + io.entgra.device.mgt.core.device.mgt.core.common.util, + io.entgra.device.mgt.core.device.mgt.core.config, + io.entgra.device.mgt.core.device.mgt.core.config.analytics, + io.entgra.device.mgt.core.device.mgt.core.config.analytics.operation, + io.entgra.device.mgt.core.device.mgt.core.config.archival, + io.entgra.device.mgt.core.device.mgt.core.config.cache, + io.entgra.device.mgt.core.device.mgt.core.config.datasource, + io.entgra.device.mgt.core.device.mgt.core.config.enrollment.guide, + io.entgra.device.mgt.core.device.mgt.core.config.geo.location, + io.entgra.device.mgt.core.device.mgt.core.config.identity, + io.entgra.device.mgt.core.device.mgt.core.config.keymanager, + io.entgra.device.mgt.core.device.mgt.core.config.license, + io.entgra.device.mgt.core.device.mgt.core.config.metadata.mgt, + io.entgra.device.mgt.core.device.mgt.core.config.metadata.mgt.whitelabel, + io.entgra.device.mgt.core.device.mgt.core.config.operation.timeout, + io.entgra.device.mgt.core.device.mgt.core.config.pagination, + io.entgra.device.mgt.core.device.mgt.core.config.permission, + io.entgra.device.mgt.core.device.mgt.core.config.policy, + io.entgra.device.mgt.core.device.mgt.core.config.pull.notification, + io.entgra.device.mgt.core.device.mgt.core.config.push.notification, + io.entgra.device.mgt.core.device.mgt.core.config.remote.session, + io.entgra.device.mgt.core.device.mgt.core.config.status.task, + io.entgra.device.mgt.core.device.mgt.core.config.task, + io.entgra.device.mgt.core.device.mgt.core.config.tenant, + io.entgra.device.mgt.core.device.mgt.core.config.ui, + io.entgra.device.mgt.core.device.mgt.core.dao, + io.entgra.device.mgt.core.device.mgt.core.dao.impl, + io.entgra.device.mgt.core.device.mgt.core.dao.impl.device, + io.entgra.device.mgt.core.device.mgt.core.dao.impl.enrolment, + io.entgra.device.mgt.core.device.mgt.core.dao.impl.event, + io.entgra.device.mgt.core.device.mgt.core.dao.impl.geofence, + io.entgra.device.mgt.core.device.mgt.core.dao.impl.group, + io.entgra.device.mgt.core.device.mgt.core.dao.impl.tracker, + io.entgra.device.mgt.core.device.mgt.core.device.details.mgt, + io.entgra.device.mgt.core.device.mgt.core.device.details.mgt.dao, + io.entgra.device.mgt.core.device.mgt.core.device.details.mgt.dao.impl, + io.entgra.device.mgt.core.device.mgt.core.dto, + io.entgra.device.mgt.core.device.mgt.core.dto.event.config, + io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt, + io.entgra.device.mgt.core.device.mgt.core.geo.geoHash, + io.entgra.device.mgt.core.device.mgt.core.geo.task, + io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.dao, + io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.dao.impl, + io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.dao.util, + io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.util, + io.entgra.device.mgt.core.device.mgt.core.notification.mgt.dao, + io.entgra.device.mgt.core.device.mgt.core.notification.mgt.dao.impl, + io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao, + io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.impl, + io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.impl.operation, + io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.util, + io.entgra.device.mgt.core.device.mgt.core.operation.mgt.util, + io.entgra.device.mgt.core.device.mgt.core.operation.timeout.task, + io.entgra.device.mgt.core.device.mgt.core.otp.mgt.dao, + io.entgra.device.mgt.core.device.mgt.core.otp.mgt.dao.impl, + io.entgra.device.mgt.core.device.mgt.core.otp.mgt.exception, + io.entgra.device.mgt.core.device.mgt.core.otp.mgt.util, + io.entgra.device.mgt.core.device.mgt.core.privacy, + io.entgra.device.mgt.core.device.mgt.core.privacy.dao, + io.entgra.device.mgt.core.device.mgt.core.privacy.dao.impl, + io.entgra.device.mgt.core.device.mgt.core.report.mgt, + io.entgra.device.mgt.core.device.mgt.core.report.mgt.config, + io.entgra.device.mgt.core.device.mgt.core.search.mgt, + io.entgra.device.mgt.core.device.mgt.core.search.mgt.dao, + io.entgra.device.mgt.core.device.mgt.core.status.task, + io.entgra.device.mgt.core.device.mgt.core.task, + io.entgra.device.mgt.core.device.mgt.core.traccar.api.service, + io.entgra.device.mgt.core.device.mgt.core.traccar.api.service.impl, + io.entgra.device.mgt.core.device.mgt.core.traccar.common.beans, + io.entgra.device.mgt.core.device.mgt.core.traccar.common.config, + io.entgra.device.mgt.core.device.mgt.core.traccar.common.util, + io.entgra.device.mgt.core.device.mgt.core.traccar.core.config, + io.entgra.device.mgt.core.device.mgt.extensions.logger.spi;version="[5.0,6)", + io.entgra.device.mgt.core.identity.jwt.client.extension;version="[5.0,6)", + io.entgra.device.mgt.core.identity.jwt.client.extension.dto;version="[5.0,6)", + io.entgra.device.mgt.core.identity.jwt.client.extension.exception;version="[5.0,6)", + io.entgra.device.mgt.core.identity.jwt.client.extension.service;version="[5.0,6)", + io.entgra.device.mgt.core.notification.logger;version="[5.0,6)", + io.entgra.device.mgt.core.notification.logger.impl;version="[5.0,6)", + io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.exception;version="[5.0,6)", + io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service;version="[5.0,6)", + io.entgra.device.mgt.core.transport.mgt.email.sender.core;version="[5.0,6)", + io.entgra.device.mgt.core.transport.mgt.email.sender.core.service;version="[5.0,6)", + io.swagger.annotations;version="[1.6,2)",javax.cache;version="[1.0,2)", + javax.naming,javax.net.ssl,javax.servlet;version="[2.6,3)", + javax.sql,javax.ws.rs,javax.xml.bind;version="[0.0,1)", + javax.xml.bind.annotation;version="[0.0,1)", + javax.xml.parsers;version="${javax.xml.parsers.import.pkg.version}", + javax.xml.stream;version="[1.0,2)", + okhttp3, + org.apache.axis2;version="[1.6,2)", + org.apache.axis2.client;version="[1.6,2)", + org.apache.axis2.context;version="[1.6,2)", + org.apache.axis2.java.security;version="[1.6,2)", + org.apache.axis2.transport.http;version="[1.6,2)", + org.apache.catalina;version="${catalina.version.range}", + org.apache.catalina.core;version="${catalina.version.range}", + org.apache.commons.codec.binary;version="[1.4,2)", + org.apache.commons.collections.map;version="[3.2,4)", + org.apache.commons.httpclient;version="[3.1,4)", + org.apache.commons.httpclient.protocol;version="[3.1,4)", + org.apache.commons.io;version="[2.0,3)", + org.apache.commons.lang;version="[2.6,3)", + org.apache.commons.lang3;version="[3.1,4)", + org.apache.commons.logging;version="[1.2,2)", + org.apache.commons.validator.routines;version="[1.7,2)", + org.apache.http;version="[4.4,5)", + org.apache.http.client.methods;version="[4.3,5)", + org.apache.http.entity;version="[4.4,5)", + org.apache.http.impl.client;version="[4.3,5)", + org.apache.http.util;version="[4.4,5)", + org.apache.solr.common;version="[8.11,9)", + org.json;version="[3.0,4)", org.osgi.framework.*;version="${imp.package.version.osgi.framework}", org.osgi.service.*;version="${imp.package.version.osgi.service}", - org.apache.commons.logging, - javax.naming, - javax.xml.parsers;version="${javax.xml.parsers.import.pkg.version}";resolution:=optional, - javax.servlet.*, - org.xml.sax, - javax.sql.*, - org.wso2.carbon.context, - org.wso2.carbon.core, - org.wso2.carbon.utils.*, - io.entgra.device.mgt.core.device.mgt.common.*, - org.wso2.carbon.user.api, - org.wso2.carbon.user.core.*, - org.wso2.carbon.registry.core.service, + org.scannotation;version="[1.0,2)", + org.scannotation.archiveiterator;version="[1.0,2)", + org.w3c.dom, + org.wso2.carbon.base, + + + org.wso2.carbon.context;version="[4.8,5)", + org.wso2.carbon.core;version="[4.8,5)", + org.wso2.carbon.core.util;version="[4.8,5)", + org.wso2.carbon.event.processor.stub;version="[2.3,3)", + org.wso2.carbon.event.processor.stub.types;version="[2.3,3)", + org.wso2.carbon.ndatasource.core;version="[4.8,5)", + org.wso2.carbon.ntask.common, + org.wso2.carbon.ntask.core, + org.wso2.carbon.ntask.core.service, + org.wso2.carbon.registry.api, org.wso2.carbon.registry.core, org.wso2.carbon.registry.core.exceptions, + org.wso2.carbon.registry.core.service, org.wso2.carbon.registry.core.session, - org.wso2.carbon.registry.api, - org.w3c.dom, - org.wso2.carbon.identity.oauth.stub, - org.wso2.carbon.identity.oauth.stub.dto, - org.wso2.carbon.ndatasource.core, - org.wso2.carbon.ntask.core.*, - org.wso2.carbon.ntask.common, - io.entgra.device.mgt.core.task.mgt.common.*, - org.apache.commons.collections;version="${commons-collections.version.range}", - io.entgra.device.mgt.core.email.sender.*, - io.swagger.annotations.*;resolution:=optional, - org.wso2.carbon, - org.wso2.carbon.base, - org.scannotation.*, - org.wso2.carbon.event.processor.stub, - io.entgra.device.mgt.core.identity.jwt.client.extension.service, - org.apache.commons.codec.binary, - io.entgra.device.mgt.core.server.bootup.heartbeat.beacon, - io.entgra.device.mgt.core.device.mgt.extensions.logger.*, - io.entgra.device.mgt.core.notification.logger.* + org.wso2.carbon.stratos.common.beans;version="[4.7,5)", + org.wso2.carbon.stratos.common.util;version="[4.7,5)", + org.wso2.carbon.tenant.mgt.services, + org.wso2.carbon.user.api, + org.wso2.carbon.user.core.config;version="[4.8,5)", + org.wso2.carbon.user.core.service;version="[4.8,5)", + org.wso2.carbon.user.core.tenant;version="[4.8,5)", + org.wso2.carbon.utils;version="[4.8,5)", + org.wso2.carbon.utils.dbcreator;version="[4.8,5)" !io.entgra.device.mgt.core.device.mgt.core.internal, @@ -149,15 +302,12 @@ - org.eclipse.osgi - org.eclipse.osgi - - - org.eclipse.osgi - org.eclipse.osgi.services + org.apache.felix + org.apache.felix.scr.ds-annotations + provided - org.wso2.orbit.org.scannotation + io.entgra.org.scannotation scannotation @@ -212,10 +362,12 @@ org.wso2.carbon org.wso2.carbon.registry.api + provided org.wso2.carbon org.wso2.carbon.registry.core + provided org.apache.tomcat.wso2 @@ -237,14 +389,6 @@ org.apache.ws.commons.axiom.wso2 axiom - org.apache.axis2.wso2 axis2 @@ -325,6 +469,7 @@ org.javassist javassist + provided org.powermock @@ -362,6 +507,19 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.notification.logger + provided + + + org.wso2.orbit.javax.xml.bind + jaxb-api + 2.3.1.wso2v1 + compile + + + org.wso2.orbit.javax.xml.bind + jaxb-api + 2.3.1.wso2v1 + compile diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/DeviceManagementPluginRepository.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/DeviceManagementPluginRepository.java index c0c9dbddb1..f2bccac8e7 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/DeviceManagementPluginRepository.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/DeviceManagementPluginRepository.java @@ -18,14 +18,11 @@ package io.entgra.device.mgt.core.device.mgt.core; import com.google.gson.Gson; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.common.DeviceStatusTaskPluginConfig; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.InvalidConfigurationException; import io.entgra.device.mgt.core.device.mgt.common.OperationMonitoringTaskConfig; import io.entgra.device.mgt.core.device.mgt.common.ProvisioningConfig; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.InvalidConfigurationException; import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.OperationManager; import io.entgra.device.mgt.core.device.mgt.common.pull.notification.PullNotificationSubscriber; import io.entgra.device.mgt.core.device.mgt.common.push.notification.NotificationStrategy; @@ -49,6 +46,9 @@ import io.entgra.device.mgt.core.device.mgt.core.status.task.impl.DeviceStatusTa import io.entgra.device.mgt.core.device.mgt.core.task.DeviceMgtTaskException; import io.entgra.device.mgt.core.device.mgt.core.task.DeviceTaskManagerService; import io.entgra.device.mgt.core.device.mgt.core.util.DeviceManagerUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.PrivilegedCarbonContext; import java.util.Collections; import java.util.HashMap; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java index fec70931a4..3e49e65542 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java @@ -19,18 +19,14 @@ package io.entgra.device.mgt.core.device.mgt.core.app.mgt; import com.google.gson.Gson; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.CarbonContext; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; +import io.entgra.device.mgt.core.device.mgt.common.app.mgt.Application; +import io.entgra.device.mgt.core.device.mgt.common.app.mgt.ApplicationManagementException; import io.entgra.device.mgt.core.device.mgt.common.device.details.DeviceDetailsWrapper; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.InvalidDeviceException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.TransactionManagementException; -import io.entgra.device.mgt.core.device.mgt.common.app.mgt.Application; -import io.entgra.device.mgt.core.device.mgt.common.app.mgt.ApplicationManagementException; import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Activity; import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Operation; import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.OperationManagementException; @@ -41,6 +37,10 @@ import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOExceptio import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHolder; import io.entgra.device.mgt.core.device.mgt.core.util.HttpReportingUtil; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.CarbonContext; import java.sql.SQLException; import java.util.ArrayList; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/app/mgt/config/AppManagementConfigurationManager.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/app/mgt/config/AppManagementConfigurationManager.java index 3e09b59daf..5f45417d77 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/app/mgt/config/AppManagementConfigurationManager.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/app/mgt/config/AppManagementConfigurationManager.java @@ -18,9 +18,9 @@ package io.entgra.device.mgt.core.device.mgt.core.app.mgt.config; -import org.w3c.dom.Document; import io.entgra.device.mgt.core.device.mgt.common.app.mgt.ApplicationManagementException; import io.entgra.device.mgt.core.device.mgt.core.util.DeviceManagerUtil; +import org.w3c.dom.Document; import org.wso2.carbon.utils.CarbonUtils; import javax.xml.bind.JAXBContext; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/app/mgt/oauth/ServiceAuthenticator.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/app/mgt/oauth/ServiceAuthenticator.java index a096d6ed15..e54ba4aa89 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/app/mgt/oauth/ServiceAuthenticator.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/app/mgt/oauth/ServiceAuthenticator.java @@ -18,10 +18,10 @@ package io.entgra.device.mgt.core.device.mgt.core.app.mgt.oauth; +import io.entgra.device.mgt.core.device.mgt.common.app.mgt.ApplicationManagementException; import org.apache.axis2.client.Options; import org.apache.axis2.client.ServiceClient; import org.apache.axis2.transport.http.HttpTransportProperties; -import io.entgra.device.mgt.core.device.mgt.common.app.mgt.ApplicationManagementException; /** * Authenticate a given service client. diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/archival/ArchivalServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/archival/ArchivalServiceImpl.java index 1af72b81bd..a478404422 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/archival/ArchivalServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/archival/ArchivalServiceImpl.java @@ -18,15 +18,11 @@ package io.entgra.device.mgt.core.device.mgt.core.archival; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.exceptions.TransactionManagementException; -import io.entgra.device.mgt.core.device.mgt.core.archival.dao.ArchivalDAO; -import io.entgra.device.mgt.core.device.mgt.core.archival.dao.ArchivalDAOException; -import io.entgra.device.mgt.core.device.mgt.core.archival.dao.ArchivalDestinationDAOFactory; -import io.entgra.device.mgt.core.device.mgt.core.archival.dao.ArchivalSourceDAOFactory; -import io.entgra.device.mgt.core.device.mgt.core.archival.dao.DataDeletionDAO; +import io.entgra.device.mgt.core.device.mgt.core.archival.dao.*; import io.entgra.device.mgt.core.device.mgt.core.config.DeviceConfigurationManager; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.sql.SQLException; import java.sql.Timestamp; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/archival/dao/ArchivalDestinationDAOFactory.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/archival/dao/ArchivalDestinationDAOFactory.java index 44642c4ce9..9beb7dac6c 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/archival/dao/ArchivalDestinationDAOFactory.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/archival/dao/ArchivalDestinationDAOFactory.java @@ -18,8 +18,6 @@ package io.entgra.device.mgt.core.device.mgt.core.archival.dao; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.exceptions.IllegalTransactionStateException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.TransactionManagementException; import io.entgra.device.mgt.core.device.mgt.core.archival.dao.impl.DataDeletionDAOImpl; @@ -28,6 +26,8 @@ import io.entgra.device.mgt.core.device.mgt.core.config.datasource.DataSourceCon import io.entgra.device.mgt.core.device.mgt.core.config.datasource.JNDILookupDefinition; import io.entgra.device.mgt.core.device.mgt.core.dao.util.DeviceManagementDAOUtil; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationManagementDAOFactory; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import javax.sql.DataSource; import java.sql.Connection; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/archival/dao/ArchivalSourceDAOFactory.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/archival/dao/ArchivalSourceDAOFactory.java index a8964ef616..e04e3fe74e 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/archival/dao/ArchivalSourceDAOFactory.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/archival/dao/ArchivalSourceDAOFactory.java @@ -18,8 +18,6 @@ package io.entgra.device.mgt.core.device.mgt.core.archival.dao; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.exceptions.IllegalTransactionStateException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.TransactionManagementException; import io.entgra.device.mgt.core.device.mgt.core.archival.dao.impl.ArchivalDAOImpl; @@ -29,6 +27,8 @@ import io.entgra.device.mgt.core.device.mgt.core.config.datasource.DataSourceCon import io.entgra.device.mgt.core.device.mgt.core.config.datasource.JNDILookupDefinition; import io.entgra.device.mgt.core.device.mgt.core.dao.util.DeviceManagementDAOUtil; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationManagementDAOFactory; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import javax.sql.DataSource; import java.sql.Connection; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/archival/dao/impl/ArchivalDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/archival/dao/impl/ArchivalDAOImpl.java index 183447be7b..3ade9e203c 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/archival/dao/impl/ArchivalDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/archival/dao/impl/ArchivalDAOImpl.java @@ -18,21 +18,12 @@ package io.entgra.device.mgt.core.device.mgt.core.archival.dao.impl; +import io.entgra.device.mgt.core.device.mgt.core.archival.dao.*; +import io.entgra.device.mgt.core.device.mgt.core.config.DeviceConfigurationManager; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.device.mgt.core.archival.dao.ArchivalDAO; -import io.entgra.device.mgt.core.device.mgt.core.archival.dao.ArchivalDAOException; -import io.entgra.device.mgt.core.device.mgt.core.archival.dao.ArchivalDAOUtil; -import io.entgra.device.mgt.core.device.mgt.core.archival.dao.ArchivalDestinationDAOFactory; -import io.entgra.device.mgt.core.device.mgt.core.archival.dao.ArchivalSourceDAOFactory; -import io.entgra.device.mgt.core.device.mgt.core.config.DeviceConfigurationManager; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.sql.Timestamp; +import java.sql.*; import java.util.ArrayList; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/archival/dao/impl/DataDeletionDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/archival/dao/impl/DataDeletionDAOImpl.java index 8d4f90c975..fc959b6ea0 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/archival/dao/impl/DataDeletionDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/archival/dao/impl/DataDeletionDAOImpl.java @@ -18,13 +18,13 @@ package io.entgra.device.mgt.core.device.mgt.core.archival.dao.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.core.archival.dao.ArchivalDAOException; import io.entgra.device.mgt.core.device.mgt.core.archival.dao.ArchivalDAOUtil; import io.entgra.device.mgt.core.device.mgt.core.archival.dao.ArchivalDestinationDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.archival.dao.DataDeletionDAO; import io.entgra.device.mgt.core.device.mgt.core.config.DeviceConfigurationManager; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.sql.Connection; import java.sql.PreparedStatement; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/authorization/DeviceAccessAuthorizationServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/authorization/DeviceAccessAuthorizationServiceImpl.java index 287b794c4c..20460dcdf3 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/authorization/DeviceAccessAuthorizationServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/authorization/DeviceAccessAuthorizationServiceImpl.java @@ -18,23 +18,24 @@ package io.entgra.device.mgt.core.device.mgt.core.authorization; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.CarbonConstants; -import org.wso2.carbon.context.CarbonContext; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.common.authorization.DeviceAccessAuthorizationException; import io.entgra.device.mgt.core.device.mgt.common.authorization.DeviceAccessAuthorizationService; import io.entgra.device.mgt.core.device.mgt.common.authorization.DeviceAuthorizationResult; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup; import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupManagementException; import io.entgra.device.mgt.core.device.mgt.common.permission.mgt.Permission; import io.entgra.device.mgt.core.device.mgt.common.permission.mgt.PermissionManagementException; import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHolder; import io.entgra.device.mgt.core.device.mgt.core.permission.mgt.PermissionUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.CarbonConstants; +import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.user.api.UserRealm; import org.wso2.carbon.user.api.UserStoreException; + import java.util.Iterator; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/cache/DeviceCacheManager.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/cache/DeviceCacheManager.java index 4ba316fbdb..d392a81cd7 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/cache/DeviceCacheManager.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/cache/DeviceCacheManager.java @@ -18,8 +18,8 @@ package io.entgra.device.mgt.core.device.mgt.core.cache; -import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.Device; +import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/cache/impl/BillingCacheManagerImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/cache/impl/BillingCacheManagerImpl.java index d5f63dd652..84efc8d106 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/cache/impl/BillingCacheManagerImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/cache/impl/BillingCacheManagerImpl.java @@ -18,13 +18,13 @@ package io.entgra.device.mgt.core.device.mgt.core.cache.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.PaginationResult; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.core.cache.BillingCacheKey; import io.entgra.device.mgt.core.device.mgt.core.cache.BillingCacheManager; import io.entgra.device.mgt.core.device.mgt.core.util.DeviceManagerUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import javax.cache.Cache; import java.sql.Timestamp; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/cache/impl/DeviceCacheManagerImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/cache/impl/DeviceCacheManagerImpl.java index 2e6e3c4d7f..467e9783af 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/cache/impl/DeviceCacheManagerImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/cache/impl/DeviceCacheManagerImpl.java @@ -18,13 +18,13 @@ package io.entgra.device.mgt.core.device.mgt.core.cache.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.core.cache.DeviceCacheKey; import io.entgra.device.mgt.core.device.mgt.core.cache.DeviceCacheManager; import io.entgra.device.mgt.core.device.mgt.core.util.DeviceManagerUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import javax.cache.Cache; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/common/util/FileUtil.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/common/util/FileUtil.java index 4bd3f9455b..cc25b794cb 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/common/util/FileUtil.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/common/util/FileUtil.java @@ -18,8 +18,8 @@ package io.entgra.device.mgt.core.device.mgt.core.common.util; -import org.apache.commons.io.FileUtils; import io.entgra.device.mgt.core.device.mgt.common.Base64File; +import org.apache.commons.io.FileUtils; import java.io.ByteArrayInputStream; import java.io.File; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/common/util/HttpUtil.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/common/util/HttpUtil.java index ecdf63d8c5..13842dad56 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/common/util/HttpUtil.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/common/util/HttpUtil.java @@ -17,13 +17,14 @@ */ package io.entgra.device.mgt.core.device.mgt.core.common.util; +import io.entgra.device.mgt.core.device.mgt.core.common.Constants; import org.apache.commons.codec.binary.Base64; import org.apache.commons.lang.StringUtils; import org.apache.commons.validator.routines.UrlValidator; import org.apache.http.HttpResponse; import org.apache.http.entity.ContentType; import org.apache.http.util.EntityUtils; -import io.entgra.device.mgt.core.device.mgt.core.common.Constants; + import java.io.IOException; import java.net.URI; import java.util.ArrayList; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/common/util/StorageManagementUtil.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/common/util/StorageManagementUtil.java index 979a514db5..3afff2cc08 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/common/util/StorageManagementUtil.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/common/util/StorageManagementUtil.java @@ -18,18 +18,12 @@ package io.entgra.device.mgt.core.device.mgt.core.common.util; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.Base64File; import io.entgra.device.mgt.core.device.mgt.core.common.exception.StorageManagementException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; +import java.io.*; import java.nio.file.Files; /** diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/DeviceConfigurationManager.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/DeviceConfigurationManager.java index 30d4961f99..938ea132b5 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/DeviceConfigurationManager.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/DeviceConfigurationManager.java @@ -18,10 +18,10 @@ package io.entgra.device.mgt.core.device.mgt.core.config; -import org.w3c.dom.Document; import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.core.util.DeviceManagerUtil; +import org.w3c.dom.Document; import org.wso2.carbon.utils.CarbonUtils; import javax.xml.bind.JAXBContext; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/DeviceManagementConfig.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/DeviceManagementConfig.java index 08c08df5ed..e97ee8e108 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/DeviceManagementConfig.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/DeviceManagementConfig.java @@ -26,12 +26,11 @@ import io.entgra.device.mgt.core.device.mgt.core.config.cache.CertificateCacheCo import io.entgra.device.mgt.core.device.mgt.core.config.cache.DeviceCacheConfiguration; import io.entgra.device.mgt.core.device.mgt.core.config.cache.GeoFenceCacheConfiguration; import io.entgra.device.mgt.core.device.mgt.core.config.enrollment.guide.EnrollmentGuideConfiguration; -import io.entgra.device.mgt.core.device.mgt.core.config.operation.timeout.OperationTimeoutConfiguration; -import io.entgra.device.mgt.core.device.mgt.core.config.metadata.mgt.MetaDataConfiguration; -import io.entgra.device.mgt.core.device.mgt.core.event.config.EventOperationTaskConfiguration; import io.entgra.device.mgt.core.device.mgt.core.config.geo.location.GeoLocationConfiguration; import io.entgra.device.mgt.core.device.mgt.core.config.identity.IdentityConfigurations; import io.entgra.device.mgt.core.device.mgt.core.config.keymanager.KeyManagerConfigurations; +import io.entgra.device.mgt.core.device.mgt.core.config.metadata.mgt.MetaDataConfiguration; +import io.entgra.device.mgt.core.device.mgt.core.config.operation.timeout.OperationTimeoutConfiguration; import io.entgra.device.mgt.core.device.mgt.core.config.pagination.PaginationConfiguration; import io.entgra.device.mgt.core.device.mgt.core.config.policy.PolicyConfiguration; import io.entgra.device.mgt.core.device.mgt.core.config.pull.notification.PullNotificationConfiguration; @@ -39,6 +38,7 @@ import io.entgra.device.mgt.core.device.mgt.core.config.push.notification.PushNo import io.entgra.device.mgt.core.device.mgt.core.config.remote.session.RemoteSessionConfiguration; import io.entgra.device.mgt.core.device.mgt.core.config.status.task.DeviceStatusTaskConfig; import io.entgra.device.mgt.core.device.mgt.core.config.task.TaskConfiguration; +import io.entgra.device.mgt.core.device.mgt.core.event.config.EventOperationTaskConfiguration; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/license/LicenseConfigurationManager.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/license/LicenseConfigurationManager.java index e6e7a783db..7a29d37f85 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/license/LicenseConfigurationManager.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/license/LicenseConfigurationManager.java @@ -18,10 +18,10 @@ package io.entgra.device.mgt.core.device.mgt.core.config.license; -import org.w3c.dom.Document; -import io.entgra.device.mgt.core.device.mgt.core.DeviceManagementConstants; import io.entgra.device.mgt.core.device.mgt.common.license.mgt.LicenseManagementException; +import io.entgra.device.mgt.core.device.mgt.core.DeviceManagementConstants; import io.entgra.device.mgt.core.device.mgt.core.util.DeviceManagerUtil; +import org.w3c.dom.Document; import org.wso2.carbon.utils.CarbonUtils; import javax.xml.bind.JAXBContext; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/permission/AnnotationProcessor.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/permission/AnnotationProcessor.java index ef6b5e68a4..e3686ec884 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/permission/AnnotationProcessor.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/permission/AnnotationProcessor.java @@ -19,22 +19,14 @@ package io.entgra.device.mgt.core.device.mgt.core.config.permission; import io.entgra.device.mgt.core.apimgt.annotations.Scopes; +import io.entgra.device.mgt.core.device.mgt.common.permission.mgt.Permission; import io.swagger.annotations.SwaggerDefinition; import org.apache.catalina.core.StandardContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.device.mgt.common.permission.mgt.Permission; import javax.servlet.ServletContext; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.HttpMethod; -import javax.ws.rs.OPTIONS; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; +import javax.ws.rs.*; import java.io.File; import java.io.IOException; import java.lang.annotation.Annotation; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/permission/lifecycle/WebAppDeploymentLifecycleListener.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/permission/lifecycle/WebAppDeploymentLifecycleListener.java index 7160d29ccc..22021627aa 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/permission/lifecycle/WebAppDeploymentLifecycleListener.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/permission/lifecycle/WebAppDeploymentLifecycleListener.java @@ -18,17 +18,17 @@ package io.entgra.device.mgt.core.device.mgt.core.config.permission.lifecycle; +import io.entgra.device.mgt.core.device.mgt.common.permission.mgt.Permission; +import io.entgra.device.mgt.core.device.mgt.common.permission.mgt.PermissionManagementException; +import io.entgra.device.mgt.core.device.mgt.common.permission.mgt.PermissionManagerService; +import io.entgra.device.mgt.core.device.mgt.core.config.permission.AnnotationProcessor; +import io.entgra.device.mgt.core.device.mgt.core.permission.mgt.PermissionManagerServiceImpl; import org.apache.catalina.Lifecycle; import org.apache.catalina.LifecycleEvent; import org.apache.catalina.LifecycleListener; import org.apache.catalina.core.StandardContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.device.mgt.common.permission.mgt.Permission; -import io.entgra.device.mgt.core.device.mgt.common.permission.mgt.PermissionManagementException; -import io.entgra.device.mgt.core.device.mgt.common.permission.mgt.PermissionManagerService; -import io.entgra.device.mgt.core.device.mgt.core.config.permission.AnnotationProcessor; -import io.entgra.device.mgt.core.device.mgt.core.permission.mgt.PermissionManagerServiceImpl; import javax.servlet.ServletContext; import java.io.IOException; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/tenant/PlatformConfigurationManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/tenant/PlatformConfigurationManagementServiceImpl.java index dc8263edda..eaa66e225b 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/tenant/PlatformConfigurationManagementServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/tenant/PlatformConfigurationManagementServiceImpl.java @@ -17,15 +17,15 @@ */ package io.entgra.device.mgt.core.device.mgt.core.config.tenant; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.ConfigurationManagementException; import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.PlatformConfiguration; import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.PlatformConfigurationManagementService; import io.entgra.device.mgt.core.device.mgt.core.config.ConfigurationManagerConstants; import io.entgra.device.mgt.core.device.mgt.core.config.util.ConfigurationManagerUtil; -import org.wso2.carbon.registry.api.Resource; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.wso2.carbon.registry.api.RegistryException; +import org.wso2.carbon.registry.api.Resource; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/ui/UIConfigurationManager.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/ui/UIConfigurationManager.java index b9c6470eb1..c3633df02f 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/ui/UIConfigurationManager.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/ui/UIConfigurationManager.java @@ -18,12 +18,12 @@ package io.entgra.device.mgt.core.device.mgt.core.config.ui; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.w3c.dom.Document; import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.core.util.DeviceManagerUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.w3c.dom.Document; import org.wso2.carbon.utils.CarbonUtils; import javax.xml.bind.JAXBContext; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/util/ConfigurationManagerUtil.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/util/ConfigurationManagerUtil.java index 20262a218a..e30b01657a 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/util/ConfigurationManagerUtil.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/config/util/ConfigurationManagerUtil.java @@ -17,9 +17,9 @@ */ package io.entgra.device.mgt.core.device.mgt.core.config.util; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.ConfigurationManagementException; import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHolder; +import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.registry.api.RegistryException; import org.wso2.carbon.registry.api.Resource; import org.wso2.carbon.registry.core.Registry; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/ApplicationDAO.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/ApplicationDAO.java index ef3d07ee7c..9aa311ec57 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/ApplicationDAO.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/ApplicationDAO.java @@ -18,7 +18,6 @@ package io.entgra.device.mgt.core.device.mgt.core.dao; import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; -import io.entgra.device.mgt.core.device.mgt.common.PaginationResult; import io.entgra.device.mgt.core.device.mgt.common.app.mgt.Application; import java.util.List; @@ -63,4 +62,55 @@ public interface ApplicationDAO { * @throws DeviceManagementDAOException If any database error occured */ List getAppVersions(int tenantId, String packageName) throws DeviceManagementDAOException; + + /** + * This method is used to save application icon information. + * @param iconPath Icon path of the application + * @param packageName Package name of the application + * @param version version of the application + * @throws DeviceManagementDAOException If any database error occurred + */ + void saveApplicationIcon(String iconPath, String packageName, String version, int tenantId) throws DeviceManagementDAOException; + + /** + * This method is used to check the package existence. + * @param packageName Package name of the application + * @throws DeviceManagementDAOException If any database error occurred + */ + int getApplicationPackageCount(String packageName) throws DeviceManagementDAOException; + + /** + * This method is used to update application icon information. + * @param iconPath Icon path of the application + * @param oldPackageName Old package name of the application + * @param newPackageName New package name of the application + * @param version Version of the application + * @throws DeviceManagementDAOException If any database error occurred + */ + void updateApplicationIcon(String iconPath, String oldPackageName, String newPackageName, String version) throws DeviceManagementDAOException; + + /** + * This method is used to delete application icon information. + * @param packageName Package name of the application + * @throws DeviceManagementDAOException If any database error occurred + */ + void deleteApplicationIcon(String packageName) throws DeviceManagementDAOException; + + /** + * This method is used to get the installed application list of a specific device + * @param deviceId ID of the device + * @param enrolmentId Enrolment ID of the device + * @param tenantId tenant ID + * @throws DeviceManagementDAOException If any database error occurred + */ + List getInstalledApplicationListOnDevice(int deviceId, int enrolmentId, int offset, int limit, int tenantId) + throws DeviceManagementDAOException; + + /** + * This method is used to retrieve the icon info of an installed app in device. + * @param applicationIdentifier application identifier. + * @return returns the application icon path. + * @throws DeviceManagementDAOException + */ + String getIconPath(String applicationIdentifier) throws DeviceManagementDAOException; } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/DeviceDAO.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/DeviceDAO.java index 68e475d2a4..fa58ba9f4f 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/DeviceDAO.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/DeviceDAO.java @@ -18,16 +18,16 @@ package io.entgra.device.mgt.core.device.mgt.core.dao; -import org.apache.commons.collections.map.SingletonMap; import io.entgra.device.mgt.core.device.mgt.common.*; import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo.Status; import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.DevicePropertyInfo; import io.entgra.device.mgt.core.device.mgt.common.device.details.DeviceData; import io.entgra.device.mgt.core.device.mgt.common.device.details.DeviceLocationHistorySnapshot; import io.entgra.device.mgt.core.device.mgt.common.device.details.DeviceMonitoringData; +import io.entgra.device.mgt.core.device.mgt.common.geo.service.GeoCluster; import io.entgra.device.mgt.core.device.mgt.common.geo.service.GeoQuery; import io.entgra.device.mgt.core.device.mgt.core.dto.DeviceType; -import io.entgra.device.mgt.core.device.mgt.common.geo.service.GeoCluster; +import org.apache.commons.collections.map.SingletonMap; import java.sql.SQLException; import java.sql.Timestamp; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/DeviceManagementDAOFactory.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/DeviceManagementDAOFactory.java index 7b105df14d..1b2a48662a 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/DeviceManagementDAOFactory.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/DeviceManagementDAOFactory.java @@ -18,15 +18,15 @@ package io.entgra.device.mgt.core.device.mgt.core.dao; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; import io.entgra.device.mgt.core.device.mgt.common.exceptions.IllegalTransactionStateException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.TransactionManagementException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.UnsupportedDatabaseEngineException; import io.entgra.device.mgt.core.device.mgt.core.config.datasource.DataSourceConfig; import io.entgra.device.mgt.core.device.mgt.core.config.datasource.JNDILookupDefinition; -import io.entgra.device.mgt.core.device.mgt.core.dao.impl.*; +import io.entgra.device.mgt.core.device.mgt.core.dao.impl.ApplicationDAOImpl; +import io.entgra.device.mgt.core.device.mgt.core.dao.impl.DeviceStatusDAOImpl; +import io.entgra.device.mgt.core.device.mgt.core.dao.impl.DeviceTypeDAOImpl; import io.entgra.device.mgt.core.device.mgt.core.dao.impl.device.GenericDeviceDAOImpl; import io.entgra.device.mgt.core.device.mgt.core.dao.impl.device.OracleDeviceDAOImpl; import io.entgra.device.mgt.core.device.mgt.core.dao.impl.device.PostgreSQLDeviceDAOImpl; @@ -39,6 +39,8 @@ import io.entgra.device.mgt.core.device.mgt.core.device.details.mgt.dao.DeviceDe import io.entgra.device.mgt.core.device.mgt.core.device.details.mgt.dao.impl.DeviceDetailsDAOImpl; import io.entgra.device.mgt.core.device.mgt.core.privacy.dao.PrivacyComplianceDAO; import io.entgra.device.mgt.core.device.mgt.core.privacy.dao.impl.PrivacyComplianceDAOImpl; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import javax.sql.DataSource; import java.sql.Connection; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/DeviceStatusDAO.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/DeviceStatusDAO.java index bee39b3a99..0ee8d7cfa5 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/DeviceStatusDAO.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/DeviceStatusDAO.java @@ -17,9 +17,6 @@ */ package io.entgra.device.mgt.core.device.mgt.core.dao; -import io.entgra.device.mgt.core.device.mgt.common.Device; -import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; -import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo.Status; import io.entgra.device.mgt.core.device.mgt.common.type.mgt.DeviceStatus; import java.util.Date; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/EnrollmentDAO.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/EnrollmentDAO.java index c6fd1828bc..0f68650b3c 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/EnrollmentDAO.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/EnrollmentDAO.java @@ -21,7 +21,6 @@ import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo.Status; -import java.sql.Timestamp; import java.util.List; public interface EnrollmentDAO { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/EventConfigDAO.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/EventConfigDAO.java index f2c0a263fd..49b4668590 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/EventConfigDAO.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/EventConfigDAO.java @@ -21,7 +21,6 @@ package io.entgra.device.mgt.core.device.mgt.core.dao; import io.entgra.device.mgt.core.device.mgt.common.event.config.EventConfig; import java.util.List; -import java.util.Map; public interface EventConfigDAO { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/GroupDAO.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/GroupDAO.java index 8176e59f72..16ac6f62be 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/GroupDAO.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/GroupDAO.java @@ -21,7 +21,6 @@ package io.entgra.device.mgt.core.device.mgt.core.dao; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.GroupPaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.ReportManagementException; import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/GroupManagementDAOFactory.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/GroupManagementDAOFactory.java index 6026badab5..68923d6d5c 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/GroupManagementDAOFactory.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/GroupManagementDAOFactory.java @@ -18,8 +18,6 @@ package io.entgra.device.mgt.core.device.mgt.core.dao; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; import io.entgra.device.mgt.core.device.mgt.common.exceptions.IllegalTransactionStateException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.TransactionManagementException; @@ -31,6 +29,8 @@ import io.entgra.device.mgt.core.device.mgt.core.dao.impl.group.OracleGroupDAOIm import io.entgra.device.mgt.core.device.mgt.core.dao.impl.group.PostgreSQLGroupDAOImpl; import io.entgra.device.mgt.core.device.mgt.core.dao.impl.group.SQLServerGroupDAOImpl; import io.entgra.device.mgt.core.device.mgt.core.dao.util.GroupManagementDAOUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import javax.sql.DataSource; import java.sql.Connection; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/TrackerManagementDAOFactory.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/TrackerManagementDAOFactory.java index 87755c5dd1..200012e73f 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/TrackerManagementDAOFactory.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/TrackerManagementDAOFactory.java @@ -18,8 +18,6 @@ package io.entgra.device.mgt.core.device.mgt.core.dao; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; import io.entgra.device.mgt.core.device.mgt.common.exceptions.IllegalTransactionStateException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.TransactionManagementException; @@ -28,6 +26,8 @@ import io.entgra.device.mgt.core.device.mgt.core.config.datasource.DataSourceCon import io.entgra.device.mgt.core.device.mgt.core.config.datasource.JNDILookupDefinition; import io.entgra.device.mgt.core.device.mgt.core.dao.impl.tracker.TrackerDAOImpl; import io.entgra.device.mgt.core.device.mgt.core.dao.util.DeviceManagementDAOUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import javax.sql.DataSource; import java.sql.Connection; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractDeviceDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractDeviceDAOImpl.java index 72af9f3d1c..d5679e796e 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractDeviceDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractDeviceDAOImpl.java @@ -18,9 +18,6 @@ package io.entgra.device.mgt.core.device.mgt.core.dao.impl; -import org.apache.commons.collections.map.SingletonMap; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; @@ -30,28 +27,21 @@ import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.DevicePrope import io.entgra.device.mgt.core.device.mgt.common.device.details.DeviceData; import io.entgra.device.mgt.core.device.mgt.common.device.details.DeviceLocationHistorySnapshot; import io.entgra.device.mgt.core.device.mgt.common.device.details.DeviceMonitoringData; +import io.entgra.device.mgt.core.device.mgt.common.geo.service.GeoCluster; +import io.entgra.device.mgt.core.device.mgt.common.geo.service.GeoCoordinate; import io.entgra.device.mgt.core.device.mgt.common.geo.service.GeoQuery; import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceDAO; import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOException; import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.dao.util.DeviceManagementDAOUtil; import io.entgra.device.mgt.core.device.mgt.core.dto.DeviceType; -import io.entgra.device.mgt.core.device.mgt.common.geo.service.GeoCluster; -import io.entgra.device.mgt.core.device.mgt.common.geo.service.GeoCoordinate; +import org.apache.commons.collections.map.SingletonMap; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.LogFactory; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; +import java.sql.*; import java.util.Date; -import java.util.List; -import java.util.Map; -import java.util.StringJoiner; +import java.util.*; public abstract class AbstractDeviceDAOImpl implements DeviceDAO { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractEnrollmentDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractEnrollmentDAOImpl.java index 456dca9c8a..7419a75cb2 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractEnrollmentDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractEnrollmentDAOImpl.java @@ -17,7 +17,6 @@ */ package io.entgra.device.mgt.core.device.mgt.core.dao.impl; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; @@ -25,13 +24,9 @@ import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOExceptio import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.dao.EnrollmentDAO; import io.entgra.device.mgt.core.device.mgt.core.dao.util.DeviceManagementDAOUtil; +import org.wso2.carbon.context.PrivilegedCarbonContext; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.sql.Timestamp; +import java.sql.*; import java.util.ArrayList; import java.util.Date; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractEventConfigDAO.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractEventConfigDAO.java index e5780003d1..6e3b69a1ce 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractEventConfigDAO.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractEventConfigDAO.java @@ -18,24 +18,20 @@ package io.entgra.device.mgt.core.device.mgt.core.dao.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.event.config.EventConfig; -import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.dao.EventConfigDAO; import io.entgra.device.mgt.core.device.mgt.core.dao.EventManagementDAOException; import io.entgra.device.mgt.core.device.mgt.core.dao.EventManagementDAOFactory; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; -import java.sql.Timestamp; import java.util.ArrayList; import java.util.Collections; -import java.util.HashMap; import java.util.List; -import java.util.Map; public abstract class AbstractEventConfigDAO implements EventConfigDAO { private static final Log log = LogFactory.getLog(AbstractEventConfigDAO.class); diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGeofenceDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGeofenceDAOImpl.java index c575ea60dc..2b52de02e0 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGeofenceDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGeofenceDAOImpl.java @@ -18,8 +18,6 @@ package io.entgra.device.mgt.core.device.mgt.core.dao.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.event.config.EventConfig; @@ -28,21 +26,12 @@ import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOExceptio import io.entgra.device.mgt.core.device.mgt.core.dao.EventManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.dao.GeofenceDAO; import io.entgra.device.mgt.core.device.mgt.core.dto.event.config.GeoFenceGroupMap; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.Collections; +import java.sql.*; import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.*; public abstract class AbstractGeofenceDAOImpl implements GeofenceDAO { private static final Log log = LogFactory.getLog(AbstractGeofenceDAOImpl.class); diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java index b8196c6e03..803526e593 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java @@ -18,9 +18,6 @@ package io.entgra.device.mgt.core.device.mgt.core.dao.impl; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.GroupPaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; @@ -30,16 +27,15 @@ import io.entgra.device.mgt.core.device.mgt.core.dao.GroupManagementDAOException import io.entgra.device.mgt.core.device.mgt.core.dao.GroupManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.dao.util.DeviceManagementDAOUtil; import io.entgra.device.mgt.core.device.mgt.core.dao.util.GroupManagementDAOUtil; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.sql.Connection; 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; -import java.util.StringJoiner; +import java.util.*; /** * This class represents implementation of GroupDAO diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/ApplicationDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/ApplicationDAOImpl.java index 3b4bb1642e..56ab396c4b 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/ApplicationDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/ApplicationDAOImpl.java @@ -17,15 +17,14 @@ */ package io.entgra.device.mgt.core.device.mgt.core.dao.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.app.mgt.Application; import io.entgra.device.mgt.core.device.mgt.core.dao.ApplicationDAO; import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOException; import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.dao.util.DeviceManagementDAOUtil; - +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.io.ByteArrayInputStream; import java.io.IOException; @@ -34,7 +33,9 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; +import java.sql.Timestamp; import java.util.ArrayList; +import java.util.Date; import java.util.List; import java.util.Properties; @@ -394,4 +395,178 @@ public class ApplicationDAOImpl implements ApplicationDAO { return application; } + @Override + public void saveApplicationIcon(String iconPath, String packageName, String version, int tenantId) + throws DeviceManagementDAOException{ + Connection conn; + String sql = "INSERT INTO DM_APP_ICONS " + + "(ICON_PATH, " + + "PACKAGE_NAME, " + + "VERSION, " + + "CREATED_TIMESTAMP, " + + "TENANT_ID) " + + "VALUES (?, ?, ?, ?, ?)"; + try { + conn = this.getConnection(); + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setString(1,iconPath); + stmt.setString(2,packageName); + stmt.setString(3,version); + stmt.setTimestamp(4, new Timestamp(new Date().getTime())); + stmt.setInt(5, tenantId); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while saving application icon details"; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + } + + @Override + public int getApplicationPackageCount(String packageName) throws DeviceManagementDAOException{ + Connection conn; + String sql = "SELECT " + + "COUNT(*) AS APP_PACKAGE_COUNT " + + "FROM DM_APP_ICONS " + + "WHERE PACKAGE_NAME = ?"; + try { + conn = this.getConnection(); + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setString(1, packageName); + try (ResultSet rs = stmt.executeQuery()) { + if (rs.next()) { + return rs.getInt("APP_PACKAGE_COUNT"); + } + return 0; + } + } + } catch (SQLException e) { + String msg = "Error occurred while getting application icon details"; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + } + + @Override + public void updateApplicationIcon(String iconPath, String oldPackageName, String newPackageName, String version) + throws DeviceManagementDAOException{ + Connection conn; + String sql = "UPDATE DM_APP_ICONS " + + "SET " + + "ICON_PATH= ?, " + + "PACKAGE_NAME = ?, " + + "VERSION = ? " + + "WHERE PACKAGE_NAME = ?"; + try { + conn = this.getConnection(); + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setString(1,iconPath); + stmt.setString(2,newPackageName); + stmt.setString(3,version); + stmt.setString(4,oldPackageName); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while updating application icon details"; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + } + + @Override + public void deleteApplicationIcon(String packageName) throws DeviceManagementDAOException { + Connection conn; + String sql = "DELETE " + + "FROM DM_APP_ICONS " + + "WHERE PACKAGE_NAME = ?"; + try { + conn = this.getConnection(); + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setString(1, packageName); + stmt.executeUpdate(); + } + } catch (SQLException e) { + String msg = "Error occurred while deleting application icon details"; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + } + + @Override + public String getIconPath(String applicationIdentifier) throws DeviceManagementDAOException{ + Connection conn; + String sql = "SELECT " + + "ICON_PATH " + + "FROM DM_APP_ICONS " + + "WHERE PACKAGE_NAME = ?"; + String iconPath = null; + try { + conn = this.getConnection(); + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setString(1,applicationIdentifier); + try (ResultSet rs = stmt.executeQuery()) { + if (rs.next()) { + iconPath = rs.getString("ICON_PATH"); + } + return iconPath; + } + } + } catch (SQLException e) { + String msg = "Error occurred while retrieving app icon path of the application"; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + } + + @Override + public List getInstalledApplicationListOnDevice(int deviceId, int enrolmentId, int offset, int limit, int tenantId) + throws DeviceManagementDAOException { + Connection conn; + List applicationList = new ArrayList<>(); + Application application; + String sql = "SELECT " + + "ID, " + + "NAME, " + + "APP_IDENTIFIER, " + + "PLATFORM, " + + "CATEGORY, " + + "VERSION, " + + "TYPE, " + + "LOCATION_URL, " + + "IMAGE_URL, " + + "APP_PROPERTIES, " + + "MEMORY_USAGE, " + + "IS_ACTIVE, " + + "TENANT_ID " + + "FROM DM_APPLICATION " + + "WHERE DEVICE_ID = ? AND " + + "ENROLMENT_ID = ? AND " + + "TENANT_ID = ? " + + "LIMIT ? " + + "OFFSET ?"; + try { + conn = this.getConnection(); + try (PreparedStatement stmt = conn.prepareStatement(sql)) { + stmt.setInt(1, deviceId); + stmt.setInt(2, enrolmentId); + stmt.setInt(3, tenantId); + stmt.setInt(4, limit); + stmt.setInt(5, offset); + try (ResultSet rs = stmt.executeQuery()) { + while (rs.next()) { + application = loadApplication(rs); + applicationList.add(application); + } + } + } + + } catch (SQLException e) { + String msg = "SQL Error occurred while retrieving the list of Applications " + + "installed in device id '" + deviceId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + return applicationList; + } } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/DeviceStatusDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/DeviceStatusDAOImpl.java index 4657b7e119..8206a36066 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/DeviceStatusDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/DeviceStatusDAOImpl.java @@ -23,7 +23,6 @@ import io.entgra.device.mgt.core.device.mgt.common.type.mgt.DeviceStatus; import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOException; import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceStatusDAO; -import io.entgra.device.mgt.core.device.mgt.core.dao.EnrollmentDAO; import io.entgra.device.mgt.core.device.mgt.core.dao.util.DeviceManagementDAOUtil; import java.sql.*; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/DeviceTypeDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/DeviceTypeDAOImpl.java index 28e5a473b2..04a4316647 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/DeviceTypeDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/DeviceTypeDAOImpl.java @@ -19,9 +19,6 @@ package io.entgra.device.mgt.core.device.mgt.core.dao.impl; import com.google.gson.Gson; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.type.mgt.DeviceTypeMetaDefinition; import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOException; @@ -30,19 +27,11 @@ import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceTypeDAO; import io.entgra.device.mgt.core.device.mgt.core.dao.util.DeviceManagementDAOUtil; import io.entgra.device.mgt.core.device.mgt.core.dto.DeviceType; import io.entgra.device.mgt.core.device.mgt.core.dto.DeviceTypeVersion; -import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderServiceImpl; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.io.PrintWriter; -import java.nio.file.Files; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Timestamp; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.sql.*; import java.util.ArrayList; import java.util.Date; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/GenericDeviceDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/GenericDeviceDAOImpl.java index 8869be2f50..3021b2f955 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/GenericDeviceDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/GenericDeviceDAOImpl.java @@ -18,25 +18,17 @@ package io.entgra.device.mgt.core.device.mgt.core.dao.impl.device; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.device.mgt.common.Count; -import io.entgra.device.mgt.core.device.mgt.common.Device; -import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; -import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; -import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; +import io.entgra.device.mgt.core.device.mgt.common.*; import io.entgra.device.mgt.core.device.mgt.common.device.details.DeviceInfo; import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOException; import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.dao.impl.AbstractDeviceDAOImpl; import io.entgra.device.mgt.core.device.mgt.core.dao.util.DeviceManagementDAOUtil; import io.entgra.device.mgt.core.device.mgt.core.report.mgt.Constants; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Timestamp; +import java.sql.*; import java.util.ArrayList; import java.util.Date; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/OracleDeviceDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/OracleDeviceDAOImpl.java index 722a19b4bf..124039c057 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/OracleDeviceDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/OracleDeviceDAOImpl.java @@ -18,12 +18,8 @@ package io.entgra.device.mgt.core.device.mgt.core.dao.impl.device; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.Count; import io.entgra.device.mgt.core.device.mgt.common.Device; -import io.entgra.device.mgt.core.device.mgt.common.DeviceBilling; import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.device.details.DeviceInfo; import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOException; @@ -31,13 +27,11 @@ import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.dao.impl.AbstractDeviceDAOImpl; import io.entgra.device.mgt.core.device.mgt.core.dao.util.DeviceManagementDAOUtil; import io.entgra.device.mgt.core.device.mgt.core.report.mgt.Constants; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Timestamp; +import java.sql.*; import java.util.ArrayList; import java.util.Date; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/PostgreSQLDeviceDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/PostgreSQLDeviceDAOImpl.java index 7b0cd9369b..f1b0ec91bb 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/PostgreSQLDeviceDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/PostgreSQLDeviceDAOImpl.java @@ -18,12 +18,8 @@ package io.entgra.device.mgt.core.device.mgt.core.dao.impl.device; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.Count; import io.entgra.device.mgt.core.device.mgt.common.Device; -import io.entgra.device.mgt.core.device.mgt.common.DeviceBilling; import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.device.details.DeviceInfo; import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOException; @@ -31,12 +27,10 @@ import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.dao.impl.AbstractDeviceDAOImpl; import io.entgra.device.mgt.core.device.mgt.core.dao.util.DeviceManagementDAOUtil; import io.entgra.device.mgt.core.device.mgt.core.report.mgt.Constants; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Timestamp; +import java.sql.*; import java.util.ArrayList; import java.util.Date; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/SQLServerDeviceDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/SQLServerDeviceDAOImpl.java index 3a7f0f95b9..1cbf9fe4d8 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/SQLServerDeviceDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/device/SQLServerDeviceDAOImpl.java @@ -18,27 +18,20 @@ package io.entgra.device.mgt.core.device.mgt.core.dao.impl.device; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.Count; import io.entgra.device.mgt.core.device.mgt.common.Device; -import io.entgra.device.mgt.core.device.mgt.common.DeviceBilling; import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.device.details.DeviceInfo; import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOException; import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.dao.impl.AbstractDeviceDAOImpl; import io.entgra.device.mgt.core.device.mgt.core.dao.util.DeviceManagementDAOUtil; -import io.entgra.device.mgt.core.device.mgt.common.geo.service.GeoCluster; -import io.entgra.device.mgt.core.device.mgt.common.geo.service.GeoCoordinate; import io.entgra.device.mgt.core.device.mgt.core.report.mgt.Constants; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Timestamp; +import java.sql.*; import java.util.ArrayList; import java.util.Date; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/enrolment/GenericEnrollmentDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/enrolment/GenericEnrollmentDAOImpl.java index 452e1a1b30..5971119204 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/enrolment/GenericEnrollmentDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/enrolment/GenericEnrollmentDAOImpl.java @@ -17,7 +17,6 @@ */ package io.entgra.device.mgt.core.device.mgt.core.dao.impl.enrolment; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; @@ -25,6 +24,7 @@ import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOExceptio import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.dao.impl.AbstractEnrollmentDAOImpl; import io.entgra.device.mgt.core.device.mgt.core.dao.util.DeviceManagementDAOUtil; +import org.wso2.carbon.context.PrivilegedCarbonContext; import java.sql.*; import java.util.ArrayList; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/enrolment/SQLServerEnrollmentDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/enrolment/SQLServerEnrollmentDAOImpl.java index cd5d846df9..58b6f7e613 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/enrolment/SQLServerEnrollmentDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/enrolment/SQLServerEnrollmentDAOImpl.java @@ -17,7 +17,6 @@ */ package io.entgra.device.mgt.core.device.mgt.core.dao.impl.enrolment; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; @@ -25,6 +24,8 @@ import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOExceptio import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.dao.impl.AbstractEnrollmentDAOImpl; import io.entgra.device.mgt.core.device.mgt.core.dao.util.DeviceManagementDAOUtil; +import org.wso2.carbon.context.PrivilegedCarbonContext; + import java.sql.*; import java.util.ArrayList; import java.util.Date; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/event/GenericEventConfigDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/event/GenericEventConfigDAOImpl.java index 450dcdf012..74cce2b8a9 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/event/GenericEventConfigDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/event/GenericEventConfigDAOImpl.java @@ -18,19 +18,14 @@ package io.entgra.device.mgt.core.device.mgt.core.dao.impl.event; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.event.config.EventConfig; import io.entgra.device.mgt.core.device.mgt.core.dao.EventManagementDAOException; import io.entgra.device.mgt.core.device.mgt.core.dao.EventManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.dao.impl.AbstractEventConfigDAO; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.sql.Timestamp; +import java.sql.*; import java.util.ArrayList; import java.util.Date; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/event/H2EventConfigDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/event/H2EventConfigDAOImpl.java index c7d2e994f4..3e3b6edc76 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/event/H2EventConfigDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/event/H2EventConfigDAOImpl.java @@ -18,20 +18,14 @@ package io.entgra.device.mgt.core.device.mgt.core.dao.impl.event; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.event.config.EventConfig; -import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.dao.EventManagementDAOException; import io.entgra.device.mgt.core.device.mgt.core.dao.EventManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.dao.impl.AbstractEventConfigDAO; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.sql.Timestamp; +import java.sql.*; import java.util.ArrayList; import java.util.Date; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/geofence/GenericGeofenceDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/geofence/GenericGeofenceDAOImpl.java index cebd70012d..404129598a 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/geofence/GenericGeofenceDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/geofence/GenericGeofenceDAOImpl.java @@ -18,17 +18,16 @@ package io.entgra.device.mgt.core.device.mgt.core.dao.impl.geofence; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.event.config.EventConfig; import io.entgra.device.mgt.core.device.mgt.common.geo.service.GeofenceData; import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOException; import io.entgra.device.mgt.core.device.mgt.core.dao.EventManagementDAOFactory; -import io.entgra.device.mgt.core.device.mgt.core.dao.GeofenceDAO; import io.entgra.device.mgt.core.device.mgt.core.dao.impl.AbstractGeofenceDAOImpl; import io.entgra.device.mgt.core.device.mgt.core.dto.event.config.GeoFenceGroupMap; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.sql.*; import java.util.Date; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/geofence/SQLServerGeofenceDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/geofence/SQLServerGeofenceDAOImpl.java index 56d56593b5..fa04264286 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/geofence/SQLServerGeofenceDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/geofence/SQLServerGeofenceDAOImpl.java @@ -22,17 +22,20 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; -import io.entgra.device.mgt.core.device.mgt.common.event.config.EventConfig; import io.entgra.device.mgt.core.device.mgt.common.geo.service.GeofenceData; import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOException; import io.entgra.device.mgt.core.device.mgt.core.dao.EventManagementDAOFactory; -import io.entgra.device.mgt.core.device.mgt.core.dao.GeofenceDAO; import io.entgra.device.mgt.core.device.mgt.core.dao.impl.AbstractGeofenceDAOImpl; -import io.entgra.device.mgt.core.device.mgt.core.dto.event.config.GeoFenceGroupMap; +import org.wso2.carbon.context.CarbonContext; -import java.sql.*; -import java.util.Date; -import java.util.*; +import java.sql.Connection; +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; public class SQLServerGeofenceDAOImpl extends AbstractGeofenceDAOImpl { private static final Log log = LogFactory.getLog(SQLServerGeofenceDAOImpl.class); @@ -106,4 +109,61 @@ public class SQLServerGeofenceDAOImpl extends AbstractGeofenceDAOImpl { } return geofenceDataList; } + + @Override + public GeofenceData getGeofence(int fenceId, boolean requireGroupData) throws DeviceManagementDAOException { + if (!requireGroupData) { + return getGeofence(fenceId); + } + int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); + try { + Connection con = this.getConnection(); + String sql = "SELECT " + + "G.ID AS FENCE_ID, " + + "FENCE_NAME, " + + "G.DESCRIPTION, " + + "LATITUDE, " + + "LONGITUDE, " + + "RADIUS, " + + "GEO_JSON, " + + "FENCE_SHAPE, " + + "M.GROUP_ID AS GROUP_ID, " + + "GR.GROUP_NAME " + + "FROM DM_GEOFENCE G, DM_GEOFENCE_GROUP_MAPPING M, DM_GROUP GR " + + "WHERE G.ID = M.FENCE_ID " + + "AND M.GROUP_ID = GR.ID " + + "AND G.ID = ? " + + "AND G.TENANT_ID = ?"; + try (PreparedStatement stmt = con.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY)) { + stmt.setInt(1, fenceId); + stmt.setInt(2, tenantId); + try (ResultSet rst = stmt.executeQuery()) { + Map groupMap = new HashMap<>(); + GeofenceData geofenceData = null; + while (rst.next()) { + groupMap.put(rst.getInt("GROUP_ID"), rst.getString("GROUP_NAME")); + } + if (!groupMap.isEmpty()) { + rst.beforeFirst(); + rst.next(); + geofenceData = new GeofenceData(); + geofenceData.setId(rst.getInt("FENCE_ID")); + geofenceData.setFenceName(rst.getString("FENCE_NAME")); + geofenceData.setDescription(rst.getString("DESCRIPTION")); + geofenceData.setLatitude(rst.getDouble("LATITUDE")); + geofenceData.setLongitude(rst.getDouble("LONGITUDE")); + geofenceData.setRadius(rst.getFloat("RADIUS")); + geofenceData.setGeoJson(rst.getString("GEO_JSON")); + geofenceData.setFenceShape(rst.getString("FENCE_SHAPE")); + geofenceData.setGroupData(groupMap); + } + return geofenceData; + } + } + } catch (SQLException e) { + String msg = "Error occurred while retrieving Geo fence data " + fenceId; + log.error(msg, e); + throw new DeviceManagementDAOException(msg, e); + } + } } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/group/OracleGroupDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/group/OracleGroupDAOImpl.java index b5a927a30f..ae070fcdff 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/group/OracleGroupDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/group/OracleGroupDAOImpl.java @@ -18,7 +18,6 @@ package io.entgra.device.mgt.core.device.mgt.core.dao.impl.group; -import org.apache.commons.lang.StringUtils; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.GroupPaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup; @@ -27,6 +26,7 @@ import io.entgra.device.mgt.core.device.mgt.core.dao.GroupManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.dao.impl.AbstractGroupDAOImpl; import io.entgra.device.mgt.core.device.mgt.core.dao.util.DeviceManagementDAOUtil; import io.entgra.device.mgt.core.device.mgt.core.dao.util.GroupManagementDAOUtil; +import org.apache.commons.lang.StringUtils; import java.sql.Connection; import java.sql.PreparedStatement; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/group/PostgreSQLGroupDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/group/PostgreSQLGroupDAOImpl.java index 9dd23da5c0..f2aeaed327 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/group/PostgreSQLGroupDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/group/PostgreSQLGroupDAOImpl.java @@ -18,7 +18,6 @@ package io.entgra.device.mgt.core.device.mgt.core.dao.impl.group; -import org.apache.solr.common.StringUtils; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup; import io.entgra.device.mgt.core.device.mgt.core.dao.GroupManagementDAOException; @@ -26,6 +25,7 @@ import io.entgra.device.mgt.core.device.mgt.core.dao.GroupManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.dao.impl.AbstractGroupDAOImpl; import io.entgra.device.mgt.core.device.mgt.core.dao.util.DeviceManagementDAOUtil; import io.entgra.device.mgt.core.device.mgt.core.dao.util.GroupManagementDAOUtil; +import org.apache.solr.common.StringUtils; import java.sql.Connection; import java.sql.PreparedStatement; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/group/SQLServerGroupDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/group/SQLServerGroupDAOImpl.java index 87d649a6f8..b54d0e3ea4 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/group/SQLServerGroupDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/group/SQLServerGroupDAOImpl.java @@ -18,7 +18,6 @@ package io.entgra.device.mgt.core.device.mgt.core.dao.impl.group; -import org.apache.commons.lang.StringUtils; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.GroupPaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup; @@ -27,6 +26,7 @@ import io.entgra.device.mgt.core.device.mgt.core.dao.GroupManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.dao.impl.AbstractGroupDAOImpl; import io.entgra.device.mgt.core.device.mgt.core.dao.util.DeviceManagementDAOUtil; import io.entgra.device.mgt.core.device.mgt.core.dao.util.GroupManagementDAOUtil; +import org.apache.commons.lang.StringUtils; import java.sql.Connection; import java.sql.PreparedStatement; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/tracker/TrackerDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/tracker/TrackerDAOImpl.java index 6039dee55f..2debb25a38 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/tracker/TrackerDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/tracker/TrackerDAOImpl.java @@ -18,18 +18,16 @@ package io.entgra.device.mgt.core.device.mgt.core.dao.impl.tracker; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.TrackerDeviceInfo; import io.entgra.device.mgt.core.device.mgt.common.TrackerGroupInfo; import io.entgra.device.mgt.core.device.mgt.common.TrackerPermissionInfo; -import io.entgra.device.mgt.core.device.mgt.core.dao.TrackerManagementDAOFactory; -import io.entgra.device.mgt.core.device.mgt.core.dao.TrackerManagementDAOException; import io.entgra.device.mgt.core.device.mgt.core.dao.TrackerDAO; -import io.entgra.device.mgt.core.device.mgt.core.dao.util.DeviceManagementDAOUtil; +import io.entgra.device.mgt.core.device.mgt.core.dao.TrackerManagementDAOException; +import io.entgra.device.mgt.core.device.mgt.core.dao.TrackerManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.dao.util.TrackerManagementDAOUtil; import io.entgra.device.mgt.core.device.mgt.core.traccar.common.TraccarHandlerConstants; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.sql.Connection; import java.sql.PreparedStatement; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/util/DeviceManagementDAOUtil.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/util/DeviceManagementDAOUtil.java index 0d2d563f34..5ef0222258 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/util/DeviceManagementDAOUtil.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/util/DeviceManagementDAOUtil.java @@ -17,34 +17,32 @@ */ package io.entgra.device.mgt.core.device.mgt.core.dao.util; -import java.sql.*; -import java.time.Instant; -import java.time.LocalDateTime; -import java.time.ZoneId; -import java.util.*; -import java.util.Date; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.el.lang.ELSupport; -import org.wso2.carbon.context.CarbonContext; import io.entgra.device.mgt.core.device.mgt.common.Device; -import io.entgra.device.mgt.core.device.mgt.common.DeviceBilling; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; import io.entgra.device.mgt.core.device.mgt.common.device.details.DeviceInfo; import io.entgra.device.mgt.core.device.mgt.common.device.details.DeviceLocationHistorySnapshot; import io.entgra.device.mgt.core.device.mgt.common.device.details.DeviceMonitoringData; -import io.entgra.device.mgt.core.device.mgt.common.type.mgt.DeviceStatus; import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOException; import io.entgra.device.mgt.core.device.mgt.core.dto.DeviceType; import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHolder; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.user.core.tenant.TenantManager; import org.wso2.carbon.utils.multitenancy.MultitenantConstants; import javax.naming.InitialContext; import javax.sql.DataSource; +import java.sql.*; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.Date; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Map; public final class DeviceManagementDAOUtil { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/util/GroupManagementDAOUtil.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/util/GroupManagementDAOUtil.java index f5b8f4ce4a..acf8d4c614 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/util/GroupManagementDAOUtil.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/util/GroupManagementDAOUtil.java @@ -18,9 +18,9 @@ package io.entgra.device.mgt.core.device.mgt.core.dao.util; +import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup; import javax.naming.InitialContext; import javax.sql.DataSource; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/util/TrackerManagementDAOUtil.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/util/TrackerManagementDAOUtil.java index f7404d37b2..8bbaed0959 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/util/TrackerManagementDAOUtil.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/util/TrackerManagementDAOUtil.java @@ -18,12 +18,12 @@ package io.entgra.device.mgt.core.device.mgt.core.dao.util; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.TrackerDeviceInfo; import io.entgra.device.mgt.core.device.mgt.common.TrackerGroupInfo; import io.entgra.device.mgt.core.device.mgt.common.TrackerPermissionInfo; import io.entgra.device.mgt.core.device.mgt.core.dao.TrackerManagementDAOException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import javax.naming.InitialContext; import javax.sql.DataSource; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/DeviceInformationManager.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/DeviceInformationManager.java index 1da701f09e..672ecb6af1 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/DeviceInformationManager.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/DeviceInformationManager.java @@ -21,10 +21,8 @@ package io.entgra.device.mgt.core.device.mgt.core.device.details.mgt; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; -import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; import io.entgra.device.mgt.core.device.mgt.common.device.details.DeviceInfo; import io.entgra.device.mgt.core.device.mgt.common.device.details.DeviceLocation; -import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOException; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/dao/DeviceDetailsDAO.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/dao/DeviceDetailsDAO.java index bba9c7b037..13a9c038d2 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/dao/DeviceDetailsDAO.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/dao/DeviceDetailsDAO.java @@ -20,7 +20,6 @@ package io.entgra.device.mgt.core.device.mgt.core.device.details.mgt.dao; import io.entgra.device.mgt.core.device.mgt.common.Device; -import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; import io.entgra.device.mgt.core.device.mgt.common.device.details.DeviceInfo; import io.entgra.device.mgt.core.device.mgt.common.device.details.DeviceLocation; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/dao/impl/DeviceDetailsDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/dao/impl/DeviceDetailsDAOImpl.java index e81a98ba35..c53d9526cc 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/dao/impl/DeviceDetailsDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/dao/impl/DeviceDetailsDAOImpl.java @@ -19,18 +19,17 @@ package io.entgra.device.mgt.core.device.mgt.core.device.details.mgt.dao.impl; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.device.details.DeviceInfo; import io.entgra.device.mgt.core.device.mgt.common.device.details.DeviceLocation; -import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOException; import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.dao.util.DeviceManagementDAOUtil; import io.entgra.device.mgt.core.device.mgt.core.device.details.mgt.dao.DeviceDetailsDAO; import io.entgra.device.mgt.core.device.mgt.core.device.details.mgt.dao.DeviceDetailsMgtDAOException; import io.entgra.device.mgt.core.device.mgt.core.geo.geoHash.GeoHashGenerator; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.sql.Connection; import java.sql.PreparedStatement; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java index a719273d1f..84f2ce0975 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/device/details/mgt/impl/DeviceInformationManagerImpl.java @@ -18,10 +18,6 @@ package io.entgra.device.mgt.core.device.mgt.core.device.details.mgt.impl; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.CarbonContext; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.device.details.DeviceDetailsWrapper; @@ -45,15 +41,14 @@ import io.entgra.device.mgt.core.device.mgt.core.report.mgt.Constants; import io.entgra.device.mgt.core.device.mgt.core.service.GroupManagementProviderService; import io.entgra.device.mgt.core.device.mgt.core.util.DeviceManagerUtil; import io.entgra.device.mgt.core.device.mgt.core.util.HttpReportingUtil; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.user.api.UserStoreException; import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ExecutionException; +import java.util.*; public class DeviceInformationManagerImpl implements DeviceInformationManager { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dto/DeviceType.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dto/DeviceType.java index d25706c35f..b2a3c205d6 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dto/DeviceType.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dto/DeviceType.java @@ -18,9 +18,9 @@ package io.entgra.device.mgt.core.device.mgt.core.dto; +import io.entgra.device.mgt.core.device.mgt.common.type.mgt.DeviceTypeMetaDefinition; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import io.entgra.device.mgt.core.device.mgt.common.type.mgt.DeviceTypeMetaDefinition; import java.io.Serializable; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/event/config/EventConfigurationProviderServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/event/config/EventConfigurationProviderServiceImpl.java index 6de751af8e..881586d9d5 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/event/config/EventConfigurationProviderServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/event/config/EventConfigurationProviderServiceImpl.java @@ -19,27 +19,23 @@ package io.entgra.device.mgt.core.device.mgt.core.event.config; import com.google.common.collect.Lists; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.event.config.EventConfig; import io.entgra.device.mgt.core.device.mgt.common.event.config.EventConfigurationException; import io.entgra.device.mgt.core.device.mgt.common.event.config.EventConfigurationProviderService; import io.entgra.device.mgt.core.device.mgt.common.event.config.EventMetaData; import io.entgra.device.mgt.core.device.mgt.common.exceptions.TransactionManagementException; -import io.entgra.device.mgt.core.device.mgt.core.config.DeviceConfigurationManager; -import io.entgra.device.mgt.core.device.mgt.core.dao.*; +import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOException; +import io.entgra.device.mgt.core.device.mgt.core.dao.EventConfigDAO; +import io.entgra.device.mgt.core.device.mgt.core.dao.EventManagementDAOException; +import io.entgra.device.mgt.core.device.mgt.core.dao.EventManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.dao.util.DeviceManagementDAOUtil; import io.entgra.device.mgt.core.device.mgt.core.geo.task.GeoFenceEventOperationManager; import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHolder; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; +import java.util.*; public class EventConfigurationProviderServiceImpl implements EventConfigurationProviderService { private static final Log log = LogFactory.getLog(EventConfigurationProviderServiceImpl.class); diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/event/config/EventOperationExecutor.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/event/config/EventOperationExecutor.java index 54a7efd9dc..c022226cb3 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/event/config/EventOperationExecutor.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/event/config/EventOperationExecutor.java @@ -19,17 +19,10 @@ package io.entgra.device.mgt.core.device.mgt.core.event.config; import com.google.gson.Gson; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; -import io.entgra.device.mgt.core.device.mgt.common.event.config.EventConfig; -import io.entgra.device.mgt.core.device.mgt.common.event.config.EventConfigurationException; -import io.entgra.device.mgt.core.device.mgt.common.event.config.EventMetaData; -import io.entgra.device.mgt.core.device.mgt.common.event.config.EventOperation; -import io.entgra.device.mgt.core.device.mgt.common.event.config.EventRevokeOperation; +import io.entgra.device.mgt.core.device.mgt.common.event.config.*; import io.entgra.device.mgt.core.device.mgt.common.exceptions.InvalidDeviceException; import io.entgra.device.mgt.core.device.mgt.common.geo.service.GeoFenceEventMeta; import io.entgra.device.mgt.core.device.mgt.common.geo.service.GeoLocationBasedServiceException; @@ -43,12 +36,11 @@ import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.OperationMgtConst import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.ProfileOperation; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; import io.entgra.device.mgt.core.device.mgt.core.service.GroupManagementProviderService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.PrivilegedCarbonContext; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Set; +import java.util.*; /** * Event create/revoke operation creation task. diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/event/config/GroupAssignmentEventOperationExecutor.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/event/config/GroupAssignmentEventOperationExecutor.java index 48c77e555b..272ec28348 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/event/config/GroupAssignmentEventOperationExecutor.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/event/config/GroupAssignmentEventOperationExecutor.java @@ -19,9 +19,6 @@ package io.entgra.device.mgt.core.device.mgt.core.event.config; import com.google.gson.Gson; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; import io.entgra.device.mgt.core.device.mgt.common.event.config.EventConfigurationException; @@ -40,6 +37,9 @@ import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHo import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.OperationMgtConstants; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.ProfileOperation; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.PrivilegedCarbonContext; import java.util.ArrayList; import java.util.Arrays; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/geo/service/GeoLocationProviderServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/geo/service/GeoLocationProviderServiceImpl.java index ac5c6fac5b..eca73e2fc6 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/geo/service/GeoLocationProviderServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/geo/service/GeoLocationProviderServiceImpl.java @@ -20,21 +20,6 @@ package io.entgra.device.mgt.core.device.mgt.core.geo.service; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; -import org.apache.axis2.AxisFault; -import org.apache.axis2.client.Options; -import org.apache.axis2.client.Stub; -import org.apache.axis2.java.security.SSLProtocolSocketFactory; -import org.apache.axis2.transport.http.HTTPConstants; -import org.apache.commons.codec.binary.Base64; -import org.apache.commons.httpclient.Header; -import org.apache.commons.httpclient.protocol.Protocol; -import org.apache.commons.httpclient.protocol.ProtocolSocketFactory; -import org.apache.commons.io.IOUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.base.ServerConfiguration; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.core.util.Utils; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants.GeoServices; @@ -43,13 +28,7 @@ import io.entgra.device.mgt.core.device.mgt.common.event.config.EventConfig; import io.entgra.device.mgt.core.device.mgt.common.event.config.EventConfigurationException; import io.entgra.device.mgt.core.device.mgt.common.event.config.EventConfigurationProviderService; import io.entgra.device.mgt.core.device.mgt.common.exceptions.TransactionManagementException; -import io.entgra.device.mgt.core.device.mgt.common.geo.service.Alert; -import io.entgra.device.mgt.core.device.mgt.common.geo.service.AlertAlreadyExistException; -import io.entgra.device.mgt.core.device.mgt.common.geo.service.GeoFence; -import io.entgra.device.mgt.core.device.mgt.common.geo.service.GeoFenceEventMeta; -import io.entgra.device.mgt.core.device.mgt.common.geo.service.GeoLocationBasedServiceException; -import io.entgra.device.mgt.core.device.mgt.common.geo.service.GeoLocationProviderService; -import io.entgra.device.mgt.core.device.mgt.common.geo.service.GeofenceData; +import io.entgra.device.mgt.core.device.mgt.common.geo.service.*; import io.entgra.device.mgt.core.device.mgt.core.cache.impl.GeoCacheManagerImpl; import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOException; import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOFactory; @@ -59,11 +38,26 @@ import io.entgra.device.mgt.core.device.mgt.core.dao.util.DeviceManagementDAOUti import io.entgra.device.mgt.core.device.mgt.core.dto.event.config.GeoFenceGroupMap; import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHolder; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.OperationMgtConstants; -import org.wso2.carbon.event.processor.stub.EventProcessorAdminServiceStub; -import org.wso2.carbon.event.processor.stub.types.ExecutionPlanConfigurationDto; import io.entgra.device.mgt.core.identity.jwt.client.extension.JWTClient; import io.entgra.device.mgt.core.identity.jwt.client.extension.exception.JWTClientException; import io.entgra.device.mgt.core.identity.jwt.client.extension.service.JWTClientManagerService; +import org.apache.axis2.AxisFault; +import org.apache.axis2.client.Options; +import org.apache.axis2.client.Stub; +import org.apache.axis2.java.security.SSLProtocolSocketFactory; +import org.apache.axis2.transport.http.HTTPConstants; +import org.apache.commons.codec.binary.Base64; +import org.apache.commons.httpclient.Header; +import org.apache.commons.httpclient.protocol.Protocol; +import org.apache.commons.httpclient.protocol.ProtocolSocketFactory; +import org.apache.commons.io.IOUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.base.ServerConfiguration; +import org.wso2.carbon.context.PrivilegedCarbonContext; +import org.wso2.carbon.core.util.Utils; +import org.wso2.carbon.event.processor.stub.EventProcessorAdminServiceStub; +import org.wso2.carbon.event.processor.stub.types.ExecutionPlanConfigurationDto; import org.wso2.carbon.registry.api.Registry; import org.wso2.carbon.registry.api.RegistryException; import org.wso2.carbon.registry.api.Resource; @@ -78,20 +72,10 @@ import java.io.InputStream; import java.io.StringWriter; import java.lang.reflect.Type; import java.nio.charset.StandardCharsets; -import java.security.KeyManagementException; -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.UnrecoverableKeyException; +import java.security.*; import java.security.cert.CertificateException; import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Set; +import java.util.*; import static io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants.GeoServices.DAS_PORT; import static io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants.GeoServices.DEFAULT_HTTP_PROTOCOL; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/geo/task/GeoFenceEventOperationManager.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/geo/task/GeoFenceEventOperationManager.java index 5dbca35d38..2ec79e54e6 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/geo/task/GeoFenceEventOperationManager.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/geo/task/GeoFenceEventOperationManager.java @@ -18,14 +18,14 @@ package io.entgra.device.mgt.core.device.mgt.core.geo.task; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; import io.entgra.device.mgt.core.device.mgt.common.event.config.EventMetaData; import io.entgra.device.mgt.core.device.mgt.core.config.DeviceConfigurationManager; import io.entgra.device.mgt.core.device.mgt.core.event.config.EventOperationExecutor; import io.entgra.device.mgt.core.device.mgt.core.event.config.GroupAssignmentEventOperationExecutor; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/internal/ActivityDataPurgingServiceComponent.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/internal/ActivityDataPurgingServiceComponent.java index 233b1f80bf..6b70a2dc6a 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/internal/ActivityDataPurgingServiceComponent.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/internal/ActivityDataPurgingServiceComponent.java @@ -18,9 +18,6 @@ package io.entgra.device.mgt.core.device.mgt.core.internal; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.osgi.service.component.ComponentContext; import io.entgra.device.mgt.core.device.mgt.core.archival.dao.ArchivalDestinationDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.archival.dao.ArchivalSourceDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.config.DeviceConfigurationManager; @@ -29,26 +26,19 @@ import io.entgra.device.mgt.core.device.mgt.core.config.datasource.DataSourceCon import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; import io.entgra.device.mgt.core.device.mgt.core.task.ArchivalTaskManager; import io.entgra.device.mgt.core.device.mgt.core.task.impl.ArchivalTaskManagerImpl; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.*; import org.wso2.carbon.ntask.core.service.TaskService; -/** - * @scr.component name="org.wso2.carbon.activity.data.archival" immediate="true" - * @scr.reference name="device.ntask.component" - * interface="org.wso2.carbon.ntask.core.service.TaskService" - * cardinality="1..1" - * policy="dynamic" - * bind="setTaskService" - * unbind="unsetTaskService" - * @scr.reference name="org.wso2.carbon.device.manager" - * interface="io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService" - * cardinality="1..1" - * policy="dynamic" - * bind="setDeviceManagementService" - * unbind="unsetDeviceManagementService" - */ +@Component( + name = "io.entgra.device.mgt.core.device.mgt.core.internal.ActivityDataPurgingServiceComponent", + immediate = true) public class ActivityDataPurgingServiceComponent { private static Log log = LogFactory.getLog(ActivityDataPurgingServiceComponent.class); + @Activate protected void activate(ComponentContext componentContext) { try { if (log.isDebugEnabled()) { @@ -99,6 +89,12 @@ public class ActivityDataPurgingServiceComponent { } } + @Reference( + name = "task.service", + service = org.wso2.carbon.ntask.core.service.TaskService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetTaskService") protected void setTaskService(TaskService taskService) { if (log.isDebugEnabled()) { log.debug("Setting the task service."); @@ -113,6 +109,12 @@ public class ActivityDataPurgingServiceComponent { DeviceManagementDataHolder.getInstance().setTaskService(null); } + @Reference( + name = "device.mgt.provider.service", + service = io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetDeviceManagementService") protected void setDeviceManagementService(DeviceManagementProviderService deviceManagementService){ } @@ -122,6 +124,7 @@ public class ActivityDataPurgingServiceComponent { } @SuppressWarnings("unused") + @Deactivate protected void deactivate(ComponentContext componentContext) { } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/internal/DeviceManagementDataHolder.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/internal/DeviceManagementDataHolder.java index a1dbe98c2a..a901ffeddf 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/internal/DeviceManagementDataHolder.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/internal/DeviceManagementDataHolder.java @@ -18,8 +18,6 @@ package io.entgra.device.mgt.core.device.mgt.core.internal; -import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service.HeartBeatManagementService; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.DeviceStatusTaskPluginConfig; import io.entgra.device.mgt.core.device.mgt.common.OperationMonitoringTaskConfig; import io.entgra.device.mgt.core.device.mgt.common.app.mgt.ApplicationManager; @@ -46,7 +44,9 @@ import io.entgra.device.mgt.core.device.mgt.core.service.GroupManagementProvider import io.entgra.device.mgt.core.device.mgt.core.status.task.DeviceStatusTaskManagerService; import io.entgra.device.mgt.core.device.mgt.core.task.DeviceTaskManagerService; import io.entgra.device.mgt.core.device.mgt.core.traccar.api.service.DeviceAPIClientService; +import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service.HeartBeatManagementService; import io.entgra.device.mgt.core.transport.mgt.email.sender.core.service.EmailSenderService; +import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.ntask.core.service.TaskService; import org.wso2.carbon.registry.core.service.RegistryService; import org.wso2.carbon.user.core.service.RealmService; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/internal/DeviceManagementServiceComponent.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/internal/DeviceManagementServiceComponent.java index d7b459d4b7..8128a2e8b5 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/internal/DeviceManagementServiceComponent.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/internal/DeviceManagementServiceComponent.java @@ -17,13 +17,6 @@ */ package io.entgra.device.mgt.core.device.mgt.core.internal; -import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service.HeartBeatManagementService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.osgi.framework.BundleContext; -import org.osgi.service.component.ComponentContext; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.core.ServerStartupObserver; import io.entgra.device.mgt.core.device.mgt.common.app.mgt.ApplicationManagementException; import io.entgra.device.mgt.core.device.mgt.common.authorization.DeviceAccessAuthorizationService; import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.PlatformConfigurationManagementService; @@ -86,7 +79,15 @@ import io.entgra.device.mgt.core.device.mgt.core.traccar.api.service.DeviceAPICl import io.entgra.device.mgt.core.device.mgt.core.traccar.api.service.impl.DeviceAPIClientServiceImpl; import io.entgra.device.mgt.core.device.mgt.core.util.DeviceManagementSchemaInitializer; import io.entgra.device.mgt.core.device.mgt.core.util.DeviceManagerUtil; +import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service.HeartBeatManagementService; import io.entgra.device.mgt.core.transport.mgt.email.sender.core.service.EmailSenderService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.osgi.framework.BundleContext; +import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.*; +import org.wso2.carbon.context.PrivilegedCarbonContext; +import org.wso2.carbon.core.ServerStartupObserver; import org.wso2.carbon.ndatasource.core.DataSourceService; import org.wso2.carbon.registry.core.service.RegistryService; import org.wso2.carbon.user.core.service.RealmService; @@ -100,57 +101,9 @@ import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; -/** - * @scr.component name="org.wso2.carbon.device.manager" immediate="true" - * @scr.reference name="user.realmservice.default" - * interface="org.wso2.carbon.user.core.service.RealmService" - * cardinality="1..1" - * policy="dynamic" - * bind="setRealmService" - * unbind="unsetRealmService" - * @scr.reference name="device.manager.service" - * interface="io.entgra.device.mgt.core.device.mgt.common.spi.DeviceManagementService" - * cardinality="0..n" - * policy="dynamic" - * bind="setDeviceManagementService" - * unbind="unsetDeviceManagementService" - * @scr.reference name="registry.service" - * interface="org.wso2.carbon.registry.core.service.RegistryService" - * cardinality="1..1" - * policy="dynamic" - * bind="setRegistryService" - * unbind="unsetRegistryService" - * @scr.reference name="org.wso2.carbon.ndatasource" - * interface="org.wso2.carbon.ndatasource.core.DataSourceService" - * cardinality="1..1" - * policy="dynamic" - * bind="setDataSourceService" - * unbind="unsetDataSourceService" - * @scr.reference name="config.context.service" - * interface="org.wso2.carbon.utils.ConfigurationContextService" - * cardinality="0..1" - * policy="dynamic" - * bind="setConfigurationContextService" - * unbind="unsetConfigurationContextService" - * @scr.reference name="email.sender.service" - * interface="io.entgra.device.mgt.core.transport.mgt.email.sender.core.service.EmailSenderService" - * cardinality="0..1" - * policy="dynamic" - * bind="setEmailSenderService" - * unbind="unsetEmailSenderService" - * @scr.reference name="device.type.generator.service" - * interface="io.entgra.device.mgt.core.device.mgt.common.spi.DeviceTypeGeneratorService" - * cardinality="0..1" - * policy="dynamic" - * bind="setDeviceTypeGeneratorService" - * unbind="unsetDeviceTypeGeneratorService" - * @scr.reference name="entgra.heart.beat.service" - * interface="io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service.HeartBeatManagementService" - * cardinality="0..1" - * policy="dynamic" - * bind="setHeartBeatService" - * unbind="unsetHeartBeatService" - */ +@Component( + name = "io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementServiceComponent", + immediate = true) public class DeviceManagementServiceComponent { private static final Object LOCK = new Object(); @@ -179,6 +132,7 @@ public class DeviceManagementServiceComponent { } @SuppressWarnings("unused") + @Activate protected void activate(ComponentContext componentContext) { try { if (log.isDebugEnabled()) { @@ -278,6 +232,7 @@ public class DeviceManagementServiceComponent { } @SuppressWarnings("unused") + @Deactivate protected void deactivate(ComponentContext componentContext) { //do nothing } @@ -442,6 +397,12 @@ public class DeviceManagementServiceComponent { * * @param deviceManagementService An instance of DeviceManagementService */ + @Reference( + name = "device.mgt.service", + service = io.entgra.device.mgt.core.device.mgt.common.spi.DeviceManagementService.class, + cardinality = ReferenceCardinality.MULTIPLE, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetDeviceManagementService") protected void setDeviceManagementService(DeviceManagementService deviceManagementService) { try { if (log.isDebugEnabled()) { @@ -482,6 +443,12 @@ public class DeviceManagementServiceComponent { * * @param realmService An instance of RealmService */ + @Reference( + name = "realm.service", + service = org.wso2.carbon.user.core.service.RealmService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRealmService") protected void setRealmService(RealmService realmService) { if (log.isDebugEnabled()) { log.debug("Setting Realm Service"); @@ -506,6 +473,12 @@ public class DeviceManagementServiceComponent { * * @param registryService An instance of RegistryService */ + @Reference( + name = "registry.service", + service = org.wso2.carbon.registry.core.service.RegistryService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRegistryService") protected void setRegistryService(RegistryService registryService) { if (log.isDebugEnabled()) { log.debug("Setting Registry Service"); @@ -530,6 +503,12 @@ public class DeviceManagementServiceComponent { * * @param heartBeatService An instance of HeartBeatManagementService */ + @Reference( + name = "heart.beat.service", + service = io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service.HeartBeatManagementService.class, + cardinality = ReferenceCardinality.OPTIONAL, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetHeartBeatService") protected void setHeartBeatService(HeartBeatManagementService heartBeatService) { if (log.isDebugEnabled()) { log.debug("Setting Heart Beat Service"); @@ -547,6 +526,12 @@ public class DeviceManagementServiceComponent { DeviceManagementDataHolder.getInstance().setHeartBeatService(null); } + @Reference( + name = "datasource.service", + service = org.wso2.carbon.ndatasource.core.DataSourceService.class, + cardinality = ReferenceCardinality.OPTIONAL, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetDataSourceService") protected void setDataSourceService(DataSourceService dataSourceService) { /* This is to avoid mobile device management component getting initialized before the underlying datasources are registered */ @@ -559,6 +544,12 @@ public class DeviceManagementServiceComponent { //do nothing } + @Reference( + name = "configuration.context.service", + service = org.wso2.carbon.utils.ConfigurationContextService.class, + cardinality = ReferenceCardinality.OPTIONAL, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetConfigurationContextService") protected void setConfigurationContextService(ConfigurationContextService configurationContextService) { if (log.isDebugEnabled()) { log.debug("Setting ConfigurationContextService"); @@ -573,6 +564,12 @@ public class DeviceManagementServiceComponent { DeviceManagementDataHolder.getInstance().setConfigurationContextService(null); } + @Reference( + name = "email.sender.service", + service = io.entgra.device.mgt.core.transport.mgt.email.sender.core.service.EmailSenderService.class, + cardinality = ReferenceCardinality.OPTIONAL, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetEmailSenderService") protected void setEmailSenderService(EmailSenderService emailSenderService) { if (log.isDebugEnabled()) { log.debug("Setting Email Sender Service"); @@ -588,6 +585,12 @@ public class DeviceManagementServiceComponent { } + @Reference( + name = "device.task.service", + service = io.entgra.device.mgt.core.device.mgt.core.task.DeviceTaskManagerService.class, + cardinality = ReferenceCardinality.OPTIONAL, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetDeviceTaskManagerService") protected void setDeviceTaskManagerService(DeviceTaskManagerService deviceTaskManagerService) { if (log.isDebugEnabled()) { } @@ -605,6 +608,12 @@ public class DeviceManagementServiceComponent { * * @param deviceTypeGeneratorService An Instance of DeviceTypeGeneratorService */ + @Reference( + name = "device.type.generator.service", + service = io.entgra.device.mgt.core.device.mgt.common.spi.DeviceTypeGeneratorService.class, + cardinality = ReferenceCardinality.OPTIONAL, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetDeviceTypeGeneratorService") protected void setDeviceTypeGeneratorService(DeviceTypeGeneratorService deviceTypeGeneratorService) { if (log.isDebugEnabled()) { log.debug("Un setting Device DeviceTypeGeneratorService"); diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/internal/DeviceTaskManagerServiceComponent.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/internal/DeviceTaskManagerServiceComponent.java index 602e0700a1..ac1c1af740 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/internal/DeviceTaskManagerServiceComponent.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/internal/DeviceTaskManagerServiceComponent.java @@ -18,10 +18,6 @@ package io.entgra.device.mgt.core.device.mgt.core.internal; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.osgi.framework.BundleContext; -import org.osgi.service.component.ComponentContext; import io.entgra.device.mgt.core.device.mgt.common.DeviceStatusTaskPluginConfig; import io.entgra.device.mgt.core.device.mgt.common.OperationMonitoringTaskConfig; import io.entgra.device.mgt.core.device.mgt.core.config.DeviceConfigurationManager; @@ -38,20 +34,17 @@ import io.entgra.device.mgt.core.device.mgt.core.status.task.impl.DeviceStatusTa import io.entgra.device.mgt.core.device.mgt.core.task.DeviceMgtTaskException; import io.entgra.device.mgt.core.device.mgt.core.task.DeviceTaskManagerService; import io.entgra.device.mgt.core.device.mgt.core.task.impl.DeviceTaskManagerServiceImpl; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.osgi.framework.BundleContext; +import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.*; import org.wso2.carbon.ntask.core.service.TaskService; import java.util.Map; - -/** - * @scr.component name="org.wso2.carbon.device.task.manager" immediate="true" - * @scr.reference name="device.ntask.component" - * interface="org.wso2.carbon.ntask.core.service.TaskService" - * cardinality="1..1" - * policy="dynamic" - * bind="setTaskService" - * unbind="unsetTaskService" - */ - +@Component( + name = "io.entgra.device.mgt.core.device.mgt.core.internal.DeviceTaskManagerServiceComponent", + immediate = true) @SuppressWarnings("unused") public class DeviceTaskManagerServiceComponent { @@ -59,6 +52,7 @@ public class DeviceTaskManagerServiceComponent { private DeviceManagementConfig deviceManagementConfig; @SuppressWarnings("unused") + @Activate protected void activate(ComponentContext componentContext) { try { if (log.isDebugEnabled()) { @@ -133,6 +127,7 @@ public class DeviceTaskManagerServiceComponent { } @SuppressWarnings("unused") + @Deactivate protected void deactivate(ComponentContext componentContext) { try { stopOperationMonitoringTask(); @@ -192,6 +187,12 @@ public class DeviceTaskManagerServiceComponent { } } + @Reference( + name = "task.service", + service = org.wso2.carbon.ntask.core.service.TaskService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetTaskService") protected void setTaskService(TaskService taskService) { if (log.isDebugEnabled()) { log.debug("Setting the task service."); diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/internal/TenantCreateObserver.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/internal/TenantCreateObserver.java index 9360428b56..399e1d00a3 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/internal/TenantCreateObserver.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/internal/TenantCreateObserver.java @@ -17,17 +17,13 @@ */ package io.entgra.device.mgt.core.device.mgt.core.internal; +import io.entgra.device.mgt.core.device.mgt.core.DeviceManagementConstants; +import io.entgra.device.mgt.core.device.mgt.core.DeviceManagementConstants.User; import org.apache.axis2.context.ConfigurationContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.device.mgt.core.DeviceManagementConstants; -import io.entgra.device.mgt.core.device.mgt.core.DeviceManagementConstants.User; -import org.wso2.carbon.user.api.AuthorizationManager; -import org.wso2.carbon.user.api.Permission; -import org.wso2.carbon.user.api.UserRealm; -import org.wso2.carbon.user.api.UserStoreException; -import org.wso2.carbon.user.api.UserStoreManager; +import org.wso2.carbon.user.api.*; import org.wso2.carbon.utils.AbstractAxis2ConfigurationContextObserver; import org.wso2.carbon.utils.multitenancy.MultitenantConstants; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/internal/UserRoleCreateObserver.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/internal/UserRoleCreateObserver.java index adcb5ed597..f7b2a27a4b 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/internal/UserRoleCreateObserver.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/internal/UserRoleCreateObserver.java @@ -17,10 +17,10 @@ */ package io.entgra.device.mgt.core.device.mgt.core.internal; +import io.entgra.device.mgt.core.device.mgt.core.DeviceManagementConstants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.core.ServerStartupObserver; -import io.entgra.device.mgt.core.device.mgt.core.DeviceManagementConstants; import org.wso2.carbon.user.api.AuthorizationManager; import org.wso2.carbon.user.api.Permission; import org.wso2.carbon.user.api.UserStoreException; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/MetadataManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/MetadataManagementServiceImpl.java index 121caf5ba3..407ecef1bc 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/MetadataManagementServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/MetadataManagementServiceImpl.java @@ -18,10 +18,6 @@ package io.entgra.device.mgt.core.device.mgt.core.metadata.mgt; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.base.MultitenantConstants; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.PaginationResult; import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataKeyAlreadyExistsException; @@ -34,6 +30,11 @@ import io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.dao.MetadataDAO; import io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.dao.MetadataManagementDAOException; import io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.dao.MetadataManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.util.DeviceManagerUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.base.MultitenantConstants; +import org.wso2.carbon.context.PrivilegedCarbonContext; + import java.sql.SQLException; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/WhiteLabelManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/WhiteLabelManagementServiceImpl.java index ff6bdf1c19..4ade3adc82 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/WhiteLabelManagementServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/WhiteLabelManagementServiceImpl.java @@ -19,26 +19,13 @@ package io.entgra.device.mgt.core.device.mgt.core.metadata.mgt; import com.google.gson.Gson; -import org.apache.commons.io.IOUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.http.HttpResponse; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.Base64File; import io.entgra.device.mgt.core.device.mgt.common.FileResponse; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataManagementException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.NotFoundException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.TransactionManagementException; -import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.Metadata; -import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.WhiteLabelImage; -import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.WhiteLabelImageRequestPayload; -import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.WhiteLabelManagementService; -import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.WhiteLabelTheme; -import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.WhiteLabelThemeCreateRequest; +import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.*; import io.entgra.device.mgt.core.device.mgt.core.common.util.HttpUtil; import io.entgra.device.mgt.core.device.mgt.core.config.DeviceConfigurationManager; import io.entgra.device.mgt.core.device.mgt.core.config.metadata.mgt.MetaDataConfiguration; @@ -50,6 +37,14 @@ import io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.dao.MetadataManage import io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.dao.util.MetadataConstants; import io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.util.WhiteLabelStorageUtil; import io.entgra.device.mgt.core.device.mgt.core.util.DeviceManagerUtil; +import org.apache.commons.io.IOUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.http.HttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.wso2.carbon.context.PrivilegedCarbonContext; import java.io.File; import java.io.IOException; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/dao/MetadataManagementDAOFactory.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/dao/MetadataManagementDAOFactory.java index 6ff2336340..bb0a5c79f5 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/dao/MetadataManagementDAOFactory.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/dao/MetadataManagementDAOFactory.java @@ -18,8 +18,6 @@ package io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.dao; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; import io.entgra.device.mgt.core.device.mgt.common.exceptions.IllegalTransactionStateException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.TransactionManagementException; @@ -30,12 +28,14 @@ import io.entgra.device.mgt.core.device.mgt.core.dao.util.DeviceManagementDAOUti import io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.dao.impl.GenericMetadataDAOImpl; import io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.dao.impl.OracleMetadataDAOImpl; import io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.dao.impl.SQLServerMetadataDAOImpl; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import javax.sql.DataSource; import java.sql.Connection; import java.sql.SQLException; import java.util.Hashtable; import java.util.List; -import javax.sql.DataSource; /** * DAO factory class to be used in MetadataManagement related functionalities. diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/dao/impl/AbstractMetadataDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/dao/impl/AbstractMetadataDAOImpl.java index 6ea47bdd40..aadb508de5 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/dao/impl/AbstractMetadataDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/dao/impl/AbstractMetadataDAOImpl.java @@ -18,19 +18,15 @@ package io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.dao.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.Metadata; import io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.dao.MetadataDAO; import io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.dao.MetadataManagementDAOException; import io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.dao.MetadataManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.dao.util.MetadataDAOUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; +import java.sql.*; /** * Implementation of MetadataDAO which includes the methods to do CRUD operations on metadata. diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/dao/impl/GenericMetadataDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/dao/impl/GenericMetadataDAOImpl.java index 775785087f..6fb8cfa1e6 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/dao/impl/GenericMetadataDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/dao/impl/GenericMetadataDAOImpl.java @@ -18,13 +18,13 @@ package io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.dao.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.Metadata; import io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.dao.MetadataManagementDAOException; import io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.dao.MetadataManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.dao.util.MetadataDAOUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.sql.Connection; import java.sql.PreparedStatement; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/dao/impl/OracleMetadataDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/dao/impl/OracleMetadataDAOImpl.java index 36b4ef593f..4a7dce786d 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/dao/impl/OracleMetadataDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/dao/impl/OracleMetadataDAOImpl.java @@ -18,13 +18,13 @@ package io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.dao.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.Metadata; import io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.dao.MetadataManagementDAOException; import io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.dao.MetadataManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.dao.util.MetadataDAOUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.sql.Connection; import java.sql.PreparedStatement; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/dao/impl/SQLServerMetadataDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/dao/impl/SQLServerMetadataDAOImpl.java index 6ffc3cc1be..70880a1a9d 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/dao/impl/SQLServerMetadataDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/dao/impl/SQLServerMetadataDAOImpl.java @@ -18,13 +18,13 @@ package io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.dao.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.Metadata; import io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.dao.MetadataManagementDAOException; import io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.dao.MetadataManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.dao.util.MetadataDAOUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.sql.Connection; import java.sql.PreparedStatement; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/dao/util/MetadataDAOUtil.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/dao/util/MetadataDAOUtil.java index a03a95f5bc..a0837f406b 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/dao/util/MetadataDAOUtil.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/dao/util/MetadataDAOUtil.java @@ -18,9 +18,9 @@ package io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.dao.util; +import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.Metadata; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.Metadata; import java.sql.ResultSet; import java.sql.SQLException; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/util/WhiteLabelStorageUtil.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/util/WhiteLabelStorageUtil.java index d67483be0a..07d34e71e8 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/util/WhiteLabelStorageUtil.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/util/WhiteLabelStorageUtil.java @@ -18,10 +18,6 @@ package io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.util; -import org.apache.commons.io.IOUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.Base64File; import io.entgra.device.mgt.core.device.mgt.common.FileResponse; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; @@ -34,6 +30,9 @@ import io.entgra.device.mgt.core.device.mgt.core.common.util.StorageManagementUt import io.entgra.device.mgt.core.device.mgt.core.config.DeviceConfigurationManager; import io.entgra.device.mgt.core.device.mgt.core.config.metadata.mgt.MetaDataConfiguration; import io.entgra.device.mgt.core.device.mgt.core.util.DeviceManagerUtil; +import org.apache.commons.io.IOUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.io.File; import java.io.IOException; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/notification/mgt/NotificationManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/notification/mgt/NotificationManagementServiceImpl.java index 4aba354fe4..b63426bdf9 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/notification/mgt/NotificationManagementServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/notification/mgt/NotificationManagementServiceImpl.java @@ -18,15 +18,12 @@ package io.entgra.device.mgt.core.device.mgt.core.notification.mgt; -import io.entgra.device.mgt.core.device.mgt.extensions.logger.spi.EntgraLogger; -import io.entgra.device.mgt.core.notification.logger.DeviceLogContext; -import io.entgra.device.mgt.core.notification.logger.impl.EntgraDeviceLoggerImpl; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.EntityDoesNotExistException; import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.PaginationResult; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.EntityDoesNotExistException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.TransactionManagementException; import io.entgra.device.mgt.core.device.mgt.common.notification.mgt.Notification; import io.entgra.device.mgt.core.device.mgt.common.notification.mgt.NotificationManagementException; @@ -36,6 +33,9 @@ import io.entgra.device.mgt.core.device.mgt.core.notification.mgt.dao.Notificati import io.entgra.device.mgt.core.device.mgt.core.notification.mgt.dao.NotificationManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.notification.mgt.dao.util.NotificationDAOUtil; import io.entgra.device.mgt.core.device.mgt.core.util.DeviceManagerUtil; +import io.entgra.device.mgt.core.device.mgt.extensions.logger.spi.EntgraLogger; +import io.entgra.device.mgt.core.notification.logger.DeviceLogContext; +import io.entgra.device.mgt.core.notification.logger.impl.EntgraDeviceLoggerImpl; import java.sql.SQLException; import java.util.ArrayList; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/notification/mgt/dao/NotificationManagementDAOFactory.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/notification/mgt/dao/NotificationManagementDAOFactory.java index 4b213dafab..671f6de0a5 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/notification/mgt/dao/NotificationManagementDAOFactory.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/notification/mgt/dao/NotificationManagementDAOFactory.java @@ -18,16 +18,19 @@ package io.entgra.device.mgt.core.device.mgt.core.notification.mgt.dao; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; import io.entgra.device.mgt.core.device.mgt.common.exceptions.IllegalTransactionStateException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.TransactionManagementException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.UnsupportedDatabaseEngineException; import io.entgra.device.mgt.core.device.mgt.core.config.datasource.DataSourceConfig; import io.entgra.device.mgt.core.device.mgt.core.config.datasource.JNDILookupDefinition; -import io.entgra.device.mgt.core.device.mgt.core.notification.mgt.dao.impl.*; +import io.entgra.device.mgt.core.device.mgt.core.notification.mgt.dao.impl.GenericNotificationDAOImpl; +import io.entgra.device.mgt.core.device.mgt.core.notification.mgt.dao.impl.OracleNotificationDAOImpl; +import io.entgra.device.mgt.core.device.mgt.core.notification.mgt.dao.impl.PostgreSQLNotificationDAOImpl; +import io.entgra.device.mgt.core.device.mgt.core.notification.mgt.dao.impl.SQLServerNotificationDAOImpl; import io.entgra.device.mgt.core.device.mgt.core.notification.mgt.dao.util.NotificationDAOUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import javax.sql.DataSource; import java.sql.Connection; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/notification/mgt/dao/impl/AbstractNotificationDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/notification/mgt/dao/impl/AbstractNotificationDAOImpl.java index d7bcccf373..de56840f4a 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/notification/mgt/dao/impl/AbstractNotificationDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/notification/mgt/dao/impl/AbstractNotificationDAOImpl.java @@ -24,12 +24,7 @@ import io.entgra.device.mgt.core.device.mgt.core.notification.mgt.dao.Notificati import io.entgra.device.mgt.core.device.mgt.core.notification.mgt.dao.NotificationManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.notification.mgt.dao.util.NotificationDAOUtil; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.sql.Timestamp; +import java.sql.*; import java.util.ArrayList; import java.util.Date; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/notification/mgt/dao/impl/OracleNotificationDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/notification/mgt/dao/impl/OracleNotificationDAOImpl.java index 3a457a6de2..466828a66a 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/notification/mgt/dao/impl/OracleNotificationDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/notification/mgt/dao/impl/OracleNotificationDAOImpl.java @@ -24,11 +24,7 @@ import io.entgra.device.mgt.core.device.mgt.common.notification.mgt.Notification import io.entgra.device.mgt.core.device.mgt.core.notification.mgt.dao.NotificationManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.notification.mgt.dao.util.NotificationDAOUtil; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Timestamp; +import java.sql.*; import java.util.ArrayList; import java.util.Date; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/notification/mgt/dao/util/NotificationDAOUtil.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/notification/mgt/dao/util/NotificationDAOUtil.java index 4f4d61def6..68b095f1de 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/notification/mgt/dao/util/NotificationDAOUtil.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/notification/mgt/dao/util/NotificationDAOUtil.java @@ -18,12 +18,12 @@ package io.entgra.device.mgt.core.device.mgt.core.notification.mgt.dao.util; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.CarbonContext; import io.entgra.device.mgt.core.device.mgt.common.notification.mgt.Notification; import io.entgra.device.mgt.core.device.mgt.common.notification.mgt.NotificationManagementException; import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHolder; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.user.core.tenant.TenantManager; import org.wso2.carbon.utils.multitenancy.MultitenantConstants; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/OperationManagerImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/OperationManagerImpl.java index 7373e52e5f..5e5ca5c13d 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/OperationManagerImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/OperationManagerImpl.java @@ -18,36 +18,14 @@ package io.entgra.device.mgt.core.device.mgt.core.operation.mgt; -import com.google.gson.Gson; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.CarbonContext; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.device.mgt.common.ActivityPaginationRequest; -import io.entgra.device.mgt.core.device.mgt.common.Device; -import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; -import io.entgra.device.mgt.core.device.mgt.common.DynamicTaskContext; -import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; -import io.entgra.device.mgt.core.device.mgt.common.MonitoringOperation; -import io.entgra.device.mgt.core.device.mgt.common.OperationMonitoringTaskConfig; -import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; -import io.entgra.device.mgt.core.device.mgt.common.PaginationResult; +import io.entgra.device.mgt.core.device.mgt.common.*; import io.entgra.device.mgt.core.device.mgt.common.authorization.DeviceAccessAuthorizationException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.InvalidDeviceException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.TransactionManagementException; import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroupConstants; -import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Activity; -import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.ActivityStatus; -import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Operation; -import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.OperationManagementException; -import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.OperationManager; -import io.entgra.device.mgt.core.device.mgt.common.push.notification.NotificationContext; -import io.entgra.device.mgt.core.device.mgt.common.push.notification.NotificationStrategy; -import io.entgra.device.mgt.core.device.mgt.common.push.notification.PushNotificationConfig; -import io.entgra.device.mgt.core.device.mgt.common.push.notification.PushNotificationExecutionFailedException; -import io.entgra.device.mgt.core.device.mgt.common.push.notification.PushNotificationProvider; +import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.*; +import io.entgra.device.mgt.core.device.mgt.common.push.notification.*; import io.entgra.device.mgt.core.device.mgt.common.spi.DeviceManagementService; import io.entgra.device.mgt.core.device.mgt.core.DeviceManagementConstants; import io.entgra.device.mgt.core.device.mgt.core.cache.impl.DeviceCacheManagerImpl; @@ -69,16 +47,15 @@ import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProvide import io.entgra.device.mgt.core.device.mgt.core.task.DeviceTaskManager; import io.entgra.device.mgt.core.device.mgt.core.task.impl.DeviceTaskManagerImpl; import io.entgra.device.mgt.core.device.mgt.core.util.DeviceManagerUtil; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.CarbonContext; +import org.wso2.carbon.context.PrivilegedCarbonContext; import java.sql.SQLException; import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Calendar; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.Executors; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/OperationManagerRepository.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/OperationManagerRepository.java index f670d149ed..6f1464eb14 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/OperationManagerRepository.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/OperationManagerRepository.java @@ -17,8 +17,8 @@ */ package io.entgra.device.mgt.core.device.mgt.core.operation.mgt; -import io.entgra.device.mgt.core.device.mgt.core.dto.DeviceTypeServiceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.OperationManager; +import io.entgra.device.mgt.core.device.mgt.core.dto.DeviceTypeServiceIdentifier; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/OperationManagementDAOFactory.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/OperationManagementDAOFactory.java index 33a13cb5b9..a0ebadb328 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/OperationManagementDAOFactory.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/OperationManagementDAOFactory.java @@ -18,8 +18,6 @@ package io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; import io.entgra.device.mgt.core.device.mgt.common.exceptions.IllegalTransactionStateException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.TransactionManagementException; @@ -32,6 +30,8 @@ import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.impl.operatio import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.impl.operation.OracleOperationDAOImpl; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.impl.operation.PostgreSQLOperationDAOImpl; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.impl.operation.SQLServerOperationDAOImpl; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import javax.sql.DataSource; import java.sql.Connection; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/CommandOperationDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/CommandOperationDAOImpl.java index 5a12769bea..826fde0d1f 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/CommandOperationDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/CommandOperationDAOImpl.java @@ -18,22 +18,20 @@ package io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.core.dao.util.DeviceManagementDAOUtil; import io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.CommandOperation; import io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationManagementDAOException; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationManagementDAOUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; -import java.sql.Timestamp; import java.util.ArrayList; -import java.util.Date; import java.util.List; public class CommandOperationDAOImpl extends GenericOperationDAOImpl { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/ConfigOperationDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/ConfigOperationDAOImpl.java index 9e19b5b5d8..2817d192ab 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/ConfigOperationDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/ConfigOperationDAOImpl.java @@ -18,21 +18,19 @@ package io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.core.dao.util.DeviceManagementDAOUtil; import io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.ConfigOperation; import io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationManagementDAOException; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationManagementDAOUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; -import java.io.*; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Timestamp; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.sql.*; import java.util.ArrayList; import java.util.Date; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/ConfigOperationMSSQLDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/ConfigOperationMSSQLDAOImpl.java index 65415c752a..2f690b8869 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/ConfigOperationMSSQLDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/ConfigOperationMSSQLDAOImpl.java @@ -19,25 +19,16 @@ package io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.core.dao.util.DeviceManagementDAOUtil; import io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.ConfigOperation; import io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationManagementDAOException; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationManagementDAOFactory; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Timestamp; +import java.io.*; +import java.sql.*; import java.util.ArrayList; import java.util.Date; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/ConfigOperationPostgresDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/ConfigOperationPostgresDAOImpl.java index f51ad488d8..b50536571b 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/ConfigOperationPostgresDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/ConfigOperationPostgresDAOImpl.java @@ -19,25 +19,16 @@ package io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.ConfigOperation; import io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationManagementDAOException; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationManagementDAOUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Timestamp; +import java.io.*; +import java.sql.*; import java.util.ArrayList; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java index ebda4bfc05..597e9f348d 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/GenericOperationDAOImpl.java @@ -17,9 +17,6 @@ */ package io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.ActivityPaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; @@ -37,23 +34,18 @@ import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationMana import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationManagementDAOUtil; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.util.OperationDAOUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.PrivilegedCarbonContext; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Timestamp; +import java.sql.*; import java.text.DateFormat; import java.text.SimpleDateFormat; -import java.util.ArrayList; import java.util.Date; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; import java.util.stream.IntStream; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/OperationMappingDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/OperationMappingDAOImpl.java index 75cbe51b0e..1cb14e18f2 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/OperationMappingDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/OperationMappingDAOImpl.java @@ -17,10 +17,7 @@ */ package io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.Device; -import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; import io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.OperationEnrolmentMapping; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.OperationMapping; @@ -28,15 +25,14 @@ import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationMana import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationManagementDAOUtil; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationMappingDAO; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.sql.Connection; 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; public class OperationMappingDAOImpl implements OperationMappingDAO { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/PolicyOperationDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/PolicyOperationDAOImpl.java index b8a1b135a3..cffcd5744e 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/PolicyOperationDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/PolicyOperationDAOImpl.java @@ -17,14 +17,14 @@ */ package io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.core.dao.util.DeviceManagementDAOUtil; import io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation; import io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.PolicyOperation; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationManagementDAOException; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationManagementDAOUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.io.*; import java.sql.*; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/ProfileOperationDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/ProfileOperationDAOImpl.java index e972afba65..489ce3d306 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/ProfileOperationDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/ProfileOperationDAOImpl.java @@ -17,19 +17,18 @@ */ package io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.core.dao.util.DeviceManagementDAOUtil; import io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation; import io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.ProfileOperation; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationManagementDAOException; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationManagementDAOUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.io.*; import java.sql.*; import java.util.ArrayList; -import java.util.Date; import java.util.List; public class ProfileOperationDAOImpl extends GenericOperationDAOImpl { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/operation/MySQLOperationDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/operation/MySQLOperationDAOImpl.java index 37545d4408..7279a65d7c 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/operation/MySQLOperationDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/operation/MySQLOperationDAOImpl.java @@ -18,9 +18,6 @@ package io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.impl.operation; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Activity; import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.ActivityHolder; @@ -31,6 +28,9 @@ import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationMana import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationManagementDAOUtil; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.impl.GenericOperationDAOImpl; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.util.OperationDAOUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.PrivilegedCarbonContext; import java.sql.Connection; import java.sql.PreparedStatement; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/operation/OracleOperationDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/operation/OracleOperationDAOImpl.java index 9a53353a2e..756e76c444 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/operation/OracleOperationDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/operation/OracleOperationDAOImpl.java @@ -18,9 +18,6 @@ package io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.impl.operation; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Activity; @@ -32,6 +29,9 @@ import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationMana import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationManagementDAOUtil; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.impl.GenericOperationDAOImpl; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.util.OperationDAOUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.PrivilegedCarbonContext; import java.sql.Connection; import java.sql.PreparedStatement; @@ -39,11 +39,7 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.text.DateFormat; import java.text.SimpleDateFormat; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.ArrayList; -import java.util.LinkedList; +import java.util.*; /** * This class holds the implementation of OperationDAO which can be used to support Oracle db syntax. diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/operation/PostgreSQLOperationDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/operation/PostgreSQLOperationDAOImpl.java index ede11203d3..59819bb98c 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/operation/PostgreSQLOperationDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/operation/PostgreSQLOperationDAOImpl.java @@ -27,16 +27,12 @@ import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationMana import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.impl.GenericOperationDAOImpl; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.util.OperationDAOUtil; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Timestamp; +import java.sql.*; import java.text.DateFormat; import java.text.SimpleDateFormat; +import java.util.ArrayList; import java.util.Date; import java.util.List; -import java.util.ArrayList; /** * This class holds the implementation of OperationDAO which can be used to support PostgreSQL db syntax. diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/operation/SQLServerOperationDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/operation/SQLServerOperationDAOImpl.java index e1d14f27ce..2437cea720 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/operation/SQLServerOperationDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/impl/operation/SQLServerOperationDAOImpl.java @@ -18,15 +18,10 @@ package io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.impl.operation; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Activity; import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.ActivityHolder; -import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.ActivityStatus; -import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.OperationResponse; import io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.OperationMapping; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationManagementDAOException; @@ -34,19 +29,14 @@ import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationMana import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationManagementDAOUtil; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.impl.GenericOperationDAOImpl; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.util.OperationDAOUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.PrivilegedCarbonContext; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Timestamp; +import java.sql.*; import java.text.DateFormat; import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; +import java.util.*; /** * This class holds the implementation of OperationDAO which can be used to support SQLServer db syntax. diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/util/OperationDAOUtil.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/util/OperationDAOUtil.java index bb2a7c4092..8a0f3e2dc0 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/util/OperationDAOUtil.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/mgt/dao/util/OperationDAOUtil.java @@ -17,21 +17,14 @@ */ package io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.util; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; -import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Activity; -import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.ActivityHolder; -import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.ActivityMapper; -import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.ActivityStatus; -import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.OperationResponse; +import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.*; import io.entgra.device.mgt.core.device.mgt.core.DeviceManagementConstants; -import io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.CommandOperation; -import io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.ConfigOperation; import io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation; -import io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.PolicyOperation; -import io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.ProfileOperation; +import io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.*; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationManagementDAOException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.io.ByteArrayInputStream; import java.io.IOException; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/timeout/task/impl/OperationTimeoutTask.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/timeout/task/impl/OperationTimeoutTask.java index 3d336140e3..0639d60b4c 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/timeout/task/impl/OperationTimeoutTask.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/timeout/task/impl/OperationTimeoutTask.java @@ -18,8 +18,6 @@ package io.entgra.device.mgt.core.device.mgt.core.operation.timeout.task.impl; import com.google.gson.Gson; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Activity; import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.ActivityStatus; @@ -29,6 +27,8 @@ import io.entgra.device.mgt.core.device.mgt.core.config.operation.timeout.Operat import io.entgra.device.mgt.core.device.mgt.core.dto.DeviceType; import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHolder; import io.entgra.device.mgt.core.device.mgt.core.task.impl.DynamicPartitionedScheduleTask; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.util.ArrayList; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/timeout/task/impl/OperationTimeoutTaskManagerServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/timeout/task/impl/OperationTimeoutTaskManagerServiceImpl.java index cffc4937b3..4da31f9f41 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/timeout/task/impl/OperationTimeoutTaskManagerServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/operation/timeout/task/impl/OperationTimeoutTaskManagerServiceImpl.java @@ -18,13 +18,13 @@ package io.entgra.device.mgt.core.device.mgt.core.operation.timeout.task.impl; import com.google.gson.Gson; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.core.config.operation.timeout.OperationTimeout; import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHolder; import io.entgra.device.mgt.core.device.mgt.core.operation.timeout.task.OperationTimeoutTaskException; import io.entgra.device.mgt.core.device.mgt.core.operation.timeout.task.OperationTimeoutTaskManagerService; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.wso2.carbon.ntask.common.TaskException; import org.wso2.carbon.ntask.core.TaskInfo; import org.wso2.carbon.ntask.core.TaskManager; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/otp/mgt/dao/OTPManagementDAOFactory.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/otp/mgt/dao/OTPManagementDAOFactory.java index 5dcc519711..15842ae225 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/otp/mgt/dao/OTPManagementDAOFactory.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/otp/mgt/dao/OTPManagementDAOFactory.java @@ -17,8 +17,6 @@ */ package io.entgra.device.mgt.core.device.mgt.core.otp.mgt.dao; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; import io.entgra.device.mgt.core.device.mgt.common.exceptions.UnsupportedDatabaseEngineException; import io.entgra.device.mgt.core.device.mgt.core.otp.mgt.dao.impl.GenericOTPManagementDAOImpl; @@ -26,6 +24,8 @@ import io.entgra.device.mgt.core.device.mgt.core.otp.mgt.dao.impl.OracleOTPManag import io.entgra.device.mgt.core.device.mgt.core.otp.mgt.dao.impl.PostgreSQLOTPManagementDAOImpl; import io.entgra.device.mgt.core.device.mgt.core.otp.mgt.dao.impl.SQLServerOTPManagementDAOImpl; import io.entgra.device.mgt.core.device.mgt.core.otp.mgt.util.ConnectionManagerUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import javax.sql.DataSource; import java.sql.Connection; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/otp/mgt/dao/impl/GenericOTPManagementDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/otp/mgt/dao/impl/GenericOTPManagementDAOImpl.java index b755c2527b..eaac0bf827 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/otp/mgt/dao/impl/GenericOTPManagementDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/otp/mgt/dao/impl/GenericOTPManagementDAOImpl.java @@ -18,20 +18,15 @@ package io.entgra.device.mgt.core.device.mgt.core.otp.mgt.dao.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DBConnectionException; import io.entgra.device.mgt.core.device.mgt.common.otp.mgt.dto.OneTimePinDTO; import io.entgra.device.mgt.core.device.mgt.core.otp.mgt.dao.AbstractDAOImpl; import io.entgra.device.mgt.core.device.mgt.core.otp.mgt.dao.OTPManagementDAO; import io.entgra.device.mgt.core.device.mgt.core.otp.mgt.exception.OTPManagementDAOException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.sql.Timestamp; +import java.sql.*; import java.util.Calendar; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/otp/mgt/service/OTPManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/otp/mgt/service/OTPManagementServiceImpl.java index c34408b2cc..087cf3851f 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/otp/mgt/service/OTPManagementServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/otp/mgt/service/OTPManagementServiceImpl.java @@ -18,16 +18,8 @@ package io.entgra.device.mgt.core.device.mgt.core.otp.mgt.service; import com.google.gson.Gson; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.CarbonContext; import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.ConfigurationManagementException; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.BadRequestException; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DBConnectionException; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.OTPManagementException; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.TransactionManagementException; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.*; import io.entgra.device.mgt.core.device.mgt.common.invitation.mgt.DeviceEnrollmentInvitation; import io.entgra.device.mgt.core.device.mgt.common.invitation.mgt.DeviceEnrollmentInvitationDetails; import io.entgra.device.mgt.core.device.mgt.common.invitation.mgt.DeviceEnrollmentType; @@ -43,17 +35,15 @@ import io.entgra.device.mgt.core.device.mgt.core.otp.mgt.util.ConnectionManagerU import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; import io.entgra.device.mgt.core.device.mgt.core.service.EmailMetaInfo; import io.entgra.device.mgt.core.device.mgt.core.util.DeviceManagerUtil; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.user.api.Tenant; import org.wso2.carbon.user.api.UserStoreException; import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.UUID; +import java.util.*; public class OTPManagementServiceImpl implements OTPManagementService { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/otp/mgt/util/ConnectionManagerUtil.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/otp/mgt/util/ConnectionManagerUtil.java index 852f93eff9..ea5034b1d0 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/otp/mgt/util/ConnectionManagerUtil.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/otp/mgt/util/ConnectionManagerUtil.java @@ -17,11 +17,11 @@ */ package io.entgra.device.mgt.core.device.mgt.core.otp.mgt.util; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DBConnectionException; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.TransactionManagementException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.IllegalTransactionStateException; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.TransactionManagementException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import javax.naming.InitialContext; import javax.sql.DataSource; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/permission/mgt/PermissionNode.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/permission/mgt/PermissionNode.java index 984fbd142c..872bbaa763 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/permission/mgt/PermissionNode.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/permission/mgt/PermissionNode.java @@ -20,11 +20,7 @@ package io.entgra.device.mgt.core.device.mgt.core.permission.mgt; import io.entgra.device.mgt.core.device.mgt.common.permission.mgt.Permission; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; /** * This class represents the node of a permission tree. diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/permission/mgt/PermissionTree.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/permission/mgt/PermissionTree.java index 725ab61e5e..3897f83532 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/permission/mgt/PermissionTree.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/permission/mgt/PermissionTree.java @@ -18,9 +18,9 @@ package io.entgra.device.mgt.core.device.mgt.core.permission.mgt; +import io.entgra.device.mgt.core.device.mgt.common.permission.mgt.Permission; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.device.mgt.common.permission.mgt.Permission; import java.util.StringTokenizer; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/permission/mgt/PermissionUtils.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/permission/mgt/PermissionUtils.java index 11eebb1c33..ba0c1c5e45 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/permission/mgt/PermissionUtils.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/permission/mgt/PermissionUtils.java @@ -18,11 +18,11 @@ package io.entgra.device.mgt.core.device.mgt.core.permission.mgt; -import org.w3c.dom.Document; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.permission.mgt.Permission; import io.entgra.device.mgt.core.device.mgt.common.permission.mgt.PermissionManagementException; import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHolder; +import org.w3c.dom.Document; +import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.registry.api.RegistryException; import org.wso2.carbon.registry.api.Resource; import org.wso2.carbon.registry.core.Registry; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/privacy/dao/impl/PrivacyComplianceDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/privacy/dao/impl/PrivacyComplianceDAOImpl.java index 7f88c7b76a..4e52f6233b 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/privacy/dao/impl/PrivacyComplianceDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/privacy/dao/impl/PrivacyComplianceDAOImpl.java @@ -19,13 +19,13 @@ package io.entgra.device.mgt.core.device.mgt.core.privacy.dao.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.dao.util.DeviceManagementDAOUtil; import io.entgra.device.mgt.core.device.mgt.core.privacy.dao.PrivacyComplianceDAO; import io.entgra.device.mgt.core.device.mgt.core.privacy.dao.PrivacyComplianceDAOException; import io.entgra.device.mgt.core.device.mgt.core.privacy.impl.DeviceEnrollmentMapping; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.sql.Connection; import java.sql.PreparedStatement; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/privacy/impl/PrivacyComplianceProviderImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/privacy/impl/PrivacyComplianceProviderImpl.java index 59d53811a3..b85c82f279 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/privacy/impl/PrivacyComplianceProviderImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/privacy/impl/PrivacyComplianceProviderImpl.java @@ -19,9 +19,6 @@ package io.entgra.device.mgt.core.device.mgt.core.privacy.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; @@ -32,6 +29,9 @@ import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHo import io.entgra.device.mgt.core.device.mgt.core.privacy.PrivacyComplianceProvider; import io.entgra.device.mgt.core.device.mgt.core.privacy.dao.PrivacyComplianceDAO; import io.entgra.device.mgt.core.device.mgt.core.privacy.dao.PrivacyComplianceDAOException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.PrivilegedCarbonContext; import java.util.ArrayList; import java.util.HashMap; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/push/notification/mgt/PushNotificationConfigRepository.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/push/notification/mgt/PushNotificationConfigRepository.java index f8ffe50205..9bf8b054e4 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/push/notification/mgt/PushNotificationConfigRepository.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/push/notification/mgt/PushNotificationConfigRepository.java @@ -17,8 +17,8 @@ */ package io.entgra.device.mgt.core.device.mgt.core.push.notification.mgt; -import org.wso2.carbon.context.CarbonContext; import io.entgra.device.mgt.core.device.mgt.common.push.notification.PushNotificationConfig; +import org.wso2.carbon.context.CarbonContext; import java.util.HashMap; import java.util.Map; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/push/notification/mgt/PushNotificationProviderRepository.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/push/notification/mgt/PushNotificationProviderRepository.java index 36f7b867b1..e396202982 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/push/notification/mgt/PushNotificationProviderRepository.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/push/notification/mgt/PushNotificationProviderRepository.java @@ -17,9 +17,9 @@ */ package io.entgra.device.mgt.core.device.mgt.core.push.notification.mgt; +import io.entgra.device.mgt.core.device.mgt.common.push.notification.PushNotificationProvider; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.device.mgt.common.push.notification.PushNotificationProvider; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/push/notification/mgt/task/PushNotificationSchedulerTask.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/push/notification/mgt/task/PushNotificationSchedulerTask.java index 2e859bcead..223535a29a 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/push/notification/mgt/task/PushNotificationSchedulerTask.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/push/notification/mgt/task/PushNotificationSchedulerTask.java @@ -17,9 +17,6 @@ */ package io.entgra.device.mgt.core.device.mgt.core.push.notification.mgt.task; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.TransactionManagementException; import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.OperationManagementException; @@ -35,6 +32,9 @@ import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationMana import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationMappingDAO; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.PrivilegedCarbonContext; import java.util.HashMap; import java.util.LinkedList; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/report/mgt/ReportManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/report/mgt/ReportManagementServiceImpl.java index fdd2cf31b9..a567c7f9f1 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/report/mgt/ReportManagementServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/report/mgt/ReportManagementServiceImpl.java @@ -18,34 +18,29 @@ package io.entgra.device.mgt.core.device.mgt.core.report.mgt; import com.google.gson.JsonObject; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.Count; import io.entgra.device.mgt.core.device.mgt.common.Device; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.BadRequestException; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.PaginationResult; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.BadRequestException; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceTypeNotFoundException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.ReportManagementException; import io.entgra.device.mgt.core.device.mgt.common.report.mgt.ReportManagementService; -import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceDAO; -import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOException; -import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOFactory; -import io.entgra.device.mgt.core.device.mgt.core.dao.GroupDAO; -import io.entgra.device.mgt.core.device.mgt.core.dao.GroupManagementDAOException; -import io.entgra.device.mgt.core.device.mgt.core.dao.GroupManagementDAOFactory; +import io.entgra.device.mgt.core.device.mgt.core.dao.*; import io.entgra.device.mgt.core.device.mgt.core.dao.util.DeviceManagementDAOUtil; import io.entgra.device.mgt.core.device.mgt.core.dto.DeviceType; import io.entgra.device.mgt.core.device.mgt.core.util.DeviceManagerUtil; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.sql.SQLException; import java.text.ParseException; import java.text.SimpleDateFormat; +import java.util.Calendar; import java.util.Date; import java.util.List; -import java.util.Calendar; import java.util.concurrent.TimeUnit; /** diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/report/mgt/config/ReportMgtConfigurationManager.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/report/mgt/config/ReportMgtConfigurationManager.java index 48ae7a5e28..bf7632a964 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/report/mgt/config/ReportMgtConfigurationManager.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/report/mgt/config/ReportMgtConfigurationManager.java @@ -17,11 +17,11 @@ */ package io.entgra.device.mgt.core.device.mgt.core.report.mgt.config; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.exceptions.InvalidConfigurationException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.ReportManagementException; import io.entgra.device.mgt.core.device.mgt.core.report.mgt.Constants; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import javax.xml.bind.JAXBContext; import javax.xml.bind.Unmarshaller; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/report/mgt/dao/common/ReportMgtConnectionManager.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/report/mgt/dao/common/ReportMgtConnectionManager.java index e2d1df5b66..f6330b0683 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/report/mgt/dao/common/ReportMgtConnectionManager.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/report/mgt/dao/common/ReportMgtConnectionManager.java @@ -17,11 +17,11 @@ */ package io.entgra.device.mgt.core.device.mgt.core.report.mgt.dao.common; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DBConnectionException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.IllegalTransactionStateException; import io.entgra.device.mgt.core.device.mgt.core.report.mgt.config.ReportMgtConfigurationManager; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import javax.naming.InitialContext; import javax.sql.DataSource; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/search/mgt/impl/ProcessorImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/search/mgt/impl/ProcessorImpl.java index 3f71e45dec..43735628df 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/search/mgt/impl/ProcessorImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/search/mgt/impl/ProcessorImpl.java @@ -19,9 +19,6 @@ package io.entgra.device.mgt.core.device.mgt.core.search.mgt.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.CarbonContext; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; @@ -33,21 +30,13 @@ import io.entgra.device.mgt.core.device.mgt.core.dao.ApplicationDAO; import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOException; import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.dao.util.DeviceManagementDAOUtil; -import io.entgra.device.mgt.core.device.mgt.core.search.mgt.Constants; -import io.entgra.device.mgt.core.device.mgt.core.search.mgt.InvalidOperatorException; -import io.entgra.device.mgt.core.device.mgt.core.search.mgt.Processor; -import io.entgra.device.mgt.core.device.mgt.core.search.mgt.QueryBuilder; -import io.entgra.device.mgt.core.device.mgt.core.search.mgt.QueryHolder; -import io.entgra.device.mgt.core.device.mgt.core.search.mgt.ResultSetAggregator; -import io.entgra.device.mgt.core.device.mgt.core.search.mgt.SearchMgtException; -import io.entgra.device.mgt.core.device.mgt.core.search.mgt.ValueType; +import io.entgra.device.mgt.core.device.mgt.core.search.mgt.*; import io.entgra.device.mgt.core.device.mgt.core.search.mgt.dao.SearchDAOException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.CarbonContext; -import java.sql.Array; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; +import java.sql.*; import java.util.ArrayList; import java.util.HashMap; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/search/mgt/impl/QueryBuilderImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/search/mgt/impl/QueryBuilderImpl.java index fd6f75e801..a900682ffe 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/search/mgt/impl/QueryBuilderImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/search/mgt/impl/QueryBuilderImpl.java @@ -19,15 +19,11 @@ package io.entgra.device.mgt.core.device.mgt.core.search.mgt.impl; +import io.entgra.device.mgt.core.device.mgt.common.search.Condition; +import io.entgra.device.mgt.core.device.mgt.core.search.mgt.*; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.device.mgt.common.search.Condition; -import io.entgra.device.mgt.core.device.mgt.core.search.mgt.Constants; -import io.entgra.device.mgt.core.device.mgt.core.search.mgt.InvalidOperatorException; -import io.entgra.device.mgt.core.device.mgt.core.search.mgt.QueryBuilder; -import io.entgra.device.mgt.core.device.mgt.core.search.mgt.QueryHolder; -import io.entgra.device.mgt.core.device.mgt.core.search.mgt.ValueType; import java.util.ArrayList; import java.util.HashMap; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/search/mgt/impl/ResultSetAggregatorImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/search/mgt/impl/ResultSetAggregatorImpl.java index c80ee563aa..b887fdab37 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/search/mgt/impl/ResultSetAggregatorImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/search/mgt/impl/ResultSetAggregatorImpl.java @@ -19,14 +19,14 @@ package io.entgra.device.mgt.core.device.mgt.core.search.mgt.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHolder; import io.entgra.device.mgt.core.device.mgt.core.permission.mgt.PermissionUtils; import io.entgra.device.mgt.core.device.mgt.core.search.mgt.Constants; import io.entgra.device.mgt.core.device.mgt.core.search.mgt.ResultSetAggregator; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.user.api.UserRealm; import org.wso2.carbon.user.api.UserStoreException; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderService.java index 98ef9fc4ae..1b3d57f171 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderService.java @@ -18,22 +18,15 @@ package io.entgra.device.mgt.core.device.mgt.core.service; +import io.entgra.device.mgt.core.device.mgt.common.app.mgt.Application; import org.apache.commons.collections.map.SingletonMap; import io.entgra.device.mgt.core.device.mgt.common.*; import io.entgra.device.mgt.core.device.mgt.common.app.mgt.ApplicationManagementException; -import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.AmbiguousConfigurationException; -import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.ConfigurationManagementException; -import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.DeviceConfiguration; -import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.PlatformConfiguration; +import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.*; import io.entgra.device.mgt.core.device.mgt.common.device.details.DeviceData; -import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.ConfigurationEntry; import io.entgra.device.mgt.core.device.mgt.common.device.details.DeviceLocationHistorySnapshot; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceNotFoundException; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceTypeNotFoundException; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.InvalidDeviceException; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.UnauthorizedDeviceAccessException; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.UserNotFoundException; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.*; +import io.entgra.device.mgt.core.device.mgt.common.geo.service.GeoCluster; import io.entgra.device.mgt.core.device.mgt.common.geo.service.GeoQuery; import io.entgra.device.mgt.core.device.mgt.common.invitation.mgt.DeviceEnrollmentInvitationDetails; import io.entgra.device.mgt.core.device.mgt.common.license.mgt.License; @@ -48,7 +41,7 @@ import io.entgra.device.mgt.core.device.mgt.common.type.mgt.DeviceStatus; import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOException; import io.entgra.device.mgt.core.device.mgt.core.dto.DeviceType; import io.entgra.device.mgt.core.device.mgt.core.dto.DeviceTypeVersion; -import io.entgra.device.mgt.core.device.mgt.common.geo.service.GeoCluster; +import org.apache.commons.collections.map.SingletonMap; import java.sql.SQLException; import java.sql.Timestamp; @@ -1017,4 +1010,42 @@ public interface DeviceManagementProviderService { throws DeviceManagementException; Boolean sendDeviceNameChangedNotification(Device device) throws DeviceManagementException; + + /** + * This method is for saving application icon info + * @param iconPath Icon path of the application + * @param packageName Package name of the application + * @param version Version of the application + * @param tenantId Tenant ID of the application created user + * @throws DeviceManagementException if any service level or DAO level error occurs + */ + void saveApplicationIcon(String iconPath, String packageName, String version, int tenantId) + throws DeviceManagementException; + + /** + * This method is for updating application icon info + * @param iconPath Icon path of the application + * @param oldPackageName Old package name of the application + * @param newPackageName New package name of the application + * @param version Version of the application + * @throws DeviceManagementException if any service level or DAO level error occurs + */ + void updateApplicationIcon(String iconPath, String oldPackageName, String newPackageName, String version) + throws DeviceManagementException; + + /** + * This method is for deleting application icon info + * @param packageName Package name of the application + * @throws DeviceManagementException if any service level or DAO level error occurs + */ + void deleteApplicationIcon(String packageName) throws DeviceManagementException; + + /** + * This method is for getting the installed application list of a device + * @param device {@link Device} + * @return list of applications {@link Application} + * @throws DeviceManagementException if any service level or DAO level error occurs + */ + List getInstalledApplicationsOnDevice(Device device, int offset, int limit) + throws DeviceManagementException; } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java index 15955daee4..02d6b010eb 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceImpl.java @@ -20,50 +20,10 @@ package io.entgra.device.mgt.core.device.mgt.core.service; import com.google.common.reflect.TypeToken; import com.google.gson.Gson; -import org.apache.commons.collections.map.SingletonMap; -import org.apache.commons.lang.StringUtils; -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.wso2.carbon.CarbonConstants; -import org.wso2.carbon.context.CarbonContext; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.device.mgt.common.ActivityPaginationRequest; -import io.entgra.device.mgt.core.device.mgt.common.Billing; -import io.entgra.device.mgt.core.device.mgt.common.Device; -import io.entgra.device.mgt.core.device.mgt.common.DeviceEnrollmentInfoNotification; -import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; -import io.entgra.device.mgt.core.device.mgt.common.DeviceManager; -import io.entgra.device.mgt.core.device.mgt.common.DeviceNotification; -import io.entgra.device.mgt.core.device.mgt.common.DevicePropertyNotification; -import io.entgra.device.mgt.core.device.mgt.common.DeviceTransferRequest; -import io.entgra.device.mgt.core.device.mgt.common.DynamicTaskContext; -import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; -import io.entgra.device.mgt.core.device.mgt.common.FeatureManager; -import io.entgra.device.mgt.core.device.mgt.common.InitialOperationConfig; -import io.entgra.device.mgt.core.device.mgt.common.MonitoringOperation; -import io.entgra.device.mgt.core.device.mgt.common.OperationMonitoringTaskConfig; -import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; -import io.entgra.device.mgt.core.device.mgt.common.PaginationResult; -import io.entgra.device.mgt.core.device.mgt.common.StartupOperationConfig; -import io.entgra.device.mgt.core.device.mgt.common.BillingResponse; +import io.entgra.device.mgt.core.device.mgt.common.*; import io.entgra.device.mgt.core.device.mgt.common.app.mgt.Application; import io.entgra.device.mgt.core.device.mgt.common.app.mgt.ApplicationManagementException; -import io.entgra.device.mgt.core.device.mgt.common.app.mgt.MobileAppTypes; -import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.AmbiguousConfigurationException; -import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.ConfigurationEntry; -import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.ConfigurationManagementException; -import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.CorrectiveActionConfig; -import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.DeviceConfiguration; -import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.DevicePropertyInfo; -import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.EnrollmentConfiguration; -import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.PlatformConfiguration; +import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.*; import io.entgra.device.mgt.core.device.mgt.common.cost.mgt.Cost; import io.entgra.device.mgt.core.device.mgt.common.device.details.DeviceData; import io.entgra.device.mgt.core.device.mgt.common.device.details.DeviceInfo; @@ -72,15 +32,8 @@ import io.entgra.device.mgt.core.device.mgt.common.device.details.DeviceLocation import io.entgra.device.mgt.core.device.mgt.common.enrollment.notification.EnrollmentNotificationConfiguration; import io.entgra.device.mgt.core.device.mgt.common.enrollment.notification.EnrollmentNotifier; import io.entgra.device.mgt.core.device.mgt.common.enrollment.notification.EnrollmentNotifierException; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.BadRequestException; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceNotFoundException; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceTypeNotFoundException; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.InvalidDeviceException; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.TransactionManagementException; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.UnauthorizedDeviceAccessException; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.UserNotFoundException; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataManagementException; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.*; +import io.entgra.device.mgt.core.device.mgt.common.geo.service.GeoCluster; import io.entgra.device.mgt.core.device.mgt.common.geo.service.GeoQuery; import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup; import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroupConstants; @@ -111,20 +64,13 @@ import io.entgra.device.mgt.core.device.mgt.core.cache.impl.DeviceCacheManagerIm import io.entgra.device.mgt.core.device.mgt.core.common.Constants; import io.entgra.device.mgt.core.device.mgt.core.config.DeviceConfigurationManager; import io.entgra.device.mgt.core.device.mgt.core.config.DeviceManagementConfig; -import io.entgra.device.mgt.core.device.mgt.core.dao.ApplicationDAO; -import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceDAO; -import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOException; -import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOFactory; -import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceStatusDAO; -import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceTypeDAO; -import io.entgra.device.mgt.core.device.mgt.core.dao.EnrollmentDAO; +import io.entgra.device.mgt.core.device.mgt.core.dao.*; import io.entgra.device.mgt.core.device.mgt.core.dao.util.DeviceManagementDAOUtil; import io.entgra.device.mgt.core.device.mgt.core.device.details.mgt.DeviceDetailsMgtException; import io.entgra.device.mgt.core.device.mgt.core.device.details.mgt.DeviceInformationManager; import io.entgra.device.mgt.core.device.mgt.core.dto.DeviceType; import io.entgra.device.mgt.core.device.mgt.core.dto.DeviceTypeServiceIdentifier; import io.entgra.device.mgt.core.device.mgt.core.dto.DeviceTypeVersion; -import io.entgra.device.mgt.core.device.mgt.common.geo.service.GeoCluster; import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHolder; import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementServiceComponent; import io.entgra.device.mgt.core.device.mgt.core.internal.PluginInitializationListener; @@ -135,16 +81,25 @@ import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.CommandOperation; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.ProfileOperation; import io.entgra.device.mgt.core.device.mgt.core.util.DeviceManagerUtil; import io.entgra.device.mgt.core.device.mgt.core.util.HttpReportingUtil; -import io.entgra.device.mgt.core.transport.mgt.email.sender.core.ContentProviderInfo; -import io.entgra.device.mgt.core.transport.mgt.email.sender.core.EmailContext; -import io.entgra.device.mgt.core.transport.mgt.email.sender.core.EmailSendingFailedException; -import io.entgra.device.mgt.core.transport.mgt.email.sender.core.EmailTransportNotConfiguredException; -import io.entgra.device.mgt.core.transport.mgt.email.sender.core.TypedValue; +import io.entgra.device.mgt.core.transport.mgt.email.sender.core.*; import io.entgra.device.mgt.core.transport.mgt.email.sender.core.service.EmailSenderService; +import org.apache.commons.collections.map.SingletonMap; +import org.apache.commons.lang.StringUtils; +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.wso2.carbon.CarbonConstants; +import org.wso2.carbon.context.CarbonContext; +import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.stratos.common.beans.TenantInfoBean; import org.wso2.carbon.tenant.mgt.services.TenantMgtAdminService; import org.wso2.carbon.user.api.UserStoreException; -import org.wso2.carbon.utils.multitenancy.MultitenantConstants; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; @@ -155,17 +110,7 @@ import java.lang.reflect.Type; import java.sql.SQLException; import java.sql.Timestamp; import java.time.LocalDateTime; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Collection; -import java.util.Collections; -import java.util.Date; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Properties; +import java.util.*; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; @@ -4899,4 +4844,130 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv throw new DeviceManagementException(msg, e); } } + + @Override + public void saveApplicationIcon(String iconPath, String packageName, String version, int tenantId) throws DeviceManagementException{ + try{ + DeviceManagementDAOFactory.beginTransaction(); + if(applicationDAO.getApplicationPackageCount(packageName) == 0){ + applicationDAO.saveApplicationIcon(iconPath, packageName, version, tenantId); + } + DeviceManagementDAOFactory.commitTransaction(); + } catch (TransactionManagementException e) { + String msg = "Error occurred while initiating transaction"; + log.error(msg, e); + throw new DeviceManagementException(msg, e); + } catch (DeviceManagementDAOException e) { + DeviceManagementDAOFactory.rollbackTransaction(); + String msg = "Error occurred while saving app icon. Icon Path: " + iconPath + + " Package Name: " + packageName + + " Version: " + version + + " Tenant Id: " + tenantId; + log.error(msg, e); + throw new DeviceManagementException(msg, e); + } finally { + DeviceManagementDAOFactory.closeConnection(); + } + } + + @Override + public void updateApplicationIcon(String iconPath, String oldPackageName, String newPackageName, String version) + throws DeviceManagementException{ + try { + DeviceManagementDAOFactory.beginTransaction(); + applicationDAO.updateApplicationIcon(iconPath, oldPackageName, newPackageName, version); + DeviceManagementDAOFactory.commitTransaction(); + } catch (TransactionManagementException e) { + String msg = "Error occurred while initiating transaction"; + log.error(msg, e); + throw new DeviceManagementException(msg, e); + } catch (DeviceManagementDAOException e) { + DeviceManagementDAOFactory.rollbackTransaction(); + String msg = "Error occurred while updating app icon info." + + " Package Name: " + oldPackageName; + log.error(msg, e); + throw new DeviceManagementException(msg, e); + } finally { + DeviceManagementDAOFactory.closeConnection(); + } + } + + @Override + public void deleteApplicationIcon(String packageName) + throws DeviceManagementException { + try { + DeviceManagementDAOFactory.beginTransaction(); + applicationDAO.deleteApplicationIcon(packageName); + DeviceManagementDAOFactory.commitTransaction(); + } catch (TransactionManagementException e) { + String msg = "Error occurred while initiating transaction"; + log.error(msg, e); + throw new DeviceManagementException(msg, e); + } catch (DeviceManagementDAOException e) { + DeviceManagementDAOFactory.rollbackTransaction(); + String msg = "Error occurred while deleting app icon info." + + " Package Name: " + packageName ; + log.error(msg, e); + throw new DeviceManagementException(msg, e); + } finally { + DeviceManagementDAOFactory.closeConnection(); + } + } + + private List getInstalledAppIconInfo(List applications) throws DeviceManagementException { + String iconPath; + try { + DeviceManagementDAOFactory.openConnection(); + for (Application app : applications) { + iconPath = applicationDAO.getIconPath(app.getApplicationIdentifier()); + app.setImageUrl(iconPath); + } + } catch (DeviceManagementDAOException e) { + String msg = "Error occurred while retrieving installed app icon info"; + log.error(msg, e); + throw new DeviceManagementException(msg, e); + } catch (SQLException e) { + String msg = "Error occurred while opening a connection to the data source"; + log.error(msg); + throw new DeviceManagementException(msg, e); + } finally { + DeviceManagementDAOFactory.closeConnection(); + } + return applications; + } + + @Override + public List getInstalledApplicationsOnDevice(Device device, int offset, int limit) throws DeviceManagementException { + List applications; + try { + DeviceManagementDAOFactory.openConnection(); + int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); + applications = applicationDAO.getInstalledApplicationListOnDevice(device.getId(), + device.getEnrolmentInfo().getId(), offset, limit, tenantId); + if (applications == null) { + String msg = "Couldn't found applications for device identifier '" + device.getId() + "'"; + log.error(msg); + throw new DeviceManagementException(msg); + } + } catch (DeviceManagementDAOException e) { + String msg = "Error occurred while retrieving the application list of android device, " + + "which carries the id '" + device.getId() + "'"; + log.error(msg, e); + throw new DeviceManagementException(msg, e); + } catch (SQLException e) { + String msg = "Error occurred while opening a connection to the data source"; + log.error(msg, e); + throw new DeviceManagementException(msg, e); + } finally { + DeviceManagementDAOFactory.closeConnection(); + } + List newApplicationList; + newApplicationList = this.getInstalledAppIconInfo(applications); + if (newApplicationList == null) { + String msg = "Error occurred while getting app icon info for device identifier '" + device.getId() + "'"; + log.error(msg); + throw new DeviceManagementException(msg); + } + return newApplicationList; + } } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderService.java index 5f7840c5e7..1bae5b30ce 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderService.java @@ -20,15 +20,10 @@ package io.entgra.device.mgt.core.device.mgt.core.service; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceNotFoundException; import io.entgra.device.mgt.core.device.mgt.common.GroupPaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.PaginationResult; -import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup; -import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceTypesOfGroups; -import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupAlreadyExistException; -import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupManagementException; -import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupNotExistException; -import io.entgra.device.mgt.core.device.mgt.common.group.mgt.RoleDoesNotExistException; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceNotFoundException; +import io.entgra.device.mgt.core.device.mgt.common.group.mgt.*; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java index 23fb15646a..c605a8ebe7 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java @@ -18,46 +18,29 @@ package io.entgra.device.mgt.core.device.mgt.core.service; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.CarbonConstants; -import org.wso2.carbon.context.CarbonContext; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.device.mgt.common.Device; -import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; -import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; +import io.entgra.device.mgt.core.device.mgt.common.*; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceNotFoundException; -import io.entgra.device.mgt.core.device.mgt.common.GroupPaginationRequest; -import io.entgra.device.mgt.core.device.mgt.common.PaginationResult; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.TrackerAlreadyExistException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.TransactionManagementException; -import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup; -import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroupConstants; -import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceTypesOfGroups; -import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupAlreadyExistException; -import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupManagementException; -import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupNotExistException; -import io.entgra.device.mgt.core.device.mgt.common.group.mgt.RoleDoesNotExistException; +import io.entgra.device.mgt.core.device.mgt.common.group.mgt.*; import io.entgra.device.mgt.core.device.mgt.core.dao.*; import io.entgra.device.mgt.core.device.mgt.core.event.config.GroupAssignmentEventOperationExecutor; import io.entgra.device.mgt.core.device.mgt.core.geo.task.GeoFenceEventOperationManager; import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHolder; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.OperationMgtConstants; import io.entgra.device.mgt.core.device.mgt.core.util.DeviceManagerUtil; -import io.entgra.device.mgt.core.device.mgt.core.util.HttpReportingUtil; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.CarbonConstants; +import org.wso2.carbon.context.CarbonContext; +import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.user.api.UserRealm; import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.user.api.UserStoreManager; import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ExecutionException; +import java.util.*; import java.util.concurrent.ExecutorService; import java.util.stream.Collectors; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/status/task/impl/DeviceStatusMonitoringTask.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/status/task/impl/DeviceStatusMonitoringTask.java index 6f078619ee..9f5b24ff74 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/status/task/impl/DeviceStatusMonitoringTask.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/status/task/impl/DeviceStatusMonitoringTask.java @@ -19,8 +19,6 @@ package io.entgra.device.mgt.core.device.mgt.core.status.task.impl; import com.google.gson.Gson; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.DeviceStatusTaskPluginConfig; import io.entgra.device.mgt.core.device.mgt.common.DynamicTaskContext; @@ -33,6 +31,8 @@ import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOExceptio import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.status.task.DeviceStatusTaskException; import io.entgra.device.mgt.core.device.mgt.core.task.impl.DynamicPartitionedScheduleTask; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.sql.SQLException; import java.util.ArrayList; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/status/task/impl/DeviceStatusTaskManagerServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/status/task/impl/DeviceStatusTaskManagerServiceImpl.java index 39fec3926a..181d72c9a6 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/status/task/impl/DeviceStatusTaskManagerServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/status/task/impl/DeviceStatusTaskManagerServiceImpl.java @@ -19,13 +19,13 @@ package io.entgra.device.mgt.core.device.mgt.core.status.task.impl; import com.google.gson.Gson; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.DeviceStatusTaskPluginConfig; import io.entgra.device.mgt.core.device.mgt.core.dto.DeviceType; import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHolder; import io.entgra.device.mgt.core.device.mgt.core.status.task.DeviceStatusTaskException; import io.entgra.device.mgt.core.device.mgt.core.status.task.DeviceStatusTaskManagerService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.wso2.carbon.ntask.common.TaskException; import org.wso2.carbon.ntask.core.TaskInfo; import org.wso2.carbon.ntask.core.TaskManager; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/task/impl/ArchivalTask.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/task/impl/ArchivalTask.java index bd1b614ca6..6efecd6a97 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/task/impl/ArchivalTask.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/task/impl/ArchivalTask.java @@ -18,11 +18,11 @@ package io.entgra.device.mgt.core.device.mgt.core.task.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.core.archival.ArchivalException; import io.entgra.device.mgt.core.device.mgt.core.archival.ArchivalService; import io.entgra.device.mgt.core.device.mgt.core.archival.ArchivalServiceImpl; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.wso2.carbon.ntask.core.Task; import java.text.SimpleDateFormat; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/task/impl/ArchivalTaskManagerImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/task/impl/ArchivalTaskManagerImpl.java index 55cdbd7688..e81fb6999b 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/task/impl/ArchivalTaskManagerImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/task/impl/ArchivalTaskManagerImpl.java @@ -19,13 +19,13 @@ package io.entgra.device.mgt.core.device.mgt.core.task.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.core.config.DeviceConfigurationManager; import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHolder; import io.entgra.device.mgt.core.device.mgt.core.task.ArchivalTaskException; import io.entgra.device.mgt.core.device.mgt.core.task.ArchivalTaskManager; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.ntask.common.TaskException; import org.wso2.carbon.ntask.core.TaskInfo; import org.wso2.carbon.ntask.core.TaskManager; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/task/impl/ArchivedDataDeletionTask.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/task/impl/ArchivedDataDeletionTask.java index 5282467a91..60fa409d64 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/task/impl/ArchivedDataDeletionTask.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/task/impl/ArchivedDataDeletionTask.java @@ -18,11 +18,11 @@ package io.entgra.device.mgt.core.device.mgt.core.task.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.core.archival.ArchivalException; import io.entgra.device.mgt.core.device.mgt.core.archival.ArchivalService; import io.entgra.device.mgt.core.device.mgt.core.archival.ArchivalServiceImpl; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.wso2.carbon.ntask.core.Task; import java.text.SimpleDateFormat; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/task/impl/DeviceDetailsRetrieverTask.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/task/impl/DeviceDetailsRetrieverTask.java index e267bf4353..da28d6e40c 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/task/impl/DeviceDetailsRetrieverTask.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/task/impl/DeviceDetailsRetrieverTask.java @@ -18,10 +18,6 @@ package io.entgra.device.mgt.core.device.mgt.core.task.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.base.MultitenantConstants; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.OperationMonitoringTaskConfig; import io.entgra.device.mgt.core.device.mgt.common.StartupOperationConfig; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; @@ -29,6 +25,10 @@ import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHo import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; import io.entgra.device.mgt.core.device.mgt.core.task.DeviceMgtTaskException; import io.entgra.device.mgt.core.device.mgt.core.task.DeviceTaskManager; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.base.MultitenantConstants; +import org.wso2.carbon.context.PrivilegedCarbonContext; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/task/impl/DeviceTaskManagerImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/task/impl/DeviceTaskManagerImpl.java index cce42b48a0..56417e61db 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/task/impl/DeviceTaskManagerImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/task/impl/DeviceTaskManagerImpl.java @@ -18,17 +18,10 @@ package io.entgra.device.mgt.core.device.mgt.core.task.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.base.ServerConfiguration; -import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; -import io.entgra.device.mgt.core.device.mgt.common.MonitoringOperation; -import io.entgra.device.mgt.core.device.mgt.common.OperationMonitoringTaskConfig; -import io.entgra.device.mgt.core.device.mgt.common.StartupOperationConfig; +import io.entgra.device.mgt.core.device.mgt.common.*; import io.entgra.device.mgt.core.device.mgt.common.exceptions.InvalidDeviceException; import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Operation; import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.OperationManagementException; -import io.entgra.device.mgt.core.device.mgt.common.DynamicTaskContext; import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHolder; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.CommandOperation; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.ProfileOperation; @@ -36,12 +29,11 @@ import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProvide import io.entgra.device.mgt.core.device.mgt.core.task.DeviceMgtTaskException; import io.entgra.device.mgt.core.device.mgt.core.task.DeviceTaskManager; import io.entgra.device.mgt.core.device.mgt.core.task.Utils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.base.ServerConfiguration; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; public class DeviceTaskManagerImpl implements DeviceTaskManager { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/task/impl/DeviceTaskManagerServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/task/impl/DeviceTaskManagerServiceImpl.java index 03e5932423..5f7c256532 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/task/impl/DeviceTaskManagerServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/task/impl/DeviceTaskManagerServiceImpl.java @@ -20,13 +20,13 @@ package io.entgra.device.mgt.core.device.mgt.core.task.impl; import com.google.gson.Gson; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.OperationMonitoringTaskConfig; import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHolder; import io.entgra.device.mgt.core.device.mgt.core.task.DeviceMgtTaskException; import io.entgra.device.mgt.core.device.mgt.core.task.DeviceTaskManagerService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.ntask.common.TaskException; import org.wso2.carbon.ntask.core.TaskInfo; import org.wso2.carbon.ntask.core.TaskManager; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/task/impl/DynamicPartitionedScheduleTask.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/task/impl/DynamicPartitionedScheduleTask.java index 9a5338bf35..fd9ab1c8e4 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/task/impl/DynamicPartitionedScheduleTask.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/task/impl/DynamicPartitionedScheduleTask.java @@ -18,13 +18,13 @@ package io.entgra.device.mgt.core.device.mgt.core.task.impl; +import io.entgra.device.mgt.core.device.mgt.common.DynamicTaskContext; +import io.entgra.device.mgt.core.device.mgt.common.ServerCtxInfo; +import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHolder; import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.exception.HeartBeatManagementException; import io.entgra.device.mgt.core.task.mgt.common.constant.TaskMgtConstants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.device.mgt.common.DynamicTaskContext; -import io.entgra.device.mgt.core.device.mgt.common.ServerCtxInfo; -import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHolder; import org.wso2.carbon.ntask.core.Task; import java.util.Map; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/task/impl/RandomlyAssignedScheduleTask.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/task/impl/RandomlyAssignedScheduleTask.java index 959b2965e1..b79ef7718b 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/task/impl/RandomlyAssignedScheduleTask.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/task/impl/RandomlyAssignedScheduleTask.java @@ -18,10 +18,10 @@ package io.entgra.device.mgt.core.device.mgt.core.task.impl; +import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHolder; import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.exception.HeartBeatManagementException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHolder; import org.wso2.carbon.ntask.core.Task; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/traccar/api/service/TraccarClientFactory.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/traccar/api/service/TraccarClientFactory.java index fdcbc5e4ad..cbc3c92c81 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/traccar/api/service/TraccarClientFactory.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/traccar/api/service/TraccarClientFactory.java @@ -18,27 +18,14 @@ package io.entgra.device.mgt.core.device.mgt.core.traccar.api.service; -import okhttp3.ConnectionPool; -import okhttp3.MediaType; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; -import org.apache.commons.codec.binary.Base64; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.json.JSONArray; -import org.json.JSONObject; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.TrackerDeviceInfo; import io.entgra.device.mgt.core.device.mgt.common.TrackerGroupInfo; import io.entgra.device.mgt.core.device.mgt.common.TrackerPermissionInfo; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.TransactionManagementException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.TrackerAlreadyExistException; -import io.entgra.device.mgt.core.device.mgt.core.dao.TrackerManagementDAOException; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.TransactionManagementException; import io.entgra.device.mgt.core.device.mgt.core.dao.TrackerDAO; +import io.entgra.device.mgt.core.device.mgt.core.dao.TrackerManagementDAOException; import io.entgra.device.mgt.core.device.mgt.core.dao.TrackerManagementDAOFactory; -import io.entgra.device.mgt.core.device.mgt.core.traccar.api.service.TraccarClient; import io.entgra.device.mgt.core.device.mgt.core.traccar.api.service.impl.DeviceAPIClientServiceImpl; import io.entgra.device.mgt.core.device.mgt.core.traccar.common.TraccarHandlerConstants; import io.entgra.device.mgt.core.device.mgt.core.traccar.common.beans.TraccarDevice; @@ -49,6 +36,13 @@ import io.entgra.device.mgt.core.device.mgt.core.traccar.common.config.TraccarGa import io.entgra.device.mgt.core.device.mgt.core.traccar.common.util.TraccarUtil; import io.entgra.device.mgt.core.device.mgt.core.traccar.core.config.TraccarConfigurationManager; import io.entgra.device.mgt.core.device.mgt.core.util.HttpReportingUtil; +import okhttp3.*; +import org.apache.commons.codec.binary.Base64; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.json.JSONArray; +import org.json.JSONObject; +import org.wso2.carbon.context.PrivilegedCarbonContext; import java.io.IOException; import java.sql.SQLException; @@ -58,12 +52,7 @@ import java.util.Date; import java.util.List; import java.util.Objects; import java.util.Random; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; +import java.util.concurrent.*; import java.util.stream.Collectors; import java.util.stream.IntStream; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/traccar/api/service/addons/TraccarClientImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/traccar/api/service/addons/TraccarClientImpl.java index 2276b0117e..030128a76e 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/traccar/api/service/addons/TraccarClientImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/traccar/api/service/addons/TraccarClientImpl.java @@ -18,25 +18,13 @@ package io.entgra.device.mgt.core.device.mgt.core.traccar.api.service.addons; -import okhttp3.ConnectionPool; -import okhttp3.MediaType; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; -import org.apache.commons.codec.binary.Base64; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.json.JSONArray; -import org.json.JSONObject; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.TrackerDeviceInfo; import io.entgra.device.mgt.core.device.mgt.common.TrackerGroupInfo; import io.entgra.device.mgt.core.device.mgt.common.TrackerPermissionInfo; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.TransactionManagementException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.TrackerAlreadyExistException; -import io.entgra.device.mgt.core.device.mgt.core.dao.TrackerManagementDAOException; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.TransactionManagementException; import io.entgra.device.mgt.core.device.mgt.core.dao.TrackerDAO; +import io.entgra.device.mgt.core.device.mgt.core.dao.TrackerManagementDAOException; import io.entgra.device.mgt.core.device.mgt.core.dao.TrackerManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.traccar.api.service.TraccarClient; import io.entgra.device.mgt.core.device.mgt.core.traccar.api.service.impl.DeviceAPIClientServiceImpl; @@ -49,6 +37,13 @@ import io.entgra.device.mgt.core.device.mgt.core.traccar.common.config.TraccarGa import io.entgra.device.mgt.core.device.mgt.core.traccar.common.util.TraccarUtil; import io.entgra.device.mgt.core.device.mgt.core.traccar.core.config.TraccarConfigurationManager; import io.entgra.device.mgt.core.device.mgt.core.util.HttpReportingUtil; +import okhttp3.*; +import org.apache.commons.codec.binary.Base64; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.json.JSONArray; +import org.json.JSONObject; +import org.wso2.carbon.context.PrivilegedCarbonContext; import java.sql.SQLException; import java.time.LocalDateTime; @@ -57,12 +52,7 @@ import java.util.Date; import java.util.List; import java.util.Objects; import java.util.Random; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; +import java.util.concurrent.*; public class TraccarClientImpl implements TraccarClient { private static final Log log = LogFactory.getLog(TraccarClientImpl.class); diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/traccar/api/service/impl/DeviceAPIClientServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/traccar/api/service/impl/DeviceAPIClientServiceImpl.java index d7127e627b..e3c14f058e 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/traccar/api/service/impl/DeviceAPIClientServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/traccar/api/service/impl/DeviceAPIClientServiceImpl.java @@ -18,15 +18,12 @@ package io.entgra.device.mgt.core.device.mgt.core.traccar.api.service.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.json.JSONObject; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.TrackerDeviceInfo; import io.entgra.device.mgt.core.device.mgt.common.TrackerPermissionInfo; import io.entgra.device.mgt.core.device.mgt.common.device.details.DeviceLocation; -import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup; import io.entgra.device.mgt.core.device.mgt.common.exceptions.TrackerAlreadyExistException; +import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup; import io.entgra.device.mgt.core.device.mgt.core.dao.TrackerManagementDAOException; import io.entgra.device.mgt.core.device.mgt.core.traccar.api.service.DeviceAPIClientService; import io.entgra.device.mgt.core.device.mgt.core.traccar.api.service.TraccarClientFactory; @@ -34,6 +31,9 @@ import io.entgra.device.mgt.core.device.mgt.core.traccar.common.beans.TraccarDev import io.entgra.device.mgt.core.device.mgt.core.traccar.common.beans.TraccarGroups; import io.entgra.device.mgt.core.device.mgt.core.traccar.common.beans.TraccarPosition; import io.entgra.device.mgt.core.device.mgt.core.traccar.common.beans.TraccarUser; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.json.JSONObject; import java.util.Date; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/traccar/common/util/TraccarUtil.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/traccar/common/util/TraccarUtil.java index 620339819b..c883aabcc1 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/traccar/common/util/TraccarUtil.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/traccar/common/util/TraccarUtil.java @@ -18,9 +18,9 @@ package io.entgra.device.mgt.core.device.mgt.core.traccar.common.util; -import org.json.JSONObject; import io.entgra.device.mgt.core.device.mgt.core.traccar.common.beans.TraccarDevice; import io.entgra.device.mgt.core.device.mgt.core.traccar.common.beans.TraccarUser; +import org.json.JSONObject; import java.util.ArrayList; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/traccar/core/config/TraccarConfigurationManager.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/traccar/core/config/TraccarConfigurationManager.java index a4467a5c06..9e9949b245 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/traccar/core/config/TraccarConfigurationManager.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/traccar/core/config/TraccarConfigurationManager.java @@ -18,13 +18,13 @@ package io.entgra.device.mgt.core.device.mgt.core.traccar.core.config; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.w3c.dom.Document; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.core.traccar.common.TraccarHandlerConstants; import io.entgra.device.mgt.core.device.mgt.core.traccar.common.config.TraccarConfiguration; import io.entgra.device.mgt.core.device.mgt.core.util.DeviceManagerUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.w3c.dom.Document; import org.wso2.carbon.utils.CarbonUtils; import javax.xml.bind.JAXBContext; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/util/DeviceManagementSchemaInitializer.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/util/DeviceManagementSchemaInitializer.java index 08261627cb..af6bea400d 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/util/DeviceManagementSchemaInitializer.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/util/DeviceManagementSchemaInitializer.java @@ -18,9 +18,9 @@ package io.entgra.device.mgt.core.device.mgt.core.util; +import io.entgra.device.mgt.core.device.mgt.core.config.datasource.DataSourceConfig; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.device.mgt.core.config.datasource.DataSourceConfig; import org.wso2.carbon.utils.CarbonUtils; import org.wso2.carbon.utils.dbcreator.DatabaseCreator; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/util/DeviceManagerUtil.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/util/DeviceManagerUtil.java index b5b0dd11f9..ffefe8a2bd 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/util/DeviceManagerUtil.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/util/DeviceManagerUtil.java @@ -19,34 +19,8 @@ package io.entgra.device.mgt.core.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.CarbonContext; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.device.mgt.common.AppRegistrationCredentials; -import io.entgra.device.mgt.core.device.mgt.common.ApplicationRegistration; -import io.entgra.device.mgt.core.device.mgt.common.ApplicationRegistrationException; -import io.entgra.device.mgt.core.device.mgt.common.Device; -import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; -import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; -import io.entgra.device.mgt.core.device.mgt.common.GroupPaginationRequest; -import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; -import io.entgra.device.mgt.core.device.mgt.common.PaginationResult; -import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.ConfigurationEntry; -import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.ConfigurationManagementException; -import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.EnrollmentConfiguration; -import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.PlatformConfiguration; -import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.PlatformConfigurationManagementService; +import io.entgra.device.mgt.core.device.mgt.common.*; +import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.*; import io.entgra.device.mgt.core.device.mgt.common.event.config.EventConfigurationProviderService; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceNotFoundException; @@ -81,11 +55,21 @@ import io.entgra.device.mgt.core.identity.jwt.client.extension.JWTClient; import io.entgra.device.mgt.core.identity.jwt.client.extension.dto.AccessTokenInfo; import io.entgra.device.mgt.core.identity.jwt.client.extension.exception.JWTClientException; import io.entgra.device.mgt.core.identity.jwt.client.extension.service.JWTClientManagerService; -import org.wso2.carbon.user.api.RealmConfiguration; -import org.wso2.carbon.user.api.TenantManager; -import org.wso2.carbon.user.api.UserRealm; -import org.wso2.carbon.user.api.UserStoreException; -import org.wso2.carbon.user.api.UserStoreManager; +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.CarbonContext; +import org.wso2.carbon.context.PrivilegedCarbonContext; +import org.wso2.carbon.user.api.*; import org.wso2.carbon.user.core.config.RealmConfigXMLProcessor; import org.wso2.carbon.utils.CarbonUtils; import org.wso2.carbon.utils.ConfigurationContextService; @@ -104,13 +88,7 @@ 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; -import java.util.Map; -import java.util.StringJoiner; +import java.util.*; import java.util.concurrent.TimeUnit; import java.util.regex.Matcher; import java.util.regex.Pattern; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/util/HttpReportingUtil.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/util/HttpReportingUtil.java index 9b565b8048..642b50da81 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/util/HttpReportingUtil.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/util/HttpReportingUtil.java @@ -18,6 +18,8 @@ package io.entgra.device.mgt.core.device.mgt.core.util; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.EventPublishingException; +import io.entgra.device.mgt.core.device.mgt.core.DeviceManagementConstants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.HttpResponse; @@ -28,8 +30,7 @@ import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.protocol.HTTP; import org.json.JSONObject; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.EventPublishingException; -import io.entgra.device.mgt.core.device.mgt.core.DeviceManagementConstants; + import java.io.IOException; public class HttpReportingUtil { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/util/MDMAndroidOperationUtil.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/util/MDMAndroidOperationUtil.java index 61c34fcd4d..6b5d9660f7 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/util/MDMAndroidOperationUtil.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/util/MDMAndroidOperationUtil.java @@ -19,13 +19,13 @@ package io.entgra.device.mgt.core.device.mgt.core.util; import io.entgra.device.mgt.core.device.mgt.common.MDMAppConstants; +import io.entgra.device.mgt.core.device.mgt.common.app.mgt.App; import io.entgra.device.mgt.core.device.mgt.common.app.mgt.android.AppStoreApplication; import io.entgra.device.mgt.core.device.mgt.common.app.mgt.android.EnterpriseApplication; import io.entgra.device.mgt.core.device.mgt.common.app.mgt.android.WebApplication; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.UnknownApplicationTypeException; import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Operation; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.ProfileOperation; -import io.entgra.device.mgt.core.device.mgt.common.app.mgt.App; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.UnknownApplicationTypeException; /** * diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/util/MDMIOSOperationUtil.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/util/MDMIOSOperationUtil.java index ee25842794..3056f3a958 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/util/MDMIOSOperationUtil.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/util/MDMIOSOperationUtil.java @@ -19,11 +19,11 @@ package io.entgra.device.mgt.core.device.mgt.core.util; import io.entgra.device.mgt.core.device.mgt.common.MDMAppConstants; +import io.entgra.device.mgt.core.device.mgt.common.app.mgt.App; import io.entgra.device.mgt.core.device.mgt.common.app.mgt.ios.AppStoreApplication; import io.entgra.device.mgt.core.device.mgt.common.app.mgt.ios.EnterpriseApplication; import io.entgra.device.mgt.core.device.mgt.common.app.mgt.ios.RemoveApplication; import io.entgra.device.mgt.core.device.mgt.common.app.mgt.ios.WebClip; -import io.entgra.device.mgt.core.device.mgt.common.app.mgt.App; import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Operation; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.ProfileOperation; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/util/MDMWindowsOperationUtil.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/util/MDMWindowsOperationUtil.java index 932e2a6837..ac963c0a31 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/util/MDMWindowsOperationUtil.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/util/MDMWindowsOperationUtil.java @@ -23,8 +23,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.MDMAppConstants; import io.entgra.device.mgt.core.device.mgt.common.app.mgt.App; import io.entgra.device.mgt.core.device.mgt.common.app.mgt.windows.EnterpriseApplication; @@ -33,6 +31,8 @@ import io.entgra.device.mgt.core.device.mgt.common.app.mgt.windows.HostedMSIAppl import io.entgra.device.mgt.core.device.mgt.common.exceptions.UnknownApplicationTypeException; import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Operation; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.ProfileOperation; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.util.ArrayList; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/DeviceManagementConfigTests.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/DeviceManagementConfigTests.java index d71e8f7c67..f8e8135beb 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/DeviceManagementConfigTests.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/DeviceManagementConfigTests.java @@ -17,12 +17,12 @@ */ package io.entgra.device.mgt.core.device.mgt.core; +import io.entgra.device.mgt.core.device.mgt.core.config.DeviceManagementConfig; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.testng.Assert; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; -import io.entgra.device.mgt.core.device.mgt.core.config.DeviceManagementConfig; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/DeviceManagementRepositoryTests.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/DeviceManagementRepositoryTests.java index b14a258382..808d021f9e 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/DeviceManagementRepositoryTests.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/DeviceManagementRepositoryTests.java @@ -17,14 +17,14 @@ */ package io.entgra.device.mgt.core.device.mgt.core; -import org.testng.Assert; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.common.spi.DeviceManagementService; import io.entgra.device.mgt.core.device.mgt.core.common.TestDataHolder; import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHolder; import io.entgra.device.mgt.core.device.mgt.core.task.impl.DeviceTaskManagerServiceImpl; +import org.testng.Assert; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; public class DeviceManagementRepositoryTests{ diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/TestDeviceManager.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/TestDeviceManager.java index fff624bc13..1f75299e50 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/TestDeviceManager.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/TestDeviceManager.java @@ -17,12 +17,7 @@ */ package io.entgra.device.mgt.core.device.mgt.core; -import io.entgra.device.mgt.core.device.mgt.common.DeviceManager; -import io.entgra.device.mgt.core.device.mgt.common.FeatureManager; -import io.entgra.device.mgt.core.device.mgt.common.Device; -import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; -import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; -import io.entgra.device.mgt.core.device.mgt.common.Feature; +import io.entgra.device.mgt.core.device.mgt.common.*; import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.PlatformConfiguration; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.common.license.mgt.License; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/TestHeartBeatManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/TestHeartBeatManagementService.java index 0e5f71243c..93140f9a55 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/TestHeartBeatManagementService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/TestHeartBeatManagementService.java @@ -18,11 +18,11 @@ package io.entgra.device.mgt.core.device.mgt.core; +import io.entgra.device.mgt.core.device.mgt.common.ServerCtxInfo; import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.dto.HeartBeatEvent; import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.dto.ServerContext; import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.exception.HeartBeatManagementException; import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service.HeartBeatManagementService; -import io.entgra.device.mgt.core.device.mgt.common.ServerCtxInfo; import java.util.Map; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/TestTaskServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/TestTaskServiceImpl.java index b4975e233b..f1debd39ec 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/TestTaskServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/TestTaskServiceImpl.java @@ -19,11 +19,9 @@ package io.entgra.device.mgt.core.device.mgt.core; import io.entgra.device.mgt.core.device.mgt.core.task.TestTaskManagerImpl; import org.wso2.carbon.ntask.common.TaskException; -import org.wso2.carbon.ntask.core.TaskInfo; import org.wso2.carbon.ntask.core.TaskManager; import org.wso2.carbon.ntask.core.service.TaskService; -import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/TestUtils.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/TestUtils.java index 4d8e11064d..6fd476c1d9 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/TestUtils.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/TestUtils.java @@ -17,13 +17,13 @@ */ package io.entgra.device.mgt.core.device.mgt.core; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.GroupPaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup; import io.entgra.device.mgt.core.device.mgt.core.common.TestDataHolder; import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHolder; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.wso2.carbon.registry.core.config.RegistryContext; import org.wso2.carbon.registry.core.exceptions.RegistryException; import org.wso2.carbon.registry.core.internal.RegistryDataHolder; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/app/mgt/AppManagementConfigurationManagerTest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/app/mgt/AppManagementConfigurationManagerTest.java index 6db3fc98de..4a9daf3b27 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/app/mgt/AppManagementConfigurationManagerTest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/app/mgt/AppManagementConfigurationManagerTest.java @@ -18,12 +18,12 @@ package io.entgra.device.mgt.core.device.mgt.core.app.mgt; +import io.entgra.device.mgt.core.device.mgt.core.app.mgt.config.AppManagementConfig; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.testng.Assert; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; -import io.entgra.device.mgt.core.device.mgt.core.app.mgt.config.AppManagementConfig; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/app/mgt/ApplicationManagementProviderServiceTest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/app/mgt/ApplicationManagementProviderServiceTest.java index bac36561e4..21e0652a98 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/app/mgt/ApplicationManagementProviderServiceTest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/app/mgt/ApplicationManagementProviderServiceTest.java @@ -17,18 +17,18 @@ */ package io.entgra.device.mgt.core.device.mgt.core.app.mgt; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.testng.Assert; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.common.app.mgt.Application; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.core.DeviceManagementPluginRepository; import io.entgra.device.mgt.core.device.mgt.core.TestDeviceManagementService; import io.entgra.device.mgt.core.device.mgt.core.common.TestDataHolder; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.testng.Assert; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; import java.util.ArrayList; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/authorization/DeviceAccessAuthorizationServiceTest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/authorization/DeviceAccessAuthorizationServiceTest.java index 6565a4b029..4350031c02 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/authorization/DeviceAccessAuthorizationServiceTest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/authorization/DeviceAccessAuthorizationServiceTest.java @@ -18,23 +18,13 @@ package io.entgra.device.mgt.core.device.mgt.core.authorization; -import org.apache.commons.dbcp.BasicDataSource; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.mockito.Mockito; -import org.testng.Assert; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; -import org.wso2.carbon.CarbonConstants; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceNotFoundException; import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; import io.entgra.device.mgt.core.device.mgt.common.authorization.DeviceAccessAuthorizationException; import io.entgra.device.mgt.core.device.mgt.common.authorization.DeviceAuthorizationResult; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceNotFoundException; import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupManagementException; import io.entgra.device.mgt.core.device.mgt.common.group.mgt.RoleDoesNotExistException; import io.entgra.device.mgt.core.device.mgt.common.permission.mgt.PermissionManagementException; @@ -47,23 +37,30 @@ import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProvide import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderServiceImpl; import io.entgra.device.mgt.core.device.mgt.core.service.GroupManagementProviderService; import io.entgra.device.mgt.core.device.mgt.core.service.GroupManagementProviderServiceImpl; +import org.apache.commons.dbcp.BasicDataSource; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.mockito.Mockito; +import org.testng.Assert; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; +import org.wso2.carbon.CarbonConstants; +import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.registry.core.config.RegistryContext; import org.wso2.carbon.registry.core.exceptions.RegistryException; import org.wso2.carbon.registry.core.internal.RegistryDataHolder; import org.wso2.carbon.registry.core.jdbc.realm.InMemoryRealmService; import org.wso2.carbon.registry.core.service.RegistryService; +import org.wso2.carbon.user.api.Permission; import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.user.api.UserStoreManager; -import org.wso2.carbon.user.api.Permission; import org.wso2.carbon.user.core.service.RealmService; import org.wso2.carbon.user.core.tenant.JDBCTenantManager; import org.wso2.carbon.utils.multitenancy.MultitenantConstants; + import java.io.InputStream; -import java.util.ArrayList; -import java.util.Map; -import java.util.List; -import java.util.HashMap; -import java.util.Arrays; +import java.util.*; /** * Unit tests for DeviceAccessAuthorizationServiceTest diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/cache/DeviceCacheManagerImplTest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/cache/DeviceCacheManagerImplTest.java index afe3d20299..dbd947cc02 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/cache/DeviceCacheManagerImplTest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/cache/DeviceCacheManagerImplTest.java @@ -18,11 +18,6 @@ package io.entgra.device.mgt.core.device.mgt.core.cache; -import org.mockito.Mockito; -import org.testng.Assert; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; @@ -32,7 +27,13 @@ import io.entgra.device.mgt.core.device.mgt.core.common.TestDataHolder; import io.entgra.device.mgt.core.device.mgt.core.config.DeviceConfigurationManager; import io.entgra.device.mgt.core.device.mgt.core.config.DeviceManagementConfig; import io.entgra.device.mgt.core.device.mgt.core.config.cache.DeviceCacheConfiguration; +import org.mockito.Mockito; +import org.testng.Assert; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; +import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.utils.multitenancy.MultitenantConstants; + import java.io.File; import java.io.IOException; import java.util.ArrayList; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/common/BaseDeviceManagementTest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/common/BaseDeviceManagementTest.java index 993a83a046..d1e87b7b66 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/common/BaseDeviceManagementTest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/common/BaseDeviceManagementTest.java @@ -17,17 +17,6 @@ */ package io.entgra.device.mgt.core.device.mgt.core.common; -import org.apache.axis2.AxisFault; -import org.apache.axis2.context.ConfigurationContext; -import org.apache.axis2.context.ConfigurationContextFactory; -import org.apache.tomcat.jdbc.pool.PoolProperties; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeSuite; -import org.testng.annotations.Optional; -import org.testng.annotations.Parameters; -import org.w3c.dom.Document; -import org.wso2.carbon.base.MultitenantConstants; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.core.TestUtils; import io.entgra.device.mgt.core.device.mgt.core.authorization.DeviceAccessAuthorizationServiceImpl; @@ -44,6 +33,17 @@ import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProvide import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderServiceImpl; import io.entgra.device.mgt.core.device.mgt.core.service.GroupManagementProviderServiceImpl; import io.entgra.device.mgt.core.device.mgt.core.util.DeviceManagerUtil; +import org.apache.axis2.AxisFault; +import org.apache.axis2.context.ConfigurationContext; +import org.apache.axis2.context.ConfigurationContextFactory; +import org.apache.tomcat.jdbc.pool.PoolProperties; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.BeforeSuite; +import org.testng.annotations.Optional; +import org.testng.annotations.Parameters; +import org.w3c.dom.Document; +import org.wso2.carbon.base.MultitenantConstants; +import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.registry.core.config.RegistryContext; import org.wso2.carbon.registry.core.exceptions.RegistryException; import org.wso2.carbon.registry.core.internal.RegistryDataHolder; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/common/TestDataHolder.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/common/TestDataHolder.java index bea2094a77..cec70c6b67 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/common/TestDataHolder.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/common/TestDataHolder.java @@ -17,11 +17,7 @@ */ package io.entgra.device.mgt.core.device.mgt.core.common; -import io.entgra.device.mgt.core.device.mgt.common.Device; -import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; -import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; -import io.entgra.device.mgt.core.device.mgt.common.MonitoringOperation; -import io.entgra.device.mgt.core.device.mgt.common.OperationMonitoringTaskConfig; +import io.entgra.device.mgt.core.device.mgt.common.*; import io.entgra.device.mgt.core.device.mgt.common.app.mgt.Application; import io.entgra.device.mgt.core.device.mgt.common.device.details.DeviceInfo; import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/dao/DevicePersistTests.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/dao/DevicePersistTests.java index f069c1fb43..f55bb1a0e2 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/dao/DevicePersistTests.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/dao/DevicePersistTests.java @@ -18,11 +18,6 @@ package io.entgra.device.mgt.core.device.mgt.core.dao; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.testng.Assert; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo.Status; @@ -31,8 +26,16 @@ import io.entgra.device.mgt.core.device.mgt.core.TestUtils; import io.entgra.device.mgt.core.device.mgt.core.common.BaseDeviceManagementTest; import io.entgra.device.mgt.core.device.mgt.core.common.TestDataHolder; import io.entgra.device.mgt.core.device.mgt.core.dto.DeviceType; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.testng.Assert; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; -import java.sql.*; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; public class DevicePersistTests extends BaseDeviceManagementTest { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/dao/DeviceStatusPersistenceTests.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/dao/DeviceStatusPersistenceTests.java index 3019e94c4e..47ef0237b7 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/dao/DeviceStatusPersistenceTests.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/dao/DeviceStatusPersistenceTests.java @@ -17,20 +17,19 @@ */ package io.entgra.device.mgt.core.device.mgt.core.dao; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.testng.Assert; -import org.testng.annotations.Test; -import org.testng.annotations.BeforeClass; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; import io.entgra.device.mgt.core.device.mgt.common.type.mgt.DeviceStatus; import io.entgra.device.mgt.core.device.mgt.core.common.BaseDeviceManagementTest; import io.entgra.device.mgt.core.device.mgt.core.common.TestDataHolder; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.testng.Assert; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; import java.sql.SQLException; import java.util.*; -import java.util.List; import java.util.stream.Stream; import static io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo.Status.*; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/dao/EnrolmentPersistenceTests.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/dao/EnrolmentPersistenceTests.java index c46f525c14..98834416ca 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/dao/EnrolmentPersistenceTests.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/dao/EnrolmentPersistenceTests.java @@ -17,15 +17,15 @@ */ package io.entgra.device.mgt.core.device.mgt.core.dao; +import io.entgra.device.mgt.core.device.mgt.common.Device; +import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; +import io.entgra.device.mgt.core.device.mgt.core.common.BaseDeviceManagementTest; +import io.entgra.device.mgt.core.device.mgt.core.common.TestDataHolder; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.testng.Assert; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; -import io.entgra.device.mgt.core.device.mgt.common.Device; -import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; -import io.entgra.device.mgt.core.device.mgt.core.common.BaseDeviceManagementTest; -import io.entgra.device.mgt.core.device.mgt.core.common.TestDataHolder; import java.sql.SQLException; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/dao/GroupPersistTests.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/dao/GroupPersistTests.java index 0ea871994c..4cb9f9a243 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/dao/GroupPersistTests.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/dao/GroupPersistTests.java @@ -18,17 +18,17 @@ package io.entgra.device.mgt.core.device.mgt.core.dao; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.testng.Assert; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.GroupPaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.exceptions.TransactionManagementException; import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup; import io.entgra.device.mgt.core.device.mgt.core.common.BaseDeviceManagementTest; import io.entgra.device.mgt.core.device.mgt.core.common.TestDataHolder; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.testng.Assert; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; import java.sql.SQLException; import java.util.ArrayList; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/geo/service/GeoLocationProviderServiceTest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/geo/service/GeoLocationProviderServiceTest.java index f6c5ac8cc3..7ebfa3df1f 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/geo/service/GeoLocationProviderServiceTest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/geo/service/GeoLocationProviderServiceTest.java @@ -18,10 +18,6 @@ package io.entgra.device.mgt.core.device.mgt.core.geo.service; -import org.mockito.Mockito; -import org.testng.Assert; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; @@ -33,6 +29,10 @@ import io.entgra.device.mgt.core.device.mgt.core.TestDeviceManagementService; import io.entgra.device.mgt.core.device.mgt.core.common.TestDataHolder; import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHolder; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; +import org.mockito.Mockito; +import org.testng.Assert; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; import org.wso2.carbon.event.processor.stub.EventProcessorAdminServiceStub; import org.wso2.carbon.event.processor.stub.types.ExecutionPlanConfigurationDto; import org.wso2.carbon.utils.multitenancy.MultitenantConstants; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/mock/MockConnection.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/mock/MockConnection.java index 6ed496af34..58f6de47ae 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/mock/MockConnection.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/mock/MockConnection.java @@ -17,23 +17,7 @@ */ package io.entgra.device.mgt.core.device.mgt.core.mock; -import java.sql.Array; -import java.sql.Blob; -import java.sql.CallableStatement; -import java.sql.Clob; -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.NClob; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.RowIdLifetime; -import java.sql.SQLClientInfoException; -import java.sql.SQLException; -import java.sql.SQLWarning; -import java.sql.SQLXML; -import java.sql.Savepoint; -import java.sql.Statement; -import java.sql.Struct; +import java.sql.*; import java.util.ArrayList; import java.util.List; import java.util.Map; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/mock/MockDataSource.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/mock/MockDataSource.java index 9abcac8e56..7fb19f0e64 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/mock/MockDataSource.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/mock/MockDataSource.java @@ -17,8 +17,7 @@ */ package io.entgra.device.mgt.core.device.mgt.core.mock; -import org.mockito.Mock; - +import javax.sql.DataSource; import java.io.PrintWriter; import java.sql.Connection; import java.sql.SQLException; @@ -26,7 +25,6 @@ import java.sql.SQLFeatureNotSupportedException; import java.util.ArrayList; import java.util.List; import java.util.logging.Logger; -import javax.sql.DataSource; /** * This is the mock data source implementation that will be used in the test cases. diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/mock/MockDatabaseMetaData.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/mock/MockDatabaseMetaData.java index bfba37aaf7..c63ebb0d8d 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/mock/MockDatabaseMetaData.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/mock/MockDatabaseMetaData.java @@ -19,11 +19,7 @@ package io.entgra.device.mgt.core.device.mgt.core.mock; import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.ResultSet; -import java.sql.RowIdLifetime; -import java.sql.SQLException; +import java.sql.*; public class MockDatabaseMetaData implements DatabaseMetaData { private String url; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/mock/MockJDBCDriver.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/mock/MockJDBCDriver.java index 69326b5021..835a974c95 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/mock/MockJDBCDriver.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/mock/MockJDBCDriver.java @@ -17,11 +17,7 @@ */ package io.entgra.device.mgt.core.device.mgt.core.mock; -import java.sql.Connection; -import java.sql.Driver; -import java.sql.DriverPropertyInfo; -import java.sql.SQLException; -import java.sql.SQLFeatureNotSupportedException; +import java.sql.*; import java.util.Properties; import java.util.logging.Logger; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/mock/MockResultSet.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/mock/MockResultSet.java index 8b66d170b3..97153d485a 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/mock/MockResultSet.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/mock/MockResultSet.java @@ -21,21 +21,7 @@ import java.io.InputStream; import java.io.Reader; import java.math.BigDecimal; import java.net.URL; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Date; -import java.sql.NClob; -import java.sql.Ref; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.RowId; -import java.sql.SQLException; -import java.sql.SQLWarning; -import java.sql.SQLXML; -import java.sql.Statement; -import java.sql.Time; -import java.sql.Timestamp; +import java.sql.*; import java.util.ArrayList; import java.util.Calendar; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/mock/MockStatement.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/mock/MockStatement.java index 3abd1d2e8d..e531e5fd1d 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/mock/MockStatement.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/mock/MockStatement.java @@ -21,24 +21,7 @@ import java.io.InputStream; import java.io.Reader; import java.math.BigDecimal; import java.net.URL; -import java.sql.Array; -import java.sql.Blob; -import java.sql.Clob; -import java.sql.Connection; -import java.sql.Date; -import java.sql.NClob; -import java.sql.ParameterMetaData; -import java.sql.PreparedStatement; -import java.sql.Ref; -import java.sql.ResultSet; -import java.sql.ResultSetMetaData; -import java.sql.RowId; -import java.sql.SQLException; -import java.sql.SQLWarning; -import java.sql.SQLXML; -import java.sql.Statement; -import java.sql.Time; -import java.sql.Timestamp; +import java.sql.*; import java.util.ArrayList; import java.util.Calendar; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/notification/mgt/NotificationManagementServiceImplTests.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/notification/mgt/NotificationManagementServiceImplTests.java index 0642e6d8b5..3594a7872b 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/notification/mgt/NotificationManagementServiceImplTests.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/notification/mgt/NotificationManagementServiceImplTests.java @@ -17,16 +17,11 @@ */ package io.entgra.device.mgt.core.device.mgt.core.notification.mgt; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.testng.Assert; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.EntityDoesNotExistException; import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.PaginationResult; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.EntityDoesNotExistException; import io.entgra.device.mgt.core.device.mgt.common.notification.mgt.Notification; import io.entgra.device.mgt.core.device.mgt.common.notification.mgt.NotificationManagementException; import io.entgra.device.mgt.core.device.mgt.core.TestDeviceManagementService; @@ -38,6 +33,11 @@ import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementServic import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderServiceImpl; import io.entgra.device.mgt.core.device.mgt.core.service.GroupManagementProviderServiceImpl; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.testng.Assert; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; import org.wso2.carbon.registry.core.config.RegistryContext; import org.wso2.carbon.registry.core.exceptions.RegistryException; import org.wso2.carbon.registry.core.internal.RegistryDataHolder; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/operation/OperationManagementNegativeDBOperationTest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/operation/OperationManagementNegativeDBOperationTest.java index 04c82b5f80..d72fa2f28a 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/operation/OperationManagementNegativeDBOperationTest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/operation/OperationManagementNegativeDBOperationTest.java @@ -17,15 +17,10 @@ */ package io.entgra.device.mgt.core.device.mgt.core.operation; -import org.powermock.api.mockito.PowerMockito; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Operation; import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.OperationManagementException; import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.OperationManager; @@ -38,6 +33,11 @@ import io.entgra.device.mgt.core.device.mgt.core.mock.MockDataSource; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.OperationManagerImpl; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; +import org.powermock.api.mockito.PowerMockito; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; +import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.utils.multitenancy.MultitenantConstants; import javax.sql.DataSource; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/operation/OperationManagementNoDBSchemaTests.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/operation/OperationManagementNoDBSchemaTests.java index 2025d6800b..f9f1485839 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/operation/OperationManagementNoDBSchemaTests.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/operation/OperationManagementNoDBSchemaTests.java @@ -18,16 +18,11 @@ package io.entgra.device.mgt.core.device.mgt.core.operation; -import org.powermock.api.mockito.PowerMockito; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; +import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.InvalidDeviceException; -import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Operation; import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.OperationManagementException; import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.OperationManager; @@ -41,6 +36,11 @@ import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.CommandOperation; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.OperationManagerImpl; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; +import org.powermock.api.mockito.PowerMockito; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; +import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.utils.multitenancy.MultitenantConstants; import javax.sql.DataSource; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/operation/OperationManagementTests.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/operation/OperationManagementTests.java index dca9d7ebd6..10a522dd56 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/operation/OperationManagementTests.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/operation/OperationManagementTests.java @@ -18,37 +18,25 @@ package io.entgra.device.mgt.core.device.mgt.core.operation; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.powermock.api.mockito.PowerMockito; -import org.testng.Assert; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.device.mgt.common.Device; -import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; +import io.entgra.device.mgt.core.device.mgt.common.*; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; -import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; import io.entgra.device.mgt.core.device.mgt.common.exceptions.InvalidDeviceException; -import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; -import io.entgra.device.mgt.core.device.mgt.common.PaginationResult; -import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Activity; -import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.ActivityStatus; -import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Operation; -import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.OperationManagementException; -import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.OperationManager; +import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.*; import io.entgra.device.mgt.core.device.mgt.common.spi.DeviceManagementService; import io.entgra.device.mgt.core.device.mgt.core.DeviceManagementConstants; import io.entgra.device.mgt.core.device.mgt.core.TestDeviceManagementService; import io.entgra.device.mgt.core.device.mgt.core.common.BaseDeviceManagementTest; import io.entgra.device.mgt.core.device.mgt.core.common.TestDataHolder; import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHolder; -import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.CommandOperation; -import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.ConfigOperation; -import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.OperationManagerImpl; -import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.PolicyOperation; -import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.ProfileOperation; +import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.*; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.powermock.api.mockito.PowerMockito; +import org.testng.Assert; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; +import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.utils.multitenancy.MultitenantConstants; import java.text.ParseException; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/operation/ScheduledTaskOperationTests.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/operation/ScheduledTaskOperationTests.java index b447849c21..bcf0045faf 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/operation/ScheduledTaskOperationTests.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/operation/ScheduledTaskOperationTests.java @@ -17,11 +17,6 @@ */ package io.entgra.device.mgt.core.device.mgt.core.operation; -import org.mockito.Mockito; -import org.powermock.api.mockito.PowerMockito; -import org.testng.Assert; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; @@ -42,6 +37,11 @@ import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.OperationManagerI import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; import io.entgra.device.mgt.core.device.mgt.core.task.DeviceTaskManagerService; import io.entgra.device.mgt.core.device.mgt.core.task.impl.DeviceTaskManagerServiceImpl; +import org.mockito.Mockito; +import org.powermock.api.mockito.PowerMockito; +import org.testng.Assert; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; import org.wso2.carbon.ntask.core.internal.TasksDSComponent; import org.wso2.carbon.ntask.core.service.TaskService; import org.wso2.carbon.ntask.core.service.impl.TaskServiceImpl; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/permission/mgt/PermissionManagerServiceTest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/permission/mgt/PermissionManagerServiceTest.java index 1c8189374f..9af3c4a94b 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/permission/mgt/PermissionManagerServiceTest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/permission/mgt/PermissionManagerServiceTest.java @@ -17,6 +17,9 @@ */ package io.entgra.device.mgt.core.device.mgt.core.permission.mgt; +import io.entgra.device.mgt.core.device.mgt.common.permission.mgt.Permission; +import io.entgra.device.mgt.core.device.mgt.common.permission.mgt.PermissionManagementException; +import io.entgra.device.mgt.core.device.mgt.common.permission.mgt.PermissionManagerService; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.powermock.api.mockito.PowerMockito; @@ -26,14 +29,10 @@ import org.testng.IObjectFactory; import org.testng.annotations.BeforeClass; import org.testng.annotations.ObjectFactory; import org.testng.annotations.Test; -import io.entgra.device.mgt.core.device.mgt.common.permission.mgt.Permission; -import io.entgra.device.mgt.core.device.mgt.common.permission.mgt.PermissionManagementException; -import io.entgra.device.mgt.core.device.mgt.common.permission.mgt.PermissionManagerService; import org.wso2.carbon.registry.core.exceptions.RegistryException; import java.util.ArrayList; import java.util.List; -import java.util.Properties; import static org.mockito.MockitoAnnotations.initMocks; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/push/notification/mgt/task/PushNotificationSchedulerTaskTest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/push/notification/mgt/task/PushNotificationSchedulerTaskTest.java index 7d92b9faa1..bc593718d3 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/push/notification/mgt/task/PushNotificationSchedulerTaskTest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/push/notification/mgt/task/PushNotificationSchedulerTaskTest.java @@ -17,12 +17,6 @@ */ package io.entgra.device.mgt.core.device.mgt.core.push.notification.mgt.task; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.mockito.Mockito; -import org.testng.Assert; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.OperationManagementException; import io.entgra.device.mgt.core.device.mgt.core.common.BaseDeviceManagementTest; @@ -37,6 +31,12 @@ import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationMana import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.OperationManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderServiceImpl; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.mockito.Mockito; +import org.testng.Assert; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; import org.wso2.carbon.registry.core.exceptions.RegistryException; import java.sql.SQLException; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/search/DeviceDetails.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/search/DeviceDetails.java index 3c7365936e..71806501fa 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/search/DeviceDetails.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/search/DeviceDetails.java @@ -19,16 +19,16 @@ package io.entgra.device.mgt.core.device.mgt.core.search; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; import io.entgra.device.mgt.core.device.mgt.core.common.BaseDeviceManagementTest; import io.entgra.device.mgt.core.device.mgt.core.device.details.mgt.DeviceInformationManager; import io.entgra.device.mgt.core.device.mgt.core.device.details.mgt.impl.DeviceInformationManagerImpl; import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHolder; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderServiceImpl; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; public class DeviceDetails extends BaseDeviceManagementTest { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/search/ProcessorImplTest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/search/ProcessorImplTest.java index 9201787541..089b945f95 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/search/ProcessorImplTest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/search/ProcessorImplTest.java @@ -17,9 +17,6 @@ */ package io.entgra.device.mgt.core.device.mgt.core.search; -import org.testng.Assert; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.search.Condition; @@ -36,6 +33,9 @@ import io.entgra.device.mgt.core.device.mgt.core.search.util.ChangeEnumValues; import io.entgra.device.mgt.core.device.mgt.core.search.util.Utils; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderServiceImpl; +import org.testng.Assert; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; import org.wso2.carbon.utils.multitenancy.MultitenantConstants; import java.util.ArrayList; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/search/SearchManagementServiceTest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/search/SearchManagementServiceTest.java index ba75d0a964..be03fff69f 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/search/SearchManagementServiceTest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/search/SearchManagementServiceTest.java @@ -17,15 +17,10 @@ */ package io.entgra.device.mgt.core.device.mgt.core.search; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.testng.Assert; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.common.device.details.DeviceInfo; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.common.search.Condition; import io.entgra.device.mgt.core.device.mgt.common.search.SearchContext; import io.entgra.device.mgt.core.device.mgt.core.TestDeviceManagementService; @@ -43,6 +38,11 @@ import io.entgra.device.mgt.core.device.mgt.core.search.mgt.impl.SearchManagerSe import io.entgra.device.mgt.core.device.mgt.core.search.util.Utils; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderServiceImpl; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.testng.Assert; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; import org.wso2.carbon.utils.multitenancy.MultitenantConstants; import java.util.ArrayList; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/search/SearchMgtUtilTest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/search/SearchMgtUtilTest.java index 6a88dcc289..c641d2faeb 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/search/SearchMgtUtilTest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/search/SearchMgtUtilTest.java @@ -17,13 +17,13 @@ */ package io.entgra.device.mgt.core.device.mgt.core.search; -import org.junit.Assert; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.core.common.TestDataHolder; import io.entgra.device.mgt.core.device.mgt.core.search.mgt.impl.Utils; +import org.junit.Assert; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; import java.util.ArrayList; import java.util.HashMap; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceTest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceTest.java index e1bbe3ee76..009d746a6e 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceTest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/service/DeviceManagementProviderServiceTest.java @@ -18,21 +18,10 @@ package io.entgra.device.mgt.core.device.mgt.core.service; -import org.apache.commons.collections.map.SingletonMap; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.mockito.Mockito; -import org.testng.Assert; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; -import io.entgra.device.mgt.core.device.mgt.common.Device; -import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; +import io.entgra.device.mgt.core.device.mgt.common.*; +import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.ConfigurationManagementException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; -import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; -import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; -import io.entgra.device.mgt.core.device.mgt.common.PaginationResult; import io.entgra.device.mgt.core.device.mgt.common.exceptions.TransactionManagementException; -import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.ConfigurationManagementException; import io.entgra.device.mgt.core.device.mgt.common.license.mgt.License; import io.entgra.device.mgt.core.device.mgt.core.TestDeviceManagementService; import io.entgra.device.mgt.core.device.mgt.core.authorization.DeviceAccessAuthorizationServiceImpl; @@ -52,6 +41,13 @@ import io.entgra.device.mgt.core.device.mgt.core.mock.MockConnection; import io.entgra.device.mgt.core.device.mgt.core.mock.MockDataSource; import io.entgra.device.mgt.core.device.mgt.core.mock.MockResultSet; import io.entgra.device.mgt.core.device.mgt.core.mock.MockStatement; +import org.apache.commons.collections.map.SingletonMap; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.mockito.Mockito; +import org.testng.Assert; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; import org.wso2.carbon.registry.core.config.RegistryContext; import org.wso2.carbon.registry.core.exceptions.RegistryException; import org.wso2.carbon.registry.core.internal.RegistryDataHolder; @@ -64,12 +60,7 @@ import org.wso2.carbon.utils.multitenancy.MultitenantConstants; import java.io.InputStream; import java.lang.reflect.Field; import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Collections; -import java.util.Date; -import java.util.List; -import java.util.Properties; +import java.util.*; public class DeviceManagementProviderServiceTest extends BaseDeviceManagementTest { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceNegativeTest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceNegativeTest.java index 5981065e8e..0e514dcfb9 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceNegativeTest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceNegativeTest.java @@ -18,8 +18,6 @@ package io.entgra.device.mgt.core.device.mgt.core.service; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceNotFoundException; import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupManagementException; @@ -27,6 +25,8 @@ import io.entgra.device.mgt.core.device.mgt.common.group.mgt.RoleDoesNotExistExc import io.entgra.device.mgt.core.device.mgt.core.TestUtils; import io.entgra.device.mgt.core.device.mgt.core.common.BaseDeviceManagementTest; import io.entgra.device.mgt.core.device.mgt.core.dao.GroupManagementDAOFactory; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; import javax.sql.DataSource; import java.util.ArrayList; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceTest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceTest.java index cbf4301b14..ab905eea96 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceTest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceTest.java @@ -18,27 +18,23 @@ package io.entgra.device.mgt.core.device.mgt.core.service; -import org.testng.Assert; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceNotFoundException; import io.entgra.device.mgt.core.device.mgt.common.GroupPaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.PaginationResult; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceNotFoundException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.TransactionManagementException; -import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup; -import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupAlreadyExistException; -import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupManagementException; -import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupNotExistException; -import io.entgra.device.mgt.core.device.mgt.common.group.mgt.RoleDoesNotExistException; +import io.entgra.device.mgt.core.device.mgt.common.group.mgt.*; import io.entgra.device.mgt.core.device.mgt.core.TestUtils; import io.entgra.device.mgt.core.device.mgt.core.common.BaseDeviceManagementTest; import io.entgra.device.mgt.core.device.mgt.core.common.TestDataHolder; import io.entgra.device.mgt.core.device.mgt.core.config.DeviceConfigurationManager; import io.entgra.device.mgt.core.device.mgt.core.config.cache.DeviceCacheConfiguration; import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHolder; +import org.testng.Assert; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; import org.wso2.carbon.registry.core.jdbc.realm.InMemoryRealmService; import org.wso2.carbon.user.api.Permission; import org.wso2.carbon.user.api.UserStoreException; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/task/DeviceTaskManagerServiceTest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/task/DeviceTaskManagerServiceTest.java index 9bd5beca62..0a1504d952 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/task/DeviceTaskManagerServiceTest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/task/DeviceTaskManagerServiceTest.java @@ -17,17 +17,17 @@ */ package io.entgra.device.mgt.core.device.mgt.core.task; +import io.entgra.device.mgt.core.device.mgt.core.TestTaskServiceImpl; +import io.entgra.device.mgt.core.device.mgt.core.common.TestDataHolder; +import io.entgra.device.mgt.core.device.mgt.core.config.DeviceConfigurationManager; +import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHolder; +import io.entgra.device.mgt.core.device.mgt.core.task.impl.DeviceTaskManagerServiceImpl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.mockito.Mockito; import org.testng.Assert; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; -import io.entgra.device.mgt.core.device.mgt.core.TestTaskServiceImpl; -import io.entgra.device.mgt.core.device.mgt.core.common.TestDataHolder; -import io.entgra.device.mgt.core.device.mgt.core.config.DeviceConfigurationManager; -import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHolder; -import io.entgra.device.mgt.core.device.mgt.core.task.impl.DeviceTaskManagerServiceImpl; import org.wso2.carbon.ntask.common.TaskException; import org.wso2.carbon.ntask.core.TaskInfo; import org.wso2.carbon.ntask.core.TaskManager; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/task/DeviceTaskManagerTest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/task/DeviceTaskManagerTest.java index 335ba0dc25..cb8e7ccc1b 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/task/DeviceTaskManagerTest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/test/java/io/entgra/device/mgt/core/device/mgt/core/task/DeviceTaskManagerTest.java @@ -17,14 +17,6 @@ */ package io.entgra.device.mgt.core.device.mgt.core.task; -import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service.HeartBeatManagementService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.powermock.api.mockito.PowerMockito; -import org.testng.Assert; -import org.testng.annotations.AfterClass; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; @@ -46,14 +38,18 @@ import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProvide import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderServiceImpl; import io.entgra.device.mgt.core.device.mgt.core.task.impl.DeviceDetailsRetrieverTask; import io.entgra.device.mgt.core.device.mgt.core.task.impl.DeviceTaskManagerImpl; +import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service.HeartBeatManagementService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.powermock.api.mockito.PowerMockito; +import org.testng.Assert; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; import org.wso2.carbon.registry.core.exceptions.RegistryException; import org.wso2.carbon.utils.multitenancy.MultitenantConstants; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; +import java.util.*; /** * This is a test class to test the functionality in {@link DeviceTaskManager}. diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml index 6a1eb4018d..a9814241de 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/pom.xml @@ -31,9 +31,14 @@ bundle WSO2 Carbon - Device Management Extensions WSO2 Carbon - Device Management Extensions - http://wso2.org + https://entgra.io + + org.apache.felix + org.apache.felix.scr.ds-annotations + provided + org.wso2.carbon.governance org.wso2.carbon.governance.api @@ -144,10 +149,14 @@ - - org.apache.felix - maven-scr-plugin - + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + org.apache.felix maven-bundle-plugin @@ -163,34 +172,56 @@ io.entgra.device.mgt.core.device.mgt.extensions.* - org.wso2.carbon.governance.api.*, - javax.xml.namespace;resolution:=optional, - org.wso2.carbon.context, - io.entgra.device.mgt.core.device.mgt.common.*, - org.wso2.carbon.registry.api, - org.wso2.carbon.registry.core, - org.wso2.carbon.registry.core.exceptions, - org.wso2.carbon.registry.core.session, - org.wso2.carbon.base, - javax.xml.bind, - org.apache.commons.logging, - org.wso2.carbon.utils, - javax.naming, - javax.sql, - javax.xml, - javax.xml.bind.annotation, - javax.xml.stream, - javax.xml.parsers;resolution:=optional, - org.apache.commons.lang, + com.google.gson;version="[2.9,3)", + io.entgra.device.mgt.core.device.mgt.common;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.app.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.configuration.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.exceptions;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.general;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.invitation.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.license.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.metadata.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.policy.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.pull.notification;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.push.notification;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.spi;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.type.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.core.service;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.extensions.device.type.template, + io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config, + io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.dao, + io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.exception, + io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.feature, + io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.policy.mgt, + io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.pull.notification, + io.entgra.device.mgt.core.device.mgt.extensions.logger;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.extensions.spi, + javax.naming, + javax.sql, + javax.xml.bind;version="[0.0,1)", + javax.xml.bind.annotation;version="[0.0,1)", + javax.xml.namespace, + javax.xml.parsers;version="${javax.xml.parsers.import.pkg.version}", + javax.xml.stream;version="[1.0,2)", + org.apache.commons.lang;version="[2.6,3)", + org.apache.commons.logging;version="[1.2,2)", org.osgi.framework.*;version="${imp.package.version.osgi.framework}", org.osgi.service.*;version="${imp.package.version.osgi.service}", - org.w3c.dom, - org.wso2.carbon.ndatasource.core, - org.wso2.carbon.registry.core.service, - org.wso2.carbon.utils.dbcreator, - org.wso2.carbon.utils.multitenancy, - io.entgra.device.mgt.core.device.mgt.core.service, - com.google.gson + org.w3c.dom, + org.wso2.carbon.context;version="[4.8,5)", + org.wso2.carbon.governance.api.exception;version="[4.8,5)", + org.wso2.carbon.governance.api.generic;version="[4.8,5)", + org.wso2.carbon.governance.api.generic.dataobjects;version="[4.8,5)", + org.wso2.carbon.governance.api.util;version="[4.8,5)", + org.wso2.carbon.ndatasource.core;version="[4.8,5)", + org.wso2.carbon.registry.api;version="[1.0,2)", + org.wso2.carbon.registry.core;version="[1.0,2)", + org.wso2.carbon.registry.core.exceptions;version="[1.0,2)", + org.wso2.carbon.registry.core.service;version="[1.0,2)", + org.wso2.carbon.registry.core.session;version="[1.0,2)", + org.wso2.carbon.utils;version="[4.8,5)", + org.wso2.carbon.utils.dbcreator;version="[4.8,5)" io.entgra.device.mgt.core.device.mgt.extensions.pull.notification, io.entgra.device.mgt.core.device.mgt.extensions.pull.notification.* diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/DeviceTypeManager.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/DeviceTypeManager.java index 46ee29af59..23fa43739c 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/DeviceTypeManager.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/DeviceTypeManager.java @@ -17,28 +17,14 @@ */ package io.entgra.device.mgt.core.device.mgt.extensions.device.type.template; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.w3c.dom.Document; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.device.mgt.common.Device; -import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; -import io.entgra.device.mgt.core.device.mgt.common.DeviceManager; -import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; -import io.entgra.device.mgt.core.device.mgt.common.FeatureManager; +import io.entgra.device.mgt.core.device.mgt.common.*; import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.PlatformConfiguration; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.common.license.mgt.License; import io.entgra.device.mgt.core.device.mgt.common.license.mgt.LicenseManagementException; import io.entgra.device.mgt.core.device.mgt.common.license.mgt.LicenseManager; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.DataSource; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.DeviceDetails; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.DeviceTypeConfiguration; import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.Feature; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.Properties; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.Table; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.TableConfig; +import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.*; import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.dao.DeviceDAODefinition; import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.dao.DeviceTypePluginDAOManager; import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.exception.DeviceTypeDeployerPayloadException; @@ -49,6 +35,11 @@ import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.util import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.util.DeviceTypeUtils; import io.entgra.device.mgt.core.device.mgt.extensions.license.mgt.meta.data.MetaRepositoryBasedLicenseManager; import io.entgra.device.mgt.core.device.mgt.extensions.spi.DeviceTypePluginExtensionService; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.w3c.dom.Document; +import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.registry.api.RegistryException; import org.wso2.carbon.registry.api.Resource; import org.wso2.carbon.utils.CarbonUtils; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/DeviceTypeManagerService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/DeviceTypeManagerService.java index 049c5e6cdf..0eeab6f0f9 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/DeviceTypeManagerService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/DeviceTypeManagerService.java @@ -17,20 +17,13 @@ */ package io.entgra.device.mgt.core.device.mgt.extensions.device.type.template; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.CarbonContext; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; -import io.entgra.device.mgt.core.device.mgt.common.DeviceManager; -import io.entgra.device.mgt.core.device.mgt.common.DeviceStatusTaskPluginConfig; import io.entgra.device.mgt.core.device.mgt.common.InitialOperationConfig; -import io.entgra.device.mgt.core.device.mgt.common.MonitoringOperation; -import io.entgra.device.mgt.core.device.mgt.common.OperationMonitoringTaskConfig; import io.entgra.device.mgt.core.device.mgt.common.ProvisioningConfig; -import io.entgra.device.mgt.core.device.mgt.common.StartupOperationConfig; +import io.entgra.device.mgt.core.device.mgt.common.*; import io.entgra.device.mgt.core.device.mgt.common.app.mgt.ApplicationManager; import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.ConfigurationEntry; import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.PlatformConfiguration; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.common.general.GeneralConfig; import io.entgra.device.mgt.core.device.mgt.common.invitation.mgt.DeviceEnrollmentInvitationDetails; import io.entgra.device.mgt.core.device.mgt.common.license.mgt.License; @@ -39,17 +32,13 @@ import io.entgra.device.mgt.core.device.mgt.common.pull.notification.PullNotific import io.entgra.device.mgt.core.device.mgt.common.push.notification.PushNotificationConfig; import io.entgra.device.mgt.core.device.mgt.common.spi.DeviceManagementService; import io.entgra.device.mgt.core.device.mgt.common.type.mgt.DeviceTypePlatformDetails; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.ConfigProperties; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.DeviceStatusTaskConfiguration; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.DeviceTypeConfiguration; import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.Feature; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.PolicyMonitoring; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.Property; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.PullNotificationSubscriberConfig; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.PushNotificationProvider; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.TaskConfiguration; +import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.*; import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.policy.mgt.DefaultPolicyMonitoringManager; import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.pull.notification.PullNotificationSubscriberLoader; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.CarbonContext; import java.util.ArrayList; import java.util.HashMap; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/DeviceTypePluginExtensionServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/DeviceTypePluginExtensionServiceImpl.java index 1ca266b733..9fa52f5766 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/DeviceTypePluginExtensionServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/DeviceTypePluginExtensionServiceImpl.java @@ -17,11 +17,11 @@ */ package io.entgra.device.mgt.core.device.mgt.extensions.device.type.template; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.dao.DeviceTypePluginDAOManager; import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.exception.DeviceTypePluginExtensionException; import io.entgra.device.mgt.core.device.mgt.extensions.spi.DeviceTypePluginExtensionService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.util.HashMap; import java.util.Map; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/HTTPDeviceTypeManagerService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/HTTPDeviceTypeManagerService.java index e962ce45b9..1956962d08 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/HTTPDeviceTypeManagerService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/HTTPDeviceTypeManagerService.java @@ -17,22 +17,13 @@ */ package io.entgra.device.mgt.core.device.mgt.extensions.device.type.template; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.Feature; import io.entgra.device.mgt.core.device.mgt.common.InitialOperationConfig; import io.entgra.device.mgt.core.device.mgt.common.push.notification.PushNotificationConfig; import io.entgra.device.mgt.core.device.mgt.common.type.mgt.DeviceTypeDefinitionProvider; import io.entgra.device.mgt.core.device.mgt.common.type.mgt.DeviceTypeMetaDefinition; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.DeviceTypeConfiguration; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.DeviceDetails; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.Properties; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.Features; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.PolicyMonitoring; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.ProvisioningConfig; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.PushNotificationProvider; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.ConfigProperties; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.Property; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.PullNotificationSubscriberConfig; +import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.*; +import org.wso2.carbon.context.PrivilegedCarbonContext; import java.util.ArrayList; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/Attributes.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/Attributes.java index df6f362a32..6357d78862 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/Attributes.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/Attributes.java @@ -17,12 +17,12 @@ */ package io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config; -import java.util.ArrayList; -import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; +import java.util.ArrayList; +import java.util.List; /** diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/ConfigProperties.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/ConfigProperties.java index 3c2caa49d8..5d5768e40f 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/ConfigProperties.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/ConfigProperties.java @@ -17,12 +17,12 @@ */ package io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config; -import java.util.ArrayList; -import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; +import java.util.ArrayList; +import java.util.List; /** diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/DataPanel.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/DataPanel.java index 336300b7e6..43f99fba3a 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/DataPanel.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/DataPanel.java @@ -18,11 +18,7 @@ package io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.*; import java.util.List; /** diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/DeviceDetails.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/DeviceDetails.java index 00a999c806..97cb9ded15 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/DeviceDetails.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/DeviceDetails.java @@ -17,11 +17,7 @@ */ package io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.*; /** diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/DeviceTypeConfiguration.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/DeviceTypeConfiguration.java index cf94ccc235..58e0cd6021 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/DeviceTypeConfiguration.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/DeviceTypeConfiguration.java @@ -20,12 +20,7 @@ package io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.con import io.entgra.device.mgt.core.device.mgt.common.invitation.mgt.DeviceEnrollmentInvitationDetails; import io.entgra.device.mgt.core.device.mgt.common.type.mgt.DeviceTypePlatformDetails; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElementWrapper; -import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.*; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/Feature.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/Feature.java index 28e5e6ddfc..92797621fd 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/Feature.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/Feature.java @@ -18,12 +18,7 @@ package io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlElementWrapper; -import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.*; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/InitialOperationConfig.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/InitialOperationConfig.java index 3da81e3bdb..561a47ae90 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/InitialOperationConfig.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/InitialOperationConfig.java @@ -18,7 +18,9 @@ package io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config; -import javax.xml.bind.annotation.*; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlRootElement; import java.util.List; /** diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/Operation.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/Operation.java index ce57e7edd9..289b89e8a0 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/Operation.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/Operation.java @@ -18,11 +18,7 @@ package io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.*; /** diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/OperationMetadata.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/OperationMetadata.java index acaa065474..47900f3842 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/OperationMetadata.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/OperationMetadata.java @@ -18,11 +18,7 @@ package io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlElementWrapper; -import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.*; import java.util.List; /** diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/Option.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/Option.java index c8c44263d7..f02ae629ad 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/Option.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/Option.java @@ -18,7 +18,6 @@ package io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config; -import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; public class Option { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/OptionalData.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/OptionalData.java index fdaad227e3..7367f26e10 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/OptionalData.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/OptionalData.java @@ -17,7 +17,6 @@ */ package io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config; -import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/Policy.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/Policy.java index 73a8c03554..761f452f2e 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/Policy.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/Policy.java @@ -17,12 +17,7 @@ */ package io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlElementWrapper; -import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.*; import java.util.List; /** diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/PolicyMonitoring.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/PolicyMonitoring.java index d307813fc3..64800faf0f 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/PolicyMonitoring.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/PolicyMonitoring.java @@ -17,11 +17,7 @@ */ package io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; -import javax.xml.bind.annotation.XmlValue; +import javax.xml.bind.annotation.*; /** diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/Properties.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/Properties.java index eb2566bdc0..50dfafbd9c 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/Properties.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/Properties.java @@ -19,12 +19,12 @@ package io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config; -import java.util.ArrayList; -import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; +import java.util.ArrayList; +import java.util.List; /** diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/Property.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/Property.java index d8560e4a3c..3f606ac90b 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/Property.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/Property.java @@ -17,11 +17,7 @@ */ package io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlType; -import javax.xml.bind.annotation.XmlValue; +import javax.xml.bind.annotation.*; /** diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/PullNotificationSubscriberConfig.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/PullNotificationSubscriberConfig.java index 5658a7026c..7cd28253d6 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/PullNotificationSubscriberConfig.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/PullNotificationSubscriberConfig.java @@ -17,11 +17,7 @@ */ package io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.*; /** diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/PushNotificationProvider.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/PushNotificationProvider.java index 580ba18569..e4f2e944d7 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/PushNotificationProvider.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/PushNotificationProvider.java @@ -17,11 +17,7 @@ */ package io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.*; /** diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/Table.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/Table.java index 6ed1032510..de8a527faa 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/Table.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/Table.java @@ -17,11 +17,7 @@ */ package io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.*; /** diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/TableConfig.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/TableConfig.java index e24bc2e2a3..e048f4fc9b 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/TableConfig.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/TableConfig.java @@ -17,12 +17,12 @@ */ package io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config; -import java.util.ArrayList; -import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; +import java.util.ArrayList; +import java.util.List; /** diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/UIParameter.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/UIParameter.java index ee7ea78a24..a5978edda9 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/UIParameter.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/config/UIParameter.java @@ -18,11 +18,7 @@ package io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.*; import java.util.List; /** diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/dao/DeviceTypeDAOHandler.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/dao/DeviceTypeDAOHandler.java index 9d944a3025..5499a60595 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/dao/DeviceTypeDAOHandler.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/dao/DeviceTypeDAOHandler.java @@ -17,11 +17,11 @@ */ package io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.dao; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.exceptions.IllegalTransactionStateException; import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.exception.DeviceTypeDeployerPayloadException; import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.exception.DeviceTypeMgtPluginException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import javax.naming.Context; import javax.naming.InitialContext; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/dao/DeviceTypePluginDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/dao/DeviceTypePluginDAOImpl.java index f7de3a3911..3b3f9ef270 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/dao/DeviceTypePluginDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/dao/DeviceTypePluginDAOImpl.java @@ -18,18 +18,14 @@ package io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.dao; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.exception.DeviceTypeMgtPluginException; import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.util.DeviceTypeUtils; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; +import java.sql.*; import java.util.ArrayList; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/dao/DeviceTypePluginDAOManager.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/dao/DeviceTypePluginDAOManager.java index 19a0af1a4f..0b4a66c402 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/dao/DeviceTypePluginDAOManager.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/dao/DeviceTypePluginDAOManager.java @@ -18,8 +18,8 @@ package io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.dao; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.DeviceDetails; +import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.utils.multitenancy.MultitenantConstants; public class DeviceTypePluginDAOManager { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/dao/PropertyBasedPluginDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/dao/PropertyBasedPluginDAOImpl.java index 97516dd01e..2e01511746 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/dao/PropertyBasedPluginDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/dao/PropertyBasedPluginDAOImpl.java @@ -18,19 +18,15 @@ package io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.dao; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.DeviceDetails; import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.exception.DeviceTypeMgtPluginException; import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.util.DeviceTypeUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.PrivilegedCarbonContext; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.Statement; -import java.sql.SQLException; +import java.sql.*; import java.util.ArrayList; import java.util.HashMap; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/feature/ConfigurationBasedFeatureManager.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/feature/ConfigurationBasedFeatureManager.java index bcadc82954..4db0d7d108 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/feature/ConfigurationBasedFeatureManager.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/feature/ConfigurationBasedFeatureManager.java @@ -18,14 +18,14 @@ package io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.feature; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; -import org.apache.commons.lang.StringUtils; import io.entgra.device.mgt.core.device.mgt.common.Feature; import io.entgra.device.mgt.core.device.mgt.common.FeatureManager; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.Operation; import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.OperationMetadata; import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.Params; import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.UIParameter; +import org.apache.commons.lang.StringUtils; import java.util.ArrayList; import java.util.HashMap; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/policy/mgt/DefaultPolicyMonitoringManager.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/policy/mgt/DefaultPolicyMonitoringManager.java index d43b6e7001..5a399f6fcf 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/policy/mgt/DefaultPolicyMonitoringManager.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/policy/mgt/DefaultPolicyMonitoringManager.java @@ -17,13 +17,13 @@ */ package io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.policy.mgt; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Policy; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.PolicyMonitoringManager; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.ComplianceFeature; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.NonComplianceData; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.util.ArrayList; import java.util.List; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/util/DeviceTypeUtils.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/util/DeviceTypeUtils.java index 4a1cbeaa54..c10d1d083f 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/util/DeviceTypeUtils.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/util/DeviceTypeUtils.java @@ -18,14 +18,13 @@ package io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.util; +import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.exception.DeviceTypeMgtPluginException; +import io.entgra.device.mgt.core.device.mgt.extensions.internal.DeviceTypeExtensionDataHolder; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.w3c.dom.Document; import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.exception.DeviceTypeMgtPluginException; -import io.entgra.device.mgt.core.device.mgt.extensions.internal.DeviceTypeExtensionDataHolder; import org.wso2.carbon.registry.api.RegistryException; -import org.wso2.carbon.registry.api.RegistryService; import org.wso2.carbon.registry.api.Resource; import org.wso2.carbon.registry.core.Registry; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/internal/DeviceTypeExtensionDataHolder.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/internal/DeviceTypeExtensionDataHolder.java index 0b26765dfc..d0db293991 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/internal/DeviceTypeExtensionDataHolder.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/internal/DeviceTypeExtensionDataHolder.java @@ -17,9 +17,9 @@ */ package io.entgra.device.mgt.core.device.mgt.extensions.internal; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.MetadataManagementService; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; +import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.registry.core.service.RegistryService; /** diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/internal/DeviceTypeExtensionServiceComponent.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/internal/DeviceTypeExtensionServiceComponent.java index 222358d1cf..ebe088fd56 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/internal/DeviceTypeExtensionServiceComponent.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/internal/DeviceTypeExtensionServiceComponent.java @@ -18,33 +18,25 @@ package io.entgra.device.mgt.core.device.mgt.extensions.internal; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.osgi.service.component.ComponentContext; import io.entgra.device.mgt.core.device.mgt.common.spi.DeviceTypeGeneratorService; import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.DeviceTypeGeneratorServiceImpl; import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.DeviceTypePluginExtensionServiceImpl; import io.entgra.device.mgt.core.device.mgt.extensions.spi.DeviceTypePluginExtensionService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.*; import org.wso2.carbon.ndatasource.core.DataSourceService; import org.wso2.carbon.registry.core.service.RegistryService; -/** - * @scr.component name="io.entgra.device.mgt.core.device.mgt.extensions.DeviceTypeExtensionServiceComponent" - * immediate="true" - * @scr.reference name="registry.service" - * interface="org.wso2.carbon.registry.core.service.RegistryService" cardinality="0..1" - * policy="dynamic" bind="setRegistryService" unbind="unsetRegistryService" - * @scr.reference name="org.wso2.carbon.ndatasource" - * interface="org.wso2.carbon.ndatasource.core.DataSourceService" - * cardinality="1..1" - * policy="dynamic" - * bind="setDataSourceService" - * unbind="unsetDataSourceService" - */ +@Component( + name = "io.entgra.device.mgt.core.device.mgt.extensions.internal.DeviceTypeExtensionServiceComponent", + immediate = true) public class DeviceTypeExtensionServiceComponent { private static final Log log = LogFactory.getLog(DeviceTypeExtensionServiceComponent.class); + @Activate protected void activate(ComponentContext ctx) { try { if (log.isDebugEnabled()) { @@ -61,13 +53,19 @@ public class DeviceTypeExtensionServiceComponent { log.error("Error occurred while initializing device type extension component ", e); } } - + @Deactivate protected void deactivate(ComponentContext ctx) { if (log.isDebugEnabled()) { log.debug("De-activating DeviceType Deployer Service Component"); } } + @Reference( + name = "registry.service", + service = org.wso2.carbon.registry.core.service.RegistryService.class, + cardinality = ReferenceCardinality.OPTIONAL, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRegistryService") protected void setRegistryService(RegistryService registryService) { if (log.isDebugEnabled()) { log.debug("RegistryService acquired"); @@ -79,6 +77,12 @@ public class DeviceTypeExtensionServiceComponent { DeviceTypeExtensionDataHolder.getInstance().setRegistryService(null); } + @Reference( + name = "datasource.service", + service = org.wso2.carbon.ndatasource.core.DataSourceService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetDataSourceService") protected void setDataSourceService(DataSourceService dataSourceService) { /* This is to avoid device management component getting initialized before the underlying datasources are registered */ diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/license/mgt/meta/data/MetaRepositoryBasedLicenseManager.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/license/mgt/meta/data/MetaRepositoryBasedLicenseManager.java index 06e5b58461..d86c15c118 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/license/mgt/meta/data/MetaRepositoryBasedLicenseManager.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/license/mgt/meta/data/MetaRepositoryBasedLicenseManager.java @@ -19,10 +19,6 @@ package io.entgra.device.mgt.core.device.mgt.extensions.license.mgt.meta.data; import com.google.gson.Gson; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataKeyAlreadyExistsException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataManagementException; @@ -34,6 +30,10 @@ import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.MetadataManageme import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.util.DeviceTypePluginConstants; import io.entgra.device.mgt.core.device.mgt.extensions.internal.DeviceTypeExtensionDataHolder; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.PrivilegedCarbonContext; public class MetaRepositoryBasedLicenseManager implements LicenseManager { diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/license/mgt/registry/GenericArtifactManagerFactory.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/license/mgt/registry/GenericArtifactManagerFactory.java index 0065d89d8b..5201e1b169 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/license/mgt/registry/GenericArtifactManagerFactory.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/license/mgt/registry/GenericArtifactManagerFactory.java @@ -17,9 +17,9 @@ */ package io.entgra.device.mgt.core.device.mgt.extensions.license.mgt.registry; -import org.wso2.carbon.context.CarbonContext; import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; import io.entgra.device.mgt.core.device.mgt.common.license.mgt.LicenseManagementException; +import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.governance.api.generic.GenericArtifactManager; import org.wso2.carbon.governance.api.util.GovernanceUtils; import org.wso2.carbon.registry.api.Registry; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/license/mgt/registry/RegistryBasedLicenseManager.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/license/mgt/registry/RegistryBasedLicenseManager.java index df032f2818..57440bbdff 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/license/mgt/registry/RegistryBasedLicenseManager.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/extensions/license/mgt/registry/RegistryBasedLicenseManager.java @@ -18,14 +18,14 @@ package io.entgra.device.mgt.core.device.mgt.extensions.license.mgt.registry; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.CarbonContext; -import org.wso2.carbon.context.RegistryType; import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; import io.entgra.device.mgt.core.device.mgt.common.license.mgt.License; import io.entgra.device.mgt.core.device.mgt.common.license.mgt.LicenseManagementException; import io.entgra.device.mgt.core.device.mgt.common.license.mgt.LicenseManager; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.CarbonContext; +import org.wso2.carbon.context.RegistryType; import org.wso2.carbon.governance.api.exception.GovernanceException; import org.wso2.carbon.governance.api.generic.GenericArtifactFilter; import org.wso2.carbon.governance.api.generic.GenericArtifactManager; @@ -33,7 +33,6 @@ import org.wso2.carbon.governance.api.generic.dataobjects.GenericArtifact; import org.wso2.carbon.registry.api.Registry; import javax.xml.namespace.QName; -import java.lang.String; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/BaseExtensionsTest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/BaseExtensionsTest.java index aff8d17eda..adf8ade71c 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/BaseExtensionsTest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/BaseExtensionsTest.java @@ -18,20 +18,7 @@ package io.entgra.device.mgt.core.device.mgt.extensions.device.type.template; -import org.apache.tomcat.jdbc.pool.PoolProperties; -import org.mockito.Mockito; -import org.testng.annotations.BeforeSuite; -import org.testng.annotations.Optional; -import org.testng.annotations.Parameters; -import org.w3c.dom.Document; -import org.wso2.carbon.CarbonConstants; -import org.wso2.carbon.base.MultitenantConstants; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.context.RegistryType; -import org.wso2.carbon.context.internal.OSGiDataHolder; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; -import io.entgra.device.mgt.core.device.mgt.common.license.mgt.License; -import io.entgra.device.mgt.core.device.mgt.common.spi.DeviceManagementService; import io.entgra.device.mgt.core.device.mgt.core.dao.DeviceManagementDAOFactory; import io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.MetadataManagementServiceImpl; import io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.dao.MetadataManagementDAOFactory; @@ -40,9 +27,18 @@ import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProvide import io.entgra.device.mgt.core.device.mgt.core.util.DeviceManagerUtil; import io.entgra.device.mgt.core.device.mgt.extensions.common.DataSourceConfig; import io.entgra.device.mgt.core.device.mgt.extensions.internal.DeviceTypeExtensionDataHolder; -import io.entgra.device.mgt.core.device.mgt.extensions.license.mgt.meta.data.MetaRepositoryBasedLicenseManager; import io.entgra.device.mgt.core.device.mgt.extensions.mock.TypeXDeviceManagementService; import io.entgra.device.mgt.core.device.mgt.extensions.utils.Utils; +import org.apache.tomcat.jdbc.pool.PoolProperties; +import org.testng.annotations.BeforeSuite; +import org.testng.annotations.Optional; +import org.testng.annotations.Parameters; +import org.w3c.dom.Document; +import org.wso2.carbon.CarbonConstants; +import org.wso2.carbon.base.MultitenantConstants; +import org.wso2.carbon.context.PrivilegedCarbonContext; +import org.wso2.carbon.context.RegistryType; +import org.wso2.carbon.context.internal.OSGiDataHolder; import org.wso2.carbon.governance.api.util.GovernanceArtifactConfiguration; import org.wso2.carbon.governance.api.util.GovernanceUtils; import org.wso2.carbon.registry.core.Registry; @@ -61,7 +57,6 @@ import java.sql.Statement; import java.util.ArrayList; import java.util.List; -import static org.mockito.Matchers.anyString; import static org.wso2.carbon.governance.api.util.GovernanceUtils.getGovernanceArtifactConfiguration; /** diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/DeviceTypeManagerNegativeTest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/DeviceTypeManagerNegativeTest.java index 6c239cef50..74b1cc1d44 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/DeviceTypeManagerNegativeTest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/DeviceTypeManagerNegativeTest.java @@ -18,11 +18,6 @@ package io.entgra.device.mgt.core.device.mgt.extensions.device.type.template; -import org.h2.jdbcx.JdbcDataSource; -import org.mockito.Mockito; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; -import org.wso2.carbon.base.MultitenantConstants; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; @@ -32,14 +27,15 @@ import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.conf import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.DeviceTypeConfiguration; import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.Properties; import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.exception.DeviceTypeConfigurationException; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.dao.DeviceDAODefinition; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.dao.DeviceTypeDAOHandler; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.dao.DeviceTypePluginDAOImpl; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.dao.DeviceTypePluginDAOManager; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.dao.PropertyBasedPluginDAOImpl; +import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.dao.*; import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.exception.DeviceTypeDeployerPayloadException; import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.exception.DeviceTypeMgtPluginException; import io.entgra.device.mgt.core.device.mgt.extensions.utils.Utils; +import org.h2.jdbcx.JdbcDataSource; +import org.mockito.Mockito; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; +import org.wso2.carbon.base.MultitenantConstants; import org.xml.sax.SAXException; import javax.xml.bind.JAXBException; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/DeviceTypeManagerServiceTest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/DeviceTypeManagerServiceTest.java index eb59f2e2fb..dcf3dd26bd 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/DeviceTypeManagerServiceTest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/DeviceTypeManagerServiceTest.java @@ -18,29 +18,24 @@ package io.entgra.device.mgt.core.device.mgt.extensions.device.type.template; -import org.mockito.Mockito; -import org.testng.Assert; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; -import org.wso2.carbon.base.MultitenantConstants; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.common.DeviceStatusTaskPluginConfig; import io.entgra.device.mgt.core.device.mgt.common.InitialOperationConfig; import io.entgra.device.mgt.core.device.mgt.common.OperationMonitoringTaskConfig; import io.entgra.device.mgt.core.device.mgt.common.ProvisioningConfig; import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.ConfigurationEntry; import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.PlatformConfiguration; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.common.license.mgt.License; import io.entgra.device.mgt.core.device.mgt.common.license.mgt.LicenseManagementException; import io.entgra.device.mgt.core.device.mgt.common.push.notification.PushNotificationConfig; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.DeviceStatusTaskConfiguration; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.DeviceTypeConfiguration; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.PolicyMonitoring; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.PullNotificationSubscriberConfig; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.PushNotificationProvider; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.TaskConfiguration; +import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.*; import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.exception.DeviceTypeConfigurationException; import io.entgra.device.mgt.core.device.mgt.extensions.utils.Utils; +import org.mockito.Mockito; +import org.testng.Assert; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; +import org.wso2.carbon.base.MultitenantConstants; import org.wso2.carbon.registry.core.exceptions.RegistryException; import org.xml.sax.SAXException; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/DeviceTypeManagerTest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/DeviceTypeManagerTest.java index 7b3d624180..395cd1c7d8 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/DeviceTypeManagerTest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/DeviceTypeManagerTest.java @@ -18,25 +18,20 @@ package io.entgra.device.mgt.core.device.mgt.extensions.device.type.template; -import org.mockito.Mockito; -import org.testng.Assert; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.PlatformConfiguration; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.DeviceDetails; import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.DeviceTypeConfiguration; import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.Properties; import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.exception.DeviceTypeConfigurationException; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.dao.DeviceDAODefinition; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.dao.DeviceTypeDAOHandler; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.dao.DeviceTypePluginDAOImpl; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.dao.DeviceTypePluginDAOManager; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.dao.PluginDAO; -import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.dao.PropertyBasedPluginDAOImpl; +import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.dao.*; import io.entgra.device.mgt.core.device.mgt.extensions.utils.Utils; +import org.mockito.Mockito; +import org.testng.Assert; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; import org.wso2.carbon.registry.core.exceptions.RegistryException; import org.xml.sax.SAXException; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/HttpDeviceTypeManagerServiceAndDeviceTypeGeneratorServceTest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/HttpDeviceTypeManagerServiceAndDeviceTypeGeneratorServceTest.java index 9a6a8b44ac..1fd84a5e14 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/HttpDeviceTypeManagerServiceAndDeviceTypeGeneratorServceTest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/HttpDeviceTypeManagerServiceAndDeviceTypeGeneratorServceTest.java @@ -18,14 +18,11 @@ package io.entgra.device.mgt.core.device.mgt.extensions.device.type.template; -import org.testng.Assert; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.ConfigurationEntry; import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.PlatformConfiguration; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.common.license.mgt.License; import io.entgra.device.mgt.core.device.mgt.common.push.notification.PushNotificationConfig; import io.entgra.device.mgt.core.device.mgt.common.spi.DeviceManagementService; @@ -35,6 +32,9 @@ import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.conf import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.PushNotificationProvider; import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.exception.DeviceTypeConfigurationException; import io.entgra.device.mgt.core.device.mgt.extensions.utils.Utils; +import org.testng.Assert; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; import org.wso2.carbon.registry.core.exceptions.RegistryException; import org.xml.sax.SAXException; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/dao/DeviceDAODefinitionNegativeTest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/dao/DeviceDAODefinitionNegativeTest.java index 2666233222..20e14e7102 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/dao/DeviceDAODefinitionNegativeTest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/device/type/template/dao/DeviceDAODefinitionNegativeTest.java @@ -18,9 +18,9 @@ package io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.dao; -import org.testng.annotations.Test; import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.Table; import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.exception.DeviceTypeDeployerPayloadException; +import org.testng.annotations.Test; /** * This class tests the negative scenarios related with {@link DeviceDAODefinition} diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/mock/TypeXDeviceManagementService.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/mock/TypeXDeviceManagementService.java index fd61ec4cdc..37ca202dfa 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/mock/TypeXDeviceManagementService.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/mock/TypeXDeviceManagementService.java @@ -17,15 +17,9 @@ */ package io.entgra.device.mgt.core.device.mgt.extensions.mock; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; -import io.entgra.device.mgt.core.device.mgt.common.DeviceManager; -import io.entgra.device.mgt.core.device.mgt.common.DeviceStatusTaskPluginConfig; -import io.entgra.device.mgt.core.device.mgt.common.InitialOperationConfig; -import io.entgra.device.mgt.core.device.mgt.common.MonitoringOperation; -import io.entgra.device.mgt.core.device.mgt.common.OperationMonitoringTaskConfig; -import io.entgra.device.mgt.core.device.mgt.common.ProvisioningConfig; -import io.entgra.device.mgt.core.device.mgt.common.StartupOperationConfig; +import io.entgra.device.mgt.core.device.mgt.common.*; import io.entgra.device.mgt.core.device.mgt.common.app.mgt.ApplicationManager; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.common.general.GeneralConfig; import io.entgra.device.mgt.core.device.mgt.common.invitation.mgt.DeviceEnrollmentInvitationDetails; import io.entgra.device.mgt.core.device.mgt.common.license.mgt.License; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/mock/TypeXDeviceManager.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/mock/TypeXDeviceManager.java index fc8afc602e..341daa1d3d 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/mock/TypeXDeviceManager.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/mock/TypeXDeviceManager.java @@ -17,11 +17,7 @@ */ package io.entgra.device.mgt.core.device.mgt.extensions.mock; -import io.entgra.device.mgt.core.device.mgt.common.Device; -import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; -import io.entgra.device.mgt.core.device.mgt.common.DeviceManager; -import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; -import io.entgra.device.mgt.core.device.mgt.common.FeatureManager; +import io.entgra.device.mgt.core.device.mgt.common.*; import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.PlatformConfiguration; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.common.license.mgt.License; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/utils/Utils.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/utils/Utils.java index 9676b6bfb5..4a38a1a4c0 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/utils/Utils.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/utils/Utils.java @@ -18,14 +18,14 @@ package io.entgra.device.mgt.core.device.mgt.extensions.utils; -import org.h2.jdbcx.JdbcDataSource; -import org.w3c.dom.Document; import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHolder; import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.DeviceDetails; import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.DeviceTypeConfiguration; import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.Table; import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.config.exception.DeviceTypeConfigurationException; import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.dao.DeviceDAODefinition; +import org.h2.jdbcx.JdbcDataSource; +import org.w3c.dom.Document; import org.wso2.carbon.registry.core.config.RegistryContext; import org.wso2.carbon.registry.core.exceptions.RegistryException; import org.wso2.carbon.registry.core.internal.RegistryDataHolder; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/utils/UtilsTest.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/utils/UtilsTest.java index 29d752316a..862b73cb9c 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/utils/UtilsTest.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions/src/test/java/io/entgra/device/mgt/core/device/mgt/extensions/utils/UtilsTest.java @@ -18,11 +18,6 @@ package io.entgra.device.mgt.core.device.mgt.extensions.utils; -import org.testng.Assert; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; -import org.wso2.carbon.base.MultitenantConstants; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.license.mgt.License; import io.entgra.device.mgt.core.device.mgt.common.license.mgt.LicenseManagementException; @@ -37,6 +32,11 @@ import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.util import io.entgra.device.mgt.core.device.mgt.extensions.device.type.template.util.DeviceTypeUtils; import io.entgra.device.mgt.core.device.mgt.extensions.license.mgt.file.FileSystemBasedLicenseManager; import io.entgra.device.mgt.core.device.mgt.extensions.license.mgt.registry.RegistryBasedLicenseManager; +import org.testng.Assert; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; +import org.wso2.carbon.base.MultitenantConstants; +import org.wso2.carbon.context.PrivilegedCarbonContext; import java.io.File; import java.lang.reflect.InvocationTargetException; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/pom.xml b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/pom.xml index d034a53cf8..57ff12e288 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/pom.xml +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/pom.xml @@ -32,17 +32,17 @@ bundle WSO2 Carbon - Device Management url printer WSO2 Carbon - Device Management url printer - http://wso2.org + https://entgra.io - - org.apache.felix - maven-scr-plugin - org.apache.maven.plugins maven-compiler-plugin + + 1.8 + 1.8 + org.apache.felix @@ -56,12 +56,12 @@ IoT Server Impl Bundle io.entgra.device.mgt.core.device.mgt.url.printer.internal + org.apache.axis2.context;version="[1.6,2)", + org.apache.commons.logging;version="[1.2,2)", org.osgi.framework.*;version="${imp.package.version.osgi.framework}", org.osgi.service.*;version="${imp.package.version.osgi.service}", - org.apache.commons.logging, - org.apache.axis2.*;version="${axis2.osgi.version.range}", - org.wso2.carbon.core, - org.wso2.carbon.utils.*, + org.wso2.carbon.core;version="[4.8,5)", + org.wso2.carbon.utils;version="[4.8,5)" !io.entgra.device.mgt.core.device.mgt.url.printer.internal, @@ -101,12 +101,9 @@ - org.eclipse.osgi - org.eclipse.osgi - - - org.eclipse.osgi - org.eclipse.osgi.services + org.apache.felix + org.apache.felix.scr.ds-annotations + provided org.wso2.carbon @@ -116,7 +113,6 @@ org.ops4j.pax.logging pax-logging-api provided - org.wso2.carbon diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/src/main/java/io/entgra/device/mgt/core/device/mgt/url/printer/URLPrinterStartupHandler.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/src/main/java/io/entgra/device/mgt/core/device/mgt/url/printer/URLPrinterStartupHandler.java index 85ced7b90e..bab23693fd 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/src/main/java/io/entgra/device/mgt/core/device/mgt/url/printer/URLPrinterStartupHandler.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/src/main/java/io/entgra/device/mgt/core/device/mgt/url/printer/URLPrinterStartupHandler.java @@ -18,10 +18,10 @@ package io.entgra.device.mgt.core.device.mgt.url.printer; +import io.entgra.device.mgt.core.device.mgt.url.printer.internal.UrlPrinterDataHolder; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.core.ServerStartupObserver; -import io.entgra.device.mgt.core.device.mgt.url.printer.internal.UrlPrinterDataHolder; import org.wso2.carbon.utils.CarbonUtils; import org.wso2.carbon.utils.ConfigurationContextService; import org.wso2.carbon.utils.NetworkUtils; diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/src/main/java/io/entgra/device/mgt/core/device/mgt/url/printer/internal/UrlPrinterServiceComponent.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/src/main/java/io/entgra/device/mgt/core/device/mgt/url/printer/internal/UrlPrinterServiceComponent.java index b346b2cc5a..3f301fc4aa 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/src/main/java/io/entgra/device/mgt/core/device/mgt/url/printer/internal/UrlPrinterServiceComponent.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.url.printer/src/main/java/io/entgra/device/mgt/core/device/mgt/url/printer/internal/UrlPrinterServiceComponent.java @@ -18,28 +18,23 @@ package io.entgra.device.mgt.core.device.mgt.url.printer.internal; +import io.entgra.device.mgt.core.device.mgt.url.printer.URLPrinterStartupHandler; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.framework.BundleContext; import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.*; import org.wso2.carbon.core.ServerStartupObserver; -import io.entgra.device.mgt.core.device.mgt.url.printer.URLPrinterStartupHandler; import org.wso2.carbon.utils.ConfigurationContextService; -/** - * @scr.component name="UrlPrinterServiceComponent" - * immediate="true" - * @scr.reference name="config.context.service" - * interface="org.wso2.carbon.utils.ConfigurationContextService" - * cardinality="0..1" - * policy="dynamic" - * bind="setConfigurationContextService" - * unbind="unsetConfigurationContextService" - */ +@Component( + name = "io.entgra.device.mgt.core.device.mgt.url.printer.internal.UrlPrinterServiceComponent", + immediate = true) public class UrlPrinterServiceComponent { private static final Log log = LogFactory.getLog(UrlPrinterServiceComponent.class); + @Activate protected void activate(ComponentContext ctx) { if (log.isDebugEnabled()) { log.debug("Activating Url printer Service Component"); @@ -54,13 +49,19 @@ public class UrlPrinterServiceComponent { log.error("Error occurred while activating Url printer Service Component", e); } } - + @Deactivate protected void deactivate(ComponentContext ctx) { if (log.isDebugEnabled()) { log.debug("De-activating Url printer Service Component"); } } + @Reference( + name = "configuration.context.service", + service = org.wso2.carbon.utils.ConfigurationContextService.class, + cardinality = ReferenceCardinality.OPTIONAL, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetConfigurationContextService") protected void setConfigurationContextService(ConfigurationContextService configurationContextService) { if (log.isDebugEnabled()) { log.debug("Setting ConfigurationContextService"); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/pom.xml index 802b301231..ce7fb6b507 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/pom.xml @@ -31,7 +31,7 @@ bundle WSO2 Carbon - Device Analytics WSO2 Carbon - Device Analytics - http://wso2.org + https://entgra.io diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.wsproxy/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.wsproxy/pom.xml index 2ede4c663c..c6411d46ce 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.wsproxy/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.wsproxy/pom.xml @@ -27,7 +27,7 @@ org.wso2.carbon.device.mgt.analytics.wsproxy war WSO2 - Webapp for Web Socket Proxy - http://wso2.org + https://entgra.io diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml index 5cb1195826..94a0662265 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/pom.xml @@ -31,7 +31,7 @@ pom WSO2 Carbon - Device Management Base UI WSO2 Carbon - Device Management Base UI - http://wso2.org + https://entgra.io diff --git a/components/device-mgt/pom.xml b/components/device-mgt/pom.xml index ea3547e7d3..cb1c9dba67 100644 --- a/components/device-mgt/pom.xml +++ b/components/device-mgt/pom.xml @@ -30,7 +30,7 @@ device-mgt pom WSO2 Carbon - Device Management Component - http://wso2.org + https://entgra.io io.entgra.device.mgt.core.device.mgt.core diff --git a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml index 0f646276cb..9971311788 100644 --- a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml +++ b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/pom.xml @@ -36,8 +36,12 @@ - org.apache.felix - maven-scr-plugin + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + org.apache.felix @@ -51,20 +55,28 @@ Server Startup Heart Beat Beacon Bundle io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.internal - org.apache.axis2.*;version="${axis2.osgi.version.range}", - org.apache.axiom.*; version="${axiom.osgi.version.range}", + io.entgra.device.mgt.core.device.mgt.common;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.exceptions;version="[5.0,6)", + io.entgra.device.mgt.core.server.bootup.heartbeat.beacon, + io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.config, + io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.config.datasource, + io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.dao, + io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.dao.exception, + io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.dao.impl, + io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.dao.util, + io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.dto, + io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.exception, + javax.naming, + javax.sql, + javax.xml.bind;version="[0.0,1)", + javax.xml.bind.annotation;version="[0.0,1)", + javax.xml.parsers, + org.apache.commons.logging;version="[1.2,2)", org.osgi.framework.*;version="${imp.package.version.osgi.framework}", org.osgi.service.*;version="${imp.package.version.osgi.service}", - org.apache.commons.logging, - javax.xml.parsers;version="${javax.xml.parsers.import.pkg.version}";resolution:=optional, - org.wso2.carbon.context, - org.wso2.carbon.utils.*, - org.wso2.carbon.ndatasource.core, org.w3c.dom, - org.apache.commons.io, - org.apache.axis2.transport.mail, - org.apache.commons.collections, - io.entgra.device.mgt.core.device.mgt.common.* + org.wso2.carbon.ndatasource.core;version="[4.8,5)", + org.wso2.carbon.utils;version="[4.8,5)" !io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.internal, @@ -73,55 +85,14 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.eclipse.osgi - org.eclipse.osgi - - - org.eclipse.osgi - org.eclipse.osgi.services + org.apache.felix + org.apache.felix.scr.ds-annotations + provided org.ops4j.pax.logging diff --git a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/HeartBeatBeaconUtils.java b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/HeartBeatBeaconUtils.java index 42964b448d..0fccadc29e 100644 --- a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/HeartBeatBeaconUtils.java +++ b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/HeartBeatBeaconUtils.java @@ -29,12 +29,7 @@ import javax.sql.DataSource; import javax.xml.XMLConstants; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; +import java.io.*; import java.net.InetAddress; import java.net.SocketException; import java.net.UnknownHostException; diff --git a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/config/datasource/JNDILookupDefinition.java b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/config/datasource/JNDILookupDefinition.java index c32b51fb02..1c0ae05af7 100644 --- a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/config/datasource/JNDILookupDefinition.java +++ b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/config/datasource/JNDILookupDefinition.java @@ -18,11 +18,7 @@ package io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.config.datasource; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlElementWrapper; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlValue; +import javax.xml.bind.annotation.*; import java.util.List; /** diff --git a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/dao/HeartBeatBeaconDAOFactory.java b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/dao/HeartBeatBeaconDAOFactory.java index 7130f07cbf..91ff56e949 100644 --- a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/dao/HeartBeatBeaconDAOFactory.java +++ b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/dao/HeartBeatBeaconDAOFactory.java @@ -18,16 +18,14 @@ package io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.dao; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.IllegalTransactionStateException; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.TransactionManagementException; import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.HeartBeatBeaconUtils; import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.config.datasource.DataSourceConfig; import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.config.datasource.JNDILookupDefinition; import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.dao.impl.GenericHeartBeatDAOImpl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.IllegalTransactionStateException; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.TransactionManagementException; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.UnsupportedDatabaseEngineException; import javax.sql.DataSource; import java.sql.Connection; diff --git a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/dao/impl/GenericHeartBeatDAOImpl.java b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/dao/impl/GenericHeartBeatDAOImpl.java index 1706535a6b..fce8bdc688 100644 --- a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/dao/impl/GenericHeartBeatDAOImpl.java +++ b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/dao/impl/GenericHeartBeatDAOImpl.java @@ -28,12 +28,7 @@ import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.dto.ServerContex import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.sql.Timestamp; +import java.sql.*; import java.util.HashMap; import java.util.List; import java.util.Map; diff --git a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/internal/HeartBeatBeaconComponent.java b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/internal/HeartBeatBeaconComponent.java index c7e874c3f5..b170ffde5d 100644 --- a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/internal/HeartBeatBeaconComponent.java +++ b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/internal/HeartBeatBeaconComponent.java @@ -27,23 +27,18 @@ import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service.HeartBea import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.*; import org.wso2.carbon.ndatasource.core.DataSourceService; -/** - * @scr.component name="io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.heartbeatBeaconComponent" - * immediate="true" - * @scr.reference name="org.wso2.carbon.ndatasource" - * interface="org.wso2.carbon.ndatasource.core.DataSourceService" - * cardinality="1..1" - * policy="dynamic" - * bind="setDataSourceService" - * unbind="unsetDataSourceService" - */ +@Component( + name = "io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.internal.HeartBeatBeaconComponent", + immediate = true) public class HeartBeatBeaconComponent { private static Log log = LogFactory.getLog(HeartBeatBeaconComponent.class); @SuppressWarnings("unused") + @Activate protected void activate(ComponentContext componentContext) { try { if (log.isDebugEnabled()) { @@ -71,6 +66,7 @@ public class HeartBeatBeaconComponent { } @SuppressWarnings("unused") + @Deactivate protected void deactivate(ComponentContext componentContext) { //do nothing } @@ -84,6 +80,12 @@ public class HeartBeatBeaconComponent { componentContext.getBundleContext().registerService(HeartBeatManagementService.class, heartBeatServiceProvider, null); } + @Reference( + name = "datasource.service", + service = org.wso2.carbon.ndatasource.core.DataSourceService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetDataSourceService") protected void setDataSourceService(DataSourceService dataSourceService) { /* This is to avoid mobile device management component getting initialized before the underlying datasources are registered */ diff --git a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/HeartBeatManagementService.java b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/HeartBeatManagementService.java index 50a42d5d59..14ae7d2648 100644 --- a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/HeartBeatManagementService.java +++ b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/HeartBeatManagementService.java @@ -18,10 +18,10 @@ package io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service; +import io.entgra.device.mgt.core.device.mgt.common.ServerCtxInfo; import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.dto.HeartBeatEvent; import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.dto.ServerContext; import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.exception.HeartBeatManagementException; -import io.entgra.device.mgt.core.device.mgt.common.ServerCtxInfo; import java.util.Map; diff --git a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/HeartBeatManagementServiceImpl.java b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/HeartBeatManagementServiceImpl.java index f39eda3c78..7c9b39f4ca 100644 --- a/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/HeartBeatManagementServiceImpl.java +++ b/components/heartbeat-management/io.entgra.device.mgt.core.server.bootup.heartbeat.beacon/src/main/java/io/entgra/device/mgt/core/server/bootup/heartbeat/beacon/service/HeartBeatManagementServiceImpl.java @@ -18,6 +18,8 @@ package io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service; +import io.entgra.device.mgt.core.device.mgt.common.ServerCtxInfo; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.TransactionManagementException; import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.config.HeartBeatBeaconConfig; import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.dao.HeartBeatBeaconDAOFactory; import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.dao.HeartBeatDAO; @@ -29,17 +31,10 @@ import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.exception.HeartB import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.internal.HeartBeatBeaconDataHolder; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.device.mgt.common.ServerCtxInfo; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.TransactionManagementException; import java.sql.SQLException; import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.Set; +import java.util.*; import java.util.concurrent.TimeUnit; public class HeartBeatManagementServiceImpl implements HeartBeatManagementService { diff --git a/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/pom.xml b/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/pom.xml index a3809e3528..fa60f27f1e 100644 --- a/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/pom.xml +++ b/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/pom.xml @@ -30,9 +30,14 @@ io.entgra.device.mgt.core.device.mgt.oauth.extensions bundle WSO2 Carbon - OAuth Extensions - http://wso2.org + https://entgra.io + + org.apache.felix + org.apache.felix.scr.ds-annotations + provided + commons-codec.wso2 commons-codec @@ -62,8 +67,12 @@ - org.apache.felix - maven-scr-plugin + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + org.apache.felix @@ -81,32 +90,41 @@ io.entgra.device.mgt.core.device.mgt.oauth.extensions.* - org.wso2.carbon.identity.oauth2.grant.jwt;version="${carbon.identity.jwt.grant.version.range}", - org.apache.commons.lang, - org.apache.commons.logging, - org.osgi.service.component, - org.wso2.carbon.identity.application.common.model;version="${carbon.identity.framework.version.range}", - org.wso2.carbon.identity.application.common;version="${carbon.identity.framework.version.range}", - org.wso2.carbon.identity.application.mgt.*;version="${carbon.identity.framework.version.range}", - org.wso2.carbon.user.api, - org.wso2.carbon.user.core.service, - org.wso2.carbon.user.core.tenant, - org.wso2.carbon.user.core.util, - org.json.simple, - javax.cache, - org.wso2.carbon.identity.core.util;version="${carbon.identity.framework.version.range}", - org.wso2.carbon.utils, - org.wso2.carbon.context, - org.wso2.carbon.identity.oauth.*;version="${carbon.identity.framework.version.range}", - - org.wso2.carbon.base, - org.wso2.carbon.identity.application.authentication.framework.model;version="${carbon.identity.framework.version.range}", - org.wso2.carbon.identity.base;version="${carbon.identity.framework.version.range}", - org.wso2.carbon.identity.oauth2.*;version="${carbon.identity.framework.version.range}", - org.wso2.carbon.utils.multitenancy, - org.apache.oltu.oauth2.common.validators, - org.apache.commons.lang3.tuple, + io.entgra.device.mgt.core.device.mgt.oauth.extensions.handlers.grant.oauth.validator, + io.entgra.device.mgt.core.device.mgt.oauth.extensions.handlers.grant.oauth.validator.internal, + javax.servlet.http;version="[2.6,3)", + org.apache.commons.lang;version="[2.6,3)", + org.apache.commons.lang3.tuple;version="[3.1,4)", + org.apache.commons.logging;version="[1.2,2)", + org.apache.oltu.oauth2.common.validators;version="[1.0,2)", + org.osgi.service.*;version="${imp.package.version.osgi.service}", + org.wso2.carbon.context;version="[4.8,5)", + org.wso2.carbon.identity.application.authentication.framework.model;version="[5.24,6)", + org.wso2.carbon.identity.application.common;version="[5.24,6)", + org.wso2.carbon.identity.application.common.model;version="[5.24,6)", + org.wso2.carbon.identity.application.mgt;version="[5.24,6)", + org.wso2.carbon.identity.core.util;version="[5.24,6)", + org.wso2.carbon.identity.oauth.cache;version="[6.9,7)", + org.wso2.carbon.identity.oauth2;version="[6.9,7)", + org.wso2.carbon.identity.oauth2.dao;version="[6.9,7)", + org.wso2.carbon.identity.oauth2.dto;version="[6.9,7)", + org.wso2.carbon.identity.oauth2.grant.jwt;version="[2.1,3)", + org.wso2.carbon.identity.oauth2.internal;version="[6.9,7)", + org.wso2.carbon.identity.oauth2.model;version="[6.9,7)", + org.wso2.carbon.identity.oauth2.token;version="[6.9,7)", + org.wso2.carbon.identity.oauth2.token.handlers.grant;version="[6.9,7)", + org.wso2.carbon.identity.oauth2.token.handlers.grant.saml;version="[6.9,7)", + org.wso2.carbon.identity.oauth2.util;version="[6.9,7)", + org.wso2.carbon.identity.oauth2.validators;version="[6.9,7)", + org.wso2.carbon.user.api;version="[1.0,2)", + org.wso2.carbon.user.core.service;version="[4.8,5)", + org.wso2.carbon.user.core.tenant;version="[4.8,5)", + org.wso2.carbon.user.core.util;version="[4.8,5)", + org.wso2.carbon.utils.multitenancy;version="[4.8,5)" + + oltu;scope=compile|runtime;inline=false + diff --git a/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/oauth/extensions/handlers/ScopeValidationHandler.java b/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/oauth/extensions/handlers/ScopeValidationHandler.java index 895a6593a2..cb97fc7319 100644 --- a/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/oauth/extensions/handlers/ScopeValidationHandler.java +++ b/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/oauth/extensions/handlers/ScopeValidationHandler.java @@ -17,10 +17,10 @@ */ package io.entgra.device.mgt.core.device.mgt.oauth.extensions.handlers; +import io.entgra.device.mgt.core.device.mgt.oauth.extensions.internal.OAuthExtensionsDataHolder; import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.device.mgt.oauth.extensions.internal.OAuthExtensionsDataHolder; import org.wso2.carbon.identity.oauth.cache.CacheEntry; import org.wso2.carbon.identity.oauth.cache.OAuthCache; import org.wso2.carbon.identity.oauth.cache.OAuthCacheKey; diff --git a/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/oauth/extensions/handlers/grant/AccessTokenGrantHandler.java b/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/oauth/extensions/handlers/grant/AccessTokenGrantHandler.java index d4c0d3bb5d..c3fd491e4e 100644 --- a/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/oauth/extensions/handlers/grant/AccessTokenGrantHandler.java +++ b/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/oauth/extensions/handlers/grant/AccessTokenGrantHandler.java @@ -18,11 +18,11 @@ package io.entgra.device.mgt.core.device.mgt.oauth.extensions.handlers.grant; +import io.entgra.device.mgt.core.device.mgt.oauth.extensions.handlers.grant.oauth.validator.LocalOAuthValidator; +import io.entgra.device.mgt.core.device.mgt.oauth.extensions.handlers.grant.oauth.validator.OAuthValidationResponse; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.device.mgt.oauth.extensions.handlers.grant.oauth.validator.LocalOAuthValidator; -import io.entgra.device.mgt.core.device.mgt.oauth.extensions.handlers.grant.oauth.validator.OAuthValidationResponse; import org.wso2.carbon.identity.application.authentication.framework.model.AuthenticatedUser; import org.wso2.carbon.identity.application.common.IdentityApplicationManagementException; import org.wso2.carbon.identity.application.common.model.ServiceProvider; @@ -35,6 +35,7 @@ import org.wso2.carbon.identity.oauth2.token.handlers.grant.AbstractAuthorizatio import org.wso2.carbon.identity.oauth2.util.OAuth2Util; import org.wso2.carbon.user.core.util.UserCoreUtil; import org.wso2.carbon.utils.multitenancy.MultitenantUtils; + import java.rmi.RemoteException; /** diff --git a/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/oauth/extensions/handlers/grant/oauth/validator/internal/OAuthAuthenticatorServiceComponent.java b/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/oauth/extensions/handlers/grant/oauth/validator/internal/OAuthAuthenticatorServiceComponent.java index cbe5510bcb..64c020f743 100755 --- a/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/oauth/extensions/handlers/grant/oauth/validator/internal/OAuthAuthenticatorServiceComponent.java +++ b/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/oauth/extensions/handlers/grant/oauth/validator/internal/OAuthAuthenticatorServiceComponent.java @@ -21,22 +21,18 @@ package io.entgra.device.mgt.core.device.mgt.oauth.extensions.handlers.grant.oau import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.*; import org.wso2.carbon.identity.oauth2.OAuth2TokenValidationService; -/** - * @scr.component name="io.entgra.device.mgt.core.device.mgt.oauth.extensions.authenticator" immediate="true" - * @scr.reference name="identity.oauth2.validation.service" - * interface="org.wso2.carbon.identity.oauth2.OAuth2TokenValidationService" - * cardinality="1..1" - * policy="dynamic" - * bind="setOAuth2ValidationService" - * unbind="unsetOAuth2ValidationService" - */ +@Component( + name = "io.entgra.device.mgt.core.device.mgt.oauth.extensions.handlers.grant.oauth.validator.internal.OAuthAuthenticatorServiceComponent", + immediate = true) public class OAuthAuthenticatorServiceComponent { private static final Log log = LogFactory.getLog(OAuthAuthenticatorServiceComponent.class); @SuppressWarnings("unused") + @Activate protected void activate(ComponentContext componentContext) { if (log.isDebugEnabled()) { log.debug("Starting Backend OAuthAuthenticator Framework Bundle"); @@ -44,6 +40,7 @@ public class OAuthAuthenticatorServiceComponent { } @SuppressWarnings("unused") + @Deactivate protected void deactivate(ComponentContext componentContext) { //do nothing } @@ -54,6 +51,12 @@ public class OAuthAuthenticatorServiceComponent { * @param tokenValidationService An instance of OAuth2TokenValidationService. */ @SuppressWarnings("unused") + @Reference( + name = "oauth2.token.validation.service", + service = org.wso2.carbon.identity.oauth2.OAuth2TokenValidationService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetOAuth2ValidationService") protected void setOAuth2ValidationService(OAuth2TokenValidationService tokenValidationService) { if (log.isDebugEnabled()) { log.debug("Setting OAuth2TokenValidationService Service"); diff --git a/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/oauth/extensions/internal/OAuthExtensionServiceComponent.java b/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/oauth/extensions/internal/OAuthExtensionServiceComponent.java index 4308da4d39..6de407711e 100644 --- a/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/oauth/extensions/internal/OAuthExtensionServiceComponent.java +++ b/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/oauth/extensions/internal/OAuthExtensionServiceComponent.java @@ -22,33 +22,15 @@ import io.entgra.device.mgt.core.device.mgt.oauth.extensions.validators.Extended import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.service.component.ComponentContext; - +import org.osgi.service.component.annotations.*; import org.wso2.carbon.identity.oauth2.OAuth2TokenValidationService; import org.wso2.carbon.identity.oauth2.validators.JDBCScopeValidator; import org.wso2.carbon.identity.oauth2.validators.OAuth2ScopeValidator; import org.wso2.carbon.user.core.service.RealmService; -/** - * @scr.component name="io.entgra.device.mgt.core.device.mgt.oauth.extensions" immediate="true" - * @scr.reference name="user.realmservice.default" - * interface="org.wso2.carbon.user.core.service.RealmService" - * cardinality="1..1" - * policy="dynamic" - * bind="setRealmService" - * unbind="unsetRealmService" - * @scr.reference name="identity.oauth2.validation.service" - * interface="org.wso2.carbon.identity.oauth2.OAuth2TokenValidationService" - * cardinality="1..1" - * policy="dynamic" - * bind="setOAuth2ValidationService" - * unbind="unsetOAuth2ValidationService" - * * @scr.reference name="scope.validator.service" - * interface="org.wso2.carbon.identity.oauth2.validators.OAuth2ScopeValidator" - * cardinality="0..n" - * policy="dynamic" - * bind="addScopeValidator" - * unbind="removeScopeValidator" - */ +@Component( + name = "io.entgra.device.mgt.core.device.mgt.oauth.extensions.internal.OAuthExtensionServiceComponent", + immediate = true) public class OAuthExtensionServiceComponent { private static final Log log = LogFactory.getLog(OAuthExtensionServiceComponent.class); @@ -60,6 +42,7 @@ public class OAuthExtensionServiceComponent { @SuppressWarnings("unused") + @Activate protected void activate(ComponentContext componentContext) { if (log.isDebugEnabled()) { log.debug("Starting OAuthExtensionBundle"); @@ -75,6 +58,7 @@ public class OAuthExtensionServiceComponent { } @SuppressWarnings("unused") + @Deactivate protected void deactivate(ComponentContext componentContext) { if (log.isDebugEnabled()) { log.debug("Stopping OAuthExtensionBundle"); @@ -86,6 +70,12 @@ public class OAuthExtensionServiceComponent { * * @param realmService An instance of RealmService */ + @Reference( + name = "realm.service", + service = org.wso2.carbon.user.core.service.RealmService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRealmService") protected void setRealmService(RealmService realmService) { if (log.isDebugEnabled()) { log.debug("Setting Realm Service"); @@ -110,6 +100,12 @@ public class OAuthExtensionServiceComponent { * * @param tokenValidationService An instance of OAuth2TokenValidationService */ + @Reference( + name = "oauth2.token.validation.service", + service = org.wso2.carbon.identity.oauth2.OAuth2TokenValidationService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetOAuth2ValidationService") protected void setOAuth2ValidationService(OAuth2TokenValidationService tokenValidationService) { if (log.isDebugEnabled()) { log.debug("Setting OAuth2TokenValidation Service"); @@ -133,6 +129,12 @@ public class OAuthExtensionServiceComponent { * Add scope validator to the map. * @param scopesValidator */ + @Reference( + name = "oauth2.scope.validator", + service = org.wso2.carbon.identity.oauth2.validators.OAuth2ScopeValidator.class, + cardinality = ReferenceCardinality.MULTIPLE, + policy = ReferencePolicy.DYNAMIC, + unbind = "removeScopeValidator") protected void addScopeValidator(OAuth2ScopeValidator scopesValidator) { OAuthExtensionsDataHolder.getInstance().addScopeValidator(scopesValidator, DEFAULT_PREFIX); } diff --git a/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/oauth/extensions/validators/ExtendedJDBCScopeValidator.java b/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/oauth/extensions/validators/ExtendedJDBCScopeValidator.java index 46aa1ea8cb..75fbccbf7f 100644 --- a/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/oauth/extensions/validators/ExtendedJDBCScopeValidator.java +++ b/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/oauth/extensions/validators/ExtendedJDBCScopeValidator.java @@ -18,11 +18,11 @@ package io.entgra.device.mgt.core.device.mgt.oauth.extensions.validators; +import io.entgra.device.mgt.core.device.mgt.oauth.extensions.internal.OAuthExtensionsDataHolder; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.base.MultitenantConstants; import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.device.mgt.oauth.extensions.internal.OAuthExtensionsDataHolder; import org.wso2.carbon.identity.application.common.model.User; import org.wso2.carbon.identity.core.util.IdentityTenantUtil; import org.wso2.carbon.identity.oauth.cache.CacheEntry; diff --git a/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/oauth/extensions/validators/PermissionBasedScopeValidator.java b/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/oauth/extensions/validators/PermissionBasedScopeValidator.java index d768110ce1..97defd2e2d 100644 --- a/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/oauth/extensions/validators/PermissionBasedScopeValidator.java +++ b/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/oauth/extensions/validators/PermissionBasedScopeValidator.java @@ -18,11 +18,11 @@ package io.entgra.device.mgt.core.device.mgt.oauth.extensions.validators; +import io.entgra.device.mgt.core.device.mgt.oauth.extensions.internal.OAuthExtensionsDataHolder; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.base.MultitenantConstants; import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.device.mgt.oauth.extensions.internal.OAuthExtensionsDataHolder; import org.wso2.carbon.identity.application.common.model.User; import org.wso2.carbon.identity.core.util.IdentityTenantUtil; import org.wso2.carbon.identity.oauth2.IdentityOAuth2Exception; diff --git a/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/oauth/extensions/validators/RoleBasedScopeValidator.java b/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/oauth/extensions/validators/RoleBasedScopeValidator.java index db33b266a1..94a126e085 100644 --- a/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/oauth/extensions/validators/RoleBasedScopeValidator.java +++ b/components/identity-extensions/io.entgra.device.mgt.core.device.mgt.oauth.extensions/src/main/java/io/entgra/device/mgt/core/device/mgt/oauth/extensions/validators/RoleBasedScopeValidator.java @@ -18,11 +18,11 @@ package io.entgra.device.mgt.core.device.mgt.oauth.extensions.validators; +import io.entgra.device.mgt.core.device.mgt.oauth.extensions.internal.OAuthExtensionsDataHolder; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.base.MultitenantConstants; import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.device.mgt.oauth.extensions.internal.OAuthExtensionsDataHolder; import org.wso2.carbon.identity.application.common.model.User; import org.wso2.carbon.identity.base.IdentityConstants; import org.wso2.carbon.identity.core.util.IdentityTenantUtil; diff --git a/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml b/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml index 27184693a7..8b646fa964 100644 --- a/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml +++ b/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/pom.xml @@ -31,9 +31,14 @@ bundle WSO2 Carbon - Device Management JWT Client Extensions WSO2 Carbon - Device Management JWT Client Extensions - http://wso2.org + https://entgra.io + + org.apache.felix + org.apache.felix.scr.ds-annotations + provided + org.wso2.carbon.governance org.wso2.carbon.governance.api @@ -55,17 +60,9 @@ org.wso2.carbon.utils - org.wso2.orbit.org.scannotation + io.entgra.org.scannotation scannotation - - org.eclipse.osgi - org.eclipse.osgi - - - org.eclipse.osgi - org.eclipse.osgi.services - org.wso2.tomcat tomcat @@ -124,7 +121,6 @@ org.ops4j.pax.logging pax-logging-api provided - org.testng @@ -171,8 +167,12 @@ - org.apache.felix - maven-scr-plugin + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + org.apache.felix @@ -190,35 +190,35 @@ io.entgra.device.mgt.core.identity.jwt.client.extension.* + com.nimbusds.jose;version="[7.9,8)", + com.nimbusds.jose.crypto;version="[7.9,8)", + com.nimbusds.jwt;version="[7.9,8)", + io.entgra.device.mgt.core.identity.jwt.client.extension, + io.entgra.device.mgt.core.identity.jwt.client.extension.dto, + io.entgra.device.mgt.core.identity.jwt.client.extension.exception, + io.entgra.device.mgt.core.identity.jwt.client.extension.service, + javax.net.ssl, + org.apache.commons.codec.binary;version="[1.4,2)", + org.apache.commons.logging;version="[1.2,2)", + org.apache.http;version="[4.4,5)", + org.apache.http.client;version="[4.3,5)", + org.apache.http.client.entity;version="[4.3,5)", + org.apache.http.client.methods;version="[4.3,5)", + org.apache.http.conn.socket;version="[4.3,5)", + org.apache.http.conn.ssl;version="[4.3,5)", + org.apache.http.impl.client;version="[4.3,5)", + org.apache.http.message;version="[4.4,5)", + org.apache.http.util;version="[4.4,5)", + org.json.simple;version="[1.1,2)", + org.json.simple.parser;version="[1.1,2)", org.osgi.framework.*;version="${imp.package.version.osgi.framework}", org.osgi.service.*;version="${imp.package.version.osgi.service}", - org.wso2.carbon.context, - org.wso2.carbon.registry.core, - org.wso2.carbon.registry.core.exceptions, - org.wso2.carbon.registry.core.session, - org.wso2.carbon.utils, - org.apache.commons.logging, - org.wso2.carbon.registry.core.*;resolution:=optional, - org.wso2.carbon.registry.indexing.*; version="${carbon.registry.imp.pkg.version.range}", - com.nimbusds.jwt.*;version="${nimbus.orbit.version.range}", - com.nimbusds.jose.*;version="${nimbus.orbit.version.range}", - javax.net.ssl, - org.apache.commons.codec.binary;version="${commons-codec.wso2.osgi.version.range}", - org.apache.http;version="${httpclient.version.range}", - org.apache.http.client;version="${httpclient.version.range}", - org.apache.http.message;version="${httpclient.version.range}", - org.apache.http.client;version="${httpclient.version.range}", - org.apache.http.conn.*;version="${httpclient.version.range}", - org.apache.http.util;version="${httpclient.version.range}", - org.apache.http.client.entity;version="${httpclient.version.range}", - org.apache.http.client.methods;version="${httpclient.version.range}", - org.apache.http.impl.client;version="${httpclient.version.range}", - org.json.simple.*, - org.wso2.carbon.core.util, - javax.net.ssl, - org.wso2.carbon.user.core.service, - org.wso2.carbon.user.core.tenant, - org.wso2.carbon.base + org.wso2.carbon.context;version="${carbon.platform.package.import.version.range}", + org.wso2.carbon.core.*; version="${carbon.platform.package.import.version.range}", + org.wso2.carbon.registry.core.*; version="${carbon.registry.imp.pkg.version}", + org.wso2.carbon.registry.indexing.*;version="${carbon.registry.package.import.version.range}", + org.wso2.carbon.user.core.*;version="${carbon.platform.package.import.version.range}", + org.wso2.carbon.utils.*; version="${carbon.platform.package.import.version.range}" @@ -263,5 +263,4 @@ - diff --git a/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/src/main/java/io/entgra/device/mgt/core/identity/jwt/client/extension/JWTClient.java b/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/src/main/java/io/entgra/device/mgt/core/identity/jwt/client/extension/JWTClient.java index 7bd07850a2..a2ae303414 100644 --- a/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/src/main/java/io/entgra/device/mgt/core/identity/jwt/client/extension/JWTClient.java +++ b/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/src/main/java/io/entgra/device/mgt/core/identity/jwt/client/extension/JWTClient.java @@ -18,6 +18,11 @@ package io.entgra.device.mgt.core.identity.jwt.client.extension; +import io.entgra.device.mgt.core.identity.jwt.client.extension.constant.JWTConstants; +import io.entgra.device.mgt.core.identity.jwt.client.extension.dto.AccessTokenInfo; +import io.entgra.device.mgt.core.identity.jwt.client.extension.dto.JWTConfig; +import io.entgra.device.mgt.core.identity.jwt.client.extension.exception.JWTClientException; +import io.entgra.device.mgt.core.identity.jwt.client.extension.util.JWTClientUtil; import org.apache.commons.codec.binary.Base64; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -30,11 +35,6 @@ import org.apache.http.message.BasicNameValuePair; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; -import io.entgra.device.mgt.core.identity.jwt.client.extension.constant.JWTConstants; -import io.entgra.device.mgt.core.identity.jwt.client.extension.dto.AccessTokenInfo; -import io.entgra.device.mgt.core.identity.jwt.client.extension.dto.JWTConfig; -import io.entgra.device.mgt.core.identity.jwt.client.extension.exception.JWTClientException; -import io.entgra.device.mgt.core.identity.jwt.client.extension.util.JWTClientUtil; import java.io.IOException; import java.net.MalformedURLException; diff --git a/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/src/main/java/io/entgra/device/mgt/core/identity/jwt/client/extension/dto/JWTConfig.java b/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/src/main/java/io/entgra/device/mgt/core/identity/jwt/client/extension/dto/JWTConfig.java index 609f3f3275..274a10c37a 100644 --- a/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/src/main/java/io/entgra/device/mgt/core/identity/jwt/client/extension/dto/JWTConfig.java +++ b/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/src/main/java/io/entgra/device/mgt/core/identity/jwt/client/extension/dto/JWTConfig.java @@ -18,8 +18,8 @@ package io.entgra.device.mgt.core.identity.jwt.client.extension.dto; -import org.wso2.carbon.core.util.Utils; import io.entgra.device.mgt.core.identity.jwt.client.extension.constant.JWTConstants; +import org.wso2.carbon.core.util.Utils; import java.util.ArrayList; import java.util.List; diff --git a/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/src/main/java/io/entgra/device/mgt/core/identity/jwt/client/extension/internal/JWTClientExtensionServiceComponent.java b/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/src/main/java/io/entgra/device/mgt/core/identity/jwt/client/extension/internal/JWTClientExtensionServiceComponent.java index 8b7fdd9f81..04b5215264 100644 --- a/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/src/main/java/io/entgra/device/mgt/core/identity/jwt/client/extension/internal/JWTClientExtensionServiceComponent.java +++ b/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/src/main/java/io/entgra/device/mgt/core/identity/jwt/client/extension/internal/JWTClientExtensionServiceComponent.java @@ -17,53 +17,32 @@ */ package io.entgra.device.mgt.core.identity.jwt.client.extension.internal; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.osgi.framework.BundleContext; -import org.osgi.service.component.ComponentContext; import io.entgra.device.mgt.core.identity.jwt.client.extension.exception.JWTClientConfigurationException; import io.entgra.device.mgt.core.identity.jwt.client.extension.service.JWTClientManagerService; import io.entgra.device.mgt.core.identity.jwt.client.extension.service.JWTClientManagerServiceImpl; import io.entgra.device.mgt.core.identity.jwt.client.extension.util.JWTClientUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.osgi.framework.BundleContext; +import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.*; import org.wso2.carbon.registry.core.exceptions.RegistryException; import org.wso2.carbon.registry.core.service.RegistryService; import org.wso2.carbon.registry.core.service.TenantRegistryLoader; import org.wso2.carbon.registry.indexing.service.TenantIndexingLoader; import org.wso2.carbon.user.core.service.RealmService; + import java.io.IOException; -/** - * @scr.component name="io.entgra.device.mgt.core.identity.jwt.client.extension.internal.JWTClientExtensionServiceComponent" - * immediate="true" - * @scr.reference name="registry.service" - * interface="org.wso2.carbon.registry.core.service.RegistryService" - * cardinality="1..1" - * policy="dynamic" - * bind="setRegistryService" - * unbind="unsetRegistryService" - * @scr.reference name="tenant.registryloader" - * interface="org.wso2.carbon.registry.core.service.TenantRegistryLoader" - * cardinality="1..1" - * policy="dynamic" - * bind="setTenantRegistryLoader" - * unbind="unsetTenantRegistryLoader" - * @scr.reference name="tenant.indexloader" - * interface="org.wso2.carbon.registry.indexing.service.TenantIndexingLoader" - * cardinality="1..1" - * policy="dynamic" - * bind="setIndexLoader" - * unbind="unsetIndexLoader" - * @scr.reference name="realm.service" - * interface="org.wso2.carbon.user.core.service.RealmService" - * cardinality="1..1" - * policy="dynamic" - * bind="setRealmService" - * unbind="unsetRealmService" - */ +@Component( + name = "io.entgra.device.mgt.core.identity.jwt.client.extension.internal.JWTClientExtensionServiceComponent", + immediate = true) public class JWTClientExtensionServiceComponent { private static Log log = LogFactory.getLog(JWTClientExtensionServiceComponent.class); + // private ServiceRegistration serviceRegistration = null; + @Activate protected void activate(ComponentContext componentContext) { if (log.isDebugEnabled()) { log.debug("Initializing jwt extension bundle"); @@ -82,10 +61,19 @@ public class JWTClientExtensionServiceComponent { } } + @Deactivate protected void deactivate(ComponentContext componentContext) { - //do nothing + if (log.isDebugEnabled()) { + log.info("deactivating jwt extension bundle"); + } } + @Reference( + name = "registry.service", + service = org.wso2.carbon.registry.core.service.RegistryService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRegistryService") protected void setRegistryService(RegistryService registryService) { if (registryService != null && log.isDebugEnabled()) { log.debug("Registry service initialized"); @@ -97,6 +85,12 @@ public class JWTClientExtensionServiceComponent { JWTClientExtensionDataHolder.getInstance().setRegistryService(null); } + @Reference( + name = "tenant.registry.loader", + service = org.wso2.carbon.registry.core.service.TenantRegistryLoader.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetTenantRegistryLoader") protected void setTenantRegistryLoader(TenantRegistryLoader tenantRegistryLoader) { JWTClientExtensionDataHolder.getInstance().setTenantRegistryLoader(tenantRegistryLoader); } @@ -105,6 +99,12 @@ public class JWTClientExtensionServiceComponent { JWTClientExtensionDataHolder.getInstance().setTenantRegistryLoader(null); } + @Reference( + name = "tenant.index.loader", + service = org.wso2.carbon.registry.indexing.service.TenantIndexingLoader.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetIndexLoader") protected void setIndexLoader(TenantIndexingLoader indexLoader) { if (indexLoader != null && log.isDebugEnabled()) { log.debug("IndexLoader service initialized"); @@ -121,6 +121,12 @@ public class JWTClientExtensionServiceComponent { * * @param realmService An instance of RealmService */ + @Reference( + name = "realm.service", + service = org.wso2.carbon.user.core.service.RealmService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRealmService") protected void setRealmService(RealmService realmService) { if (log.isDebugEnabled()) { log.debug("Setting Realm Service"); diff --git a/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/src/main/java/io/entgra/device/mgt/core/identity/jwt/client/extension/service/JWTClientManagerServiceImpl.java b/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/src/main/java/io/entgra/device/mgt/core/identity/jwt/client/extension/service/JWTClientManagerServiceImpl.java index c36de4377e..cc926bc7de 100644 --- a/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/src/main/java/io/entgra/device/mgt/core/identity/jwt/client/extension/service/JWTClientManagerServiceImpl.java +++ b/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/src/main/java/io/entgra/device/mgt/core/identity/jwt/client/extension/service/JWTClientManagerServiceImpl.java @@ -18,11 +18,6 @@ package io.entgra.device.mgt.core.identity.jwt.client.extension.service; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.base.MultitenantConstants; -import org.wso2.carbon.context.CarbonContext; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.identity.jwt.client.extension.JWTClient; import io.entgra.device.mgt.core.identity.jwt.client.extension.constant.JWTConstants; import io.entgra.device.mgt.core.identity.jwt.client.extension.dto.JWTConfig; @@ -30,6 +25,11 @@ import io.entgra.device.mgt.core.identity.jwt.client.extension.exception.JWTClie import io.entgra.device.mgt.core.identity.jwt.client.extension.exception.JWTClientConfigurationException; import io.entgra.device.mgt.core.identity.jwt.client.extension.exception.JWTClientException; import io.entgra.device.mgt.core.identity.jwt.client.extension.util.JWTClientUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.base.MultitenantConstants; +import org.wso2.carbon.context.CarbonContext; +import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.registry.core.Resource; import org.wso2.carbon.registry.core.exceptions.RegistryException; diff --git a/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/src/main/java/io/entgra/device/mgt/core/identity/jwt/client/extension/util/JWTClientUtil.java b/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/src/main/java/io/entgra/device/mgt/core/identity/jwt/client/extension/util/JWTClientUtil.java index 4e43a38722..b223a98a66 100644 --- a/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/src/main/java/io/entgra/device/mgt/core/identity/jwt/client/extension/util/JWTClientUtil.java +++ b/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/src/main/java/io/entgra/device/mgt/core/identity/jwt/client/extension/util/JWTClientUtil.java @@ -24,6 +24,11 @@ import com.nimbusds.jose.JWSSigner; import com.nimbusds.jose.crypto.RSASSASigner; import com.nimbusds.jwt.JWTClaimsSet; import com.nimbusds.jwt.SignedJWT; +import io.entgra.device.mgt.core.identity.jwt.client.extension.dto.JWTConfig; +import io.entgra.device.mgt.core.identity.jwt.client.extension.exception.JWTClientConfigurationException; +import io.entgra.device.mgt.core.identity.jwt.client.extension.exception.JWTClientException; +import io.entgra.device.mgt.core.identity.jwt.client.extension.internal.JWTClientExtensionDataHolder; +import io.entgra.device.mgt.core.identity.jwt.client.extension.service.JWTClientManagerService; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.HttpResponse; @@ -36,11 +41,6 @@ import org.apache.http.util.EntityUtils; import org.wso2.carbon.base.MultitenantConstants; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.core.util.KeyStoreManager; -import io.entgra.device.mgt.core.identity.jwt.client.extension.dto.JWTConfig; -import io.entgra.device.mgt.core.identity.jwt.client.extension.exception.JWTClientConfigurationException; -import io.entgra.device.mgt.core.identity.jwt.client.extension.exception.JWTClientException; -import io.entgra.device.mgt.core.identity.jwt.client.extension.internal.JWTClientExtensionDataHolder; -import io.entgra.device.mgt.core.identity.jwt.client.extension.service.JWTClientManagerService; import org.wso2.carbon.registry.core.Registry; import org.wso2.carbon.registry.core.Resource; import org.wso2.carbon.registry.core.exceptions.RegistryException; @@ -48,19 +48,10 @@ import org.wso2.carbon.registry.core.service.RegistryService; import org.wso2.carbon.registry.core.service.TenantRegistryLoader; import org.wso2.carbon.utils.CarbonUtils; -import java.io.BufferedReader; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; +import java.io.*; import java.net.URI; import java.net.URL; -import java.security.KeyManagementException; -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.SecureRandom; -import java.security.UnrecoverableKeyException; +import java.security.*; import java.security.cert.CertificateException; import java.security.interfaces.RSAPrivateKey; import java.util.Date; diff --git a/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/src/test/java/io/entgra/device/mgt/core/identity/jwt/client/extension/service/JWTClientManagerServiceTest.java b/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/src/test/java/io/entgra/device/mgt/core/identity/jwt/client/extension/service/JWTClientManagerServiceTest.java index a3d05da022..183241b85a 100644 --- a/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/src/test/java/io/entgra/device/mgt/core/identity/jwt/client/extension/service/JWTClientManagerServiceTest.java +++ b/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/src/test/java/io/entgra/device/mgt/core/identity/jwt/client/extension/service/JWTClientManagerServiceTest.java @@ -17,14 +17,14 @@ */ package io.entgra.device.mgt.core.identity.jwt.client.extension.service; +import io.entgra.device.mgt.core.identity.jwt.client.extension.exception.JWTClientConfigurationException; +import io.entgra.device.mgt.core.identity.jwt.client.extension.exception.JWTClientException; +import io.entgra.device.mgt.core.identity.jwt.client.extension.service.common.BaseJWTClientManagerExtTest; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.testng.Assert; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; -import io.entgra.device.mgt.core.identity.jwt.client.extension.exception.JWTClientConfigurationException; -import io.entgra.device.mgt.core.identity.jwt.client.extension.exception.JWTClientException; -import io.entgra.device.mgt.core.identity.jwt.client.extension.service.common.BaseJWTClientManagerExtTest; import java.util.Properties; diff --git a/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/src/test/java/io/entgra/device/mgt/core/identity/jwt/client/extension/service/JWTClientTest.java b/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/src/test/java/io/entgra/device/mgt/core/identity/jwt/client/extension/service/JWTClientTest.java index 6244bb7aed..d497d5e108 100644 --- a/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/src/test/java/io/entgra/device/mgt/core/identity/jwt/client/extension/service/JWTClientTest.java +++ b/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/src/test/java/io/entgra/device/mgt/core/identity/jwt/client/extension/service/JWTClientTest.java @@ -17,6 +17,11 @@ */ package io.entgra.device.mgt.core.identity.jwt.client.extension.service; +import io.entgra.device.mgt.core.identity.jwt.client.extension.JWTClient; +import io.entgra.device.mgt.core.identity.jwt.client.extension.dto.AccessTokenInfo; +import io.entgra.device.mgt.core.identity.jwt.client.extension.dto.JWTConfig; +import io.entgra.device.mgt.core.identity.jwt.client.extension.exception.JWTClientException; +import io.entgra.device.mgt.core.identity.jwt.client.extension.util.JWTClientUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.HttpResponse; @@ -30,11 +35,6 @@ import org.testng.IObjectFactory; import org.testng.annotations.BeforeClass; import org.testng.annotations.ObjectFactory; import org.testng.annotations.Test; -import io.entgra.device.mgt.core.identity.jwt.client.extension.JWTClient; -import io.entgra.device.mgt.core.identity.jwt.client.extension.dto.AccessTokenInfo; -import io.entgra.device.mgt.core.identity.jwt.client.extension.dto.JWTConfig; -import io.entgra.device.mgt.core.identity.jwt.client.extension.exception.JWTClientException; -import io.entgra.device.mgt.core.identity.jwt.client.extension.util.JWTClientUtil; import java.io.IOException; import java.security.KeyManagementException; diff --git a/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/src/test/java/io/entgra/device/mgt/core/identity/jwt/client/extension/service/JWTClientUtilTest.java b/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/src/test/java/io/entgra/device/mgt/core/identity/jwt/client/extension/service/JWTClientUtilTest.java index 0223602fa2..587e9204b0 100644 --- a/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/src/test/java/io/entgra/device/mgt/core/identity/jwt/client/extension/service/JWTClientUtilTest.java +++ b/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/src/test/java/io/entgra/device/mgt/core/identity/jwt/client/extension/service/JWTClientUtilTest.java @@ -17,6 +17,9 @@ */ package io.entgra.device.mgt.core.identity.jwt.client.extension.service; +import io.entgra.device.mgt.core.identity.jwt.client.extension.dto.JWTConfig; +import io.entgra.device.mgt.core.identity.jwt.client.extension.exception.JWTClientException; +import io.entgra.device.mgt.core.identity.jwt.client.extension.util.JWTClientUtil; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.HttpVersion; @@ -29,9 +32,6 @@ import org.testng.annotations.BeforeClass; import org.testng.annotations.ObjectFactory; import org.testng.annotations.Test; import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.identity.jwt.client.extension.dto.JWTConfig; -import io.entgra.device.mgt.core.identity.jwt.client.extension.exception.JWTClientException; -import io.entgra.device.mgt.core.identity.jwt.client.extension.util.JWTClientUtil; import org.wso2.carbon.registry.core.exceptions.RegistryException; import java.io.ByteArrayInputStream; diff --git a/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/src/test/java/io/entgra/device/mgt/core/identity/jwt/client/extension/service/common/BaseJWTClientManagerExtTest.java b/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/src/test/java/io/entgra/device/mgt/core/identity/jwt/client/extension/service/common/BaseJWTClientManagerExtTest.java index 78d9893f4b..3c8682c4a9 100644 --- a/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/src/test/java/io/entgra/device/mgt/core/identity/jwt/client/extension/service/common/BaseJWTClientManagerExtTest.java +++ b/components/identity-extensions/io.entgra.device.mgt.core.identity.jwt.client.extension/src/test/java/io/entgra/device/mgt/core/identity/jwt/client/extension/service/common/BaseJWTClientManagerExtTest.java @@ -17,13 +17,13 @@ */ package io.entgra.device.mgt.core.identity.jwt.client.extension.service.common; +import io.entgra.device.mgt.core.identity.jwt.client.extension.internal.JWTClientExtensionDataHolder; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeSuite; import org.wso2.carbon.base.MultitenantConstants; import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.identity.jwt.client.extension.internal.JWTClientExtensionDataHolder; import org.wso2.carbon.registry.core.config.RegistryContext; import org.wso2.carbon.registry.core.exceptions.RegistryException; import org.wso2.carbon.registry.core.internal.RegistryDataHolder; diff --git a/components/identity-extensions/pom.xml b/components/identity-extensions/pom.xml index 55ebda39ae..216bfb4d71 100644 --- a/components/identity-extensions/pom.xml +++ b/components/identity-extensions/pom.xml @@ -30,7 +30,7 @@ identity-extensions pom WSO2 Carbon - Identity Extensions Component - http://wso2.org + https://entgra.io io.entgra.device.mgt.core.device.mgt.oauth.extensions diff --git a/components/logger/io.entgra.device.mgt.core.notification.logger/pom.xml b/components/logger/io.entgra.device.mgt.core.notification.logger/pom.xml index b9d382dd80..324934a4dd 100644 --- a/components/logger/io.entgra.device.mgt.core.notification.logger/pom.xml +++ b/components/logger/io.entgra.device.mgt.core.notification.logger/pom.xml @@ -49,9 +49,9 @@ - 8 - 8 - UTF-8 + + + @@ -59,6 +59,11 @@ org.apache.maven.plugins maven-compiler-plugin + + + 1.8 + 1.8 + org.apache.felix @@ -71,10 +76,12 @@ ${io.entgra.device.mgt.core.version} Device Notification Logger Bundle - io.entgra.device.mgt.core.device.mgt.extensions.logger.*, - org.apache.commons.logging;version="[1.2,2)", - org.apache.log4j;version="[1.2,2)", - org.wso2.carbon.context;version="[4.4,5) + io.entgra.device.mgt.core.device.mgt.extensions.logger;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.extensions.logger.spi;version="[5.0,6)", + io.entgra.device.mgt.core.notification.logger, + io.entgra.device.mgt.core.notification.logger.util, + org.apache.commons.logging;version="[1.2,2)" + io.entgra.device.mgt.core.notification.logger.* diff --git a/components/logger/pom.xml b/components/logger/pom.xml index 5a98271148..cb85a7f88c 100644 --- a/components/logger/pom.xml +++ b/components/logger/pom.xml @@ -36,8 +36,6 @@ - 8 - 8 UTF-8 diff --git a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml index 5c8a1c3911..c71669f41e 100644 --- a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml +++ b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/pom.xml @@ -37,10 +37,10 @@ org.apache.maven.plugins maven-compiler-plugin - - - org.apache.felix - maven-scr-plugin + + 1.8 + 1.8 + org.apache.felix @@ -54,32 +54,33 @@ IOT Operation Template Bundle io.entgra.device.mgt.core.operation.template.internal + com.google.common.cache;version="[31.0,32)", + com.google.gson;version="[2.9,3)", + io.entgra.device.mgt.core.device.mgt.common.exceptions;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.core.service;version="[5.0,6)", + io.entgra.device.mgt.core.operation.template.cache, + io.entgra.device.mgt.core.operation.template.dao, + io.entgra.device.mgt.core.operation.template.dao.impl, + io.entgra.device.mgt.core.operation.template.dao.impl.config, + io.entgra.device.mgt.core.operation.template.dao.impl.config.datasource, + io.entgra.device.mgt.core.operation.template.dao.impl.util, + io.entgra.device.mgt.core.operation.template.dto, + io.entgra.device.mgt.core.operation.template.exception, + io.entgra.device.mgt.core.operation.template.impl, + io.entgra.device.mgt.core.operation.template.spi, + io.entgra.device.mgt.core.operation.template.util, + javax.naming, + javax.sql, + javax.xml.bind;version="[2.3,3)", + javax.xml.bind.annotation;version="[2.3,3)", + javax.xml.parsers;version="${javax.xml.parsers.import.pkg.version}", + org.apache.commons.lang;version="[2.4,3)", + org.apache.commons.logging;version="[1.2,2)", org.osgi.framework.*;version="${imp.package.version.osgi.framework}", org.osgi.service.*;version="${imp.package.version.osgi.service}", - org.apache.commons.logging, - org.apache.commons.lang, - javax.xml, - javax.xml.stream, - javax.xml.bind.*;version="${javax.xml.bind.imp.pkg.version}", - javax.sql, - javax.xml.parsers; version=0.0.0, - org.w3c.dom, - com.google.gson.*, - javax.naming, - org.wso2.carbon.context, - org.wso2.carbon.base, - org.wso2.carbon.utils.*, - io.entgra.device.mgt.core.device.mgt.common.*, - io.entgra.device.mgt.core.device.mgt.core.*, - org.wso2.carbon.ndatasource.core, - org.wso2.carbon.registry.core, - org.wso2.carbon.registry.core.session, - org.wso2.carbon.registry.core.service, - org.wso2.carbon.registry.api, - io.entgra.device.mgt.core.device.mgt.extensions.license.mgt.registry, - javax.net.ssl, - org.wso2.carbon.core.util, - okhttp3 + org.w3c.dom,org.wso2.carbon.ndatasource.core;version="[4.8,5)", + org.wso2.carbon.registry.core.service;version="[1.0,2)", + org.wso2.carbon.utils;version="[4.8,5)" !io.entgra.device.mgt.core.operation.template.internal, @@ -130,6 +131,11 @@ + + org.apache.felix + org.apache.felix.scr.ds-annotations + provided + io.entgra.device.mgt.core io.entgra.device.mgt.core.device.mgt.common @@ -159,10 +165,6 @@ org.codehaus.woodstox wstx-asl - - - - org.wso2.carbon.analytics org.wso2.carbon.analytics.api @@ -232,21 +234,11 @@ - - org.eclipse.osgi - org.eclipse.osgi - provided - org.wso2.orbit.com.h2database h2 test - - org.eclipse.osgi - org.eclipse.osgi.services - provided - org.wso2.carbon org.wso2.carbon.core @@ -256,7 +248,6 @@ org.ops4j.pax.logging pax-logging-api provided - org.wso2.carbon diff --git a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/main/java/io/entgra/device/mgt/core/operation/template/dao/OperationTemplateDAOFactory.java b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/main/java/io/entgra/device/mgt/core/operation/template/dao/OperationTemplateDAOFactory.java index 4c4d096e6a..536f6f0235 100644 --- a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/main/java/io/entgra/device/mgt/core/operation/template/dao/OperationTemplateDAOFactory.java +++ b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/main/java/io/entgra/device/mgt/core/operation/template/dao/OperationTemplateDAOFactory.java @@ -18,13 +18,13 @@ package io.entgra.device.mgt.core.operation.template.dao; +import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; import io.entgra.device.mgt.core.operation.template.dao.impl.OperationTemplateDAOImpl; import io.entgra.device.mgt.core.operation.template.dao.impl.OperationTemplateMySQLDAOImpl; import io.entgra.device.mgt.core.operation.template.dao.impl.config.datasource.DataSourceConfig; import io.entgra.device.mgt.core.operation.template.util.ConnectionManagerUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; public class OperationTemplateDAOFactory { diff --git a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/main/java/io/entgra/device/mgt/core/operation/template/dao/impl/OperationTemplateDAOImpl.java b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/main/java/io/entgra/device/mgt/core/operation/template/dao/impl/OperationTemplateDAOImpl.java index 67a356bca9..7a50d5fc31 100644 --- a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/main/java/io/entgra/device/mgt/core/operation/template/dao/impl/OperationTemplateDAOImpl.java +++ b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/main/java/io/entgra/device/mgt/core/operation/template/dao/impl/OperationTemplateDAOImpl.java @@ -19,22 +19,17 @@ package io.entgra.device.mgt.core.operation.template.dao.impl; import com.google.gson.Gson; -import io.entgra.device.mgt.core.operation.template.dto.OperationTemplate; import io.entgra.device.mgt.core.operation.template.dao.OperationTemplateDAO; +import io.entgra.device.mgt.core.operation.template.dto.OperationTemplate; import io.entgra.device.mgt.core.operation.template.exception.DBConnectionException; import io.entgra.device.mgt.core.operation.template.exception.OperationTemplateManagementDAOException; import io.entgra.device.mgt.core.operation.template.util.ConnectionManagerUtils; import io.entgra.device.mgt.core.operation.template.util.DAOUtil; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Timestamp; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import java.sql.*; + /** * Implementation for generic DB engines. */ diff --git a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/main/java/io/entgra/device/mgt/core/operation/template/dao/impl/config/DeviceConfigurationManager.java b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/main/java/io/entgra/device/mgt/core/operation/template/dao/impl/config/DeviceConfigurationManager.java index 0d35632763..01aa604460 100644 --- a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/main/java/io/entgra/device/mgt/core/operation/template/dao/impl/config/DeviceConfigurationManager.java +++ b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/main/java/io/entgra/device/mgt/core/operation/template/dao/impl/config/DeviceConfigurationManager.java @@ -18,9 +18,9 @@ package io.entgra.device.mgt.core.operation.template.dao.impl.config; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.operation.template.dao.impl.util.OperationTemplateManagementUtil; import org.w3c.dom.Document; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import org.wso2.carbon.utils.CarbonUtils; import javax.xml.bind.JAXBContext; diff --git a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/main/java/io/entgra/device/mgt/core/operation/template/dao/impl/util/OperationTemplateManagementUtil.java b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/main/java/io/entgra/device/mgt/core/operation/template/dao/impl/util/OperationTemplateManagementUtil.java index 917288eb6c..eb2f4ee049 100644 --- a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/main/java/io/entgra/device/mgt/core/operation/template/dao/impl/util/OperationTemplateManagementUtil.java +++ b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/main/java/io/entgra/device/mgt/core/operation/template/dao/impl/util/OperationTemplateManagementUtil.java @@ -18,9 +18,9 @@ package io.entgra.device.mgt.core.operation.template.dao.impl.util; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.operation.template.dto.OperationTemplateCacheKey; import org.w3c.dom.Document; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import javax.xml.XMLConstants; import javax.xml.parsers.DocumentBuilder; diff --git a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/main/java/io/entgra/device/mgt/core/operation/template/impl/OperationTemplateServiceImpl.java b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/main/java/io/entgra/device/mgt/core/operation/template/impl/OperationTemplateServiceImpl.java index 80fa1ea139..070f190889 100644 --- a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/main/java/io/entgra/device/mgt/core/operation/template/impl/OperationTemplateServiceImpl.java +++ b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/main/java/io/entgra/device/mgt/core/operation/template/impl/OperationTemplateServiceImpl.java @@ -30,8 +30,8 @@ import io.entgra.device.mgt.core.operation.template.exception.DBConnectionExcept import io.entgra.device.mgt.core.operation.template.exception.OperationTemplateManagementDAOException; import io.entgra.device.mgt.core.operation.template.exception.OperationTemplateMgtPluginException; import io.entgra.device.mgt.core.operation.template.spi.OperationTemplateService; -import io.entgra.device.mgt.core.operation.template.util.ConnectionManagerUtils; import io.entgra.device.mgt.core.operation.template.util.AssertUtils; +import io.entgra.device.mgt.core.operation.template.util.ConnectionManagerUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/main/java/io/entgra/device/mgt/core/operation/template/internal/OperationTemplateMgtDataHolder.java b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/main/java/io/entgra/device/mgt/core/operation/template/internal/OperationTemplateMgtDataHolder.java index 1536feb87a..c0e8b1063b 100644 --- a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/main/java/io/entgra/device/mgt/core/operation/template/internal/OperationTemplateMgtDataHolder.java +++ b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/main/java/io/entgra/device/mgt/core/operation/template/internal/OperationTemplateMgtDataHolder.java @@ -18,8 +18,8 @@ package io.entgra.device.mgt.core.operation.template.internal; -import io.entgra.device.mgt.core.operation.template.spi.OperationTemplateService; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; +import io.entgra.device.mgt.core.operation.template.spi.OperationTemplateService; import org.wso2.carbon.registry.core.service.RegistryService; /** diff --git a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/main/java/io/entgra/device/mgt/core/operation/template/internal/OperationTemplateMgtServiceComponent.java b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/main/java/io/entgra/device/mgt/core/operation/template/internal/OperationTemplateMgtServiceComponent.java index 1bff30c260..50696cbd4c 100644 --- a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/main/java/io/entgra/device/mgt/core/operation/template/internal/OperationTemplateMgtServiceComponent.java +++ b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/main/java/io/entgra/device/mgt/core/operation/template/internal/OperationTemplateMgtServiceComponent.java @@ -28,18 +28,12 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.framework.BundleContext; import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.*; import org.wso2.carbon.ndatasource.core.DataSourceService; -/** - * @scr.component name="io.entgra.device.mgt.operation.template.internal.OperationTemplateMgtServiceComponent" immediate="true" - * immediate="true" - * @scr.reference name="org.wso2.carbon.ndatasource" - * interface="org.wso2.carbon.ndatasource.core.DataSourceService" - * cardinality="1..1" - * policy="dynamic" - * bind="setDataSourceService" - * unbind="unsetDataSourceService" - */ +@Component( + name = "io.entgra.device.mgt.core.operation.template.internal.OperationTemplateMgtServiceComponent", + immediate = true) public class OperationTemplateMgtServiceComponent { private static final Log log = LogFactory.getLog(OperationTemplateMgtServiceComponent.class); @@ -48,6 +42,7 @@ public class OperationTemplateMgtServiceComponent { * * @param componentContext */ + @Activate protected void activate(ComponentContext componentContext) { if (log.isDebugEnabled()) { @@ -77,6 +72,7 @@ public class OperationTemplateMgtServiceComponent { * * @param componentContext */ + @Deactivate protected void deactivate(ComponentContext componentContext) { if (log.isDebugEnabled()) { log.debug("De-activating Operation Template Management Service Component"); @@ -94,6 +90,12 @@ public class OperationTemplateMgtServiceComponent { * * @param dataSourceService */ + @Reference( + name = "datasource.service", + service = org.wso2.carbon.ndatasource.core.DataSourceService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetDataSourceService") protected void setDataSourceService(DataSourceService dataSourceService) { /* This is to avoid mobile device management component getting initialized before the underlying datasources are registered */ diff --git a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/main/java/io/entgra/device/mgt/core/operation/template/util/ConnectionManagerUtils.java b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/main/java/io/entgra/device/mgt/core/operation/template/util/ConnectionManagerUtils.java index 292690b24f..badb901565 100644 --- a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/main/java/io/entgra/device/mgt/core/operation/template/util/ConnectionManagerUtils.java +++ b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/main/java/io/entgra/device/mgt/core/operation/template/util/ConnectionManagerUtils.java @@ -18,20 +18,19 @@ package io.entgra.device.mgt.core.operation.template.util; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.IllegalTransactionStateException; import io.entgra.device.mgt.core.operation.template.dao.impl.config.datasource.DataSourceConfig; import io.entgra.device.mgt.core.operation.template.dao.impl.config.datasource.JNDILookupDefinition; import io.entgra.device.mgt.core.operation.template.exception.DBConnectionException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import javax.naming.InitialContext; +import javax.sql.DataSource; import java.sql.Connection; import java.sql.SQLException; import java.util.Hashtable; import java.util.List; -import javax.naming.InitialContext; -import javax.sql.DataSource; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.IllegalTransactionStateException; /** * Connection Manager Utils class. diff --git a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/test/java/io/entgra/device/mgt/core/operation/template/ServiceNegativeTest.java b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/test/java/io/entgra/device/mgt/core/operation/template/ServiceNegativeTest.java index 2c41d1ffc3..2851c8312e 100644 --- a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/test/java/io/entgra/device/mgt/core/operation/template/ServiceNegativeTest.java +++ b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/test/java/io/entgra/device/mgt/core/operation/template/ServiceNegativeTest.java @@ -21,8 +21,8 @@ package io.entgra.device.mgt.core.operation.template; import io.entgra.device.mgt.core.operation.template.dto.OperationTemplate; import io.entgra.device.mgt.core.operation.template.exception.OperationTemplateMgtPluginException; import io.entgra.device.mgt.core.operation.template.impl.OperationTemplateServiceImpl; -import io.entgra.device.mgt.core.operation.template.spi.OperationTemplateService; import io.entgra.device.mgt.core.operation.template.mock.BaseOperationTemplatePluginTest; +import io.entgra.device.mgt.core.operation.template.spi.OperationTemplateService; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.testng.annotations.BeforeClass; diff --git a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/test/java/io/entgra/device/mgt/core/operation/template/mock/BaseOperationTemplatePluginTest.java b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/test/java/io/entgra/device/mgt/core/operation/template/mock/BaseOperationTemplatePluginTest.java index 11ed63df6e..c563311602 100644 --- a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/test/java/io/entgra/device/mgt/core/operation/template/mock/BaseOperationTemplatePluginTest.java +++ b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/test/java/io/entgra/device/mgt/core/operation/template/mock/BaseOperationTemplatePluginTest.java @@ -18,10 +18,13 @@ package io.entgra.device.mgt.core.operation.template.mock; +import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; +import io.entgra.device.mgt.core.device.mgt.core.util.DeviceManagerUtil; import io.entgra.device.mgt.core.operation.template.DataSourceConfig; +import io.entgra.device.mgt.core.operation.template.TestUtils; import io.entgra.device.mgt.core.operation.template.dao.OperationTemplateDAOFactory; import io.entgra.device.mgt.core.operation.template.util.ConnectionManagerUtils; -import io.entgra.device.mgt.core.operation.template.TestUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.tomcat.jdbc.pool.PoolProperties; @@ -32,9 +35,6 @@ import org.testng.annotations.Parameters; import org.w3c.dom.Document; import org.wso2.carbon.base.MultitenantConstants; import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; -import io.entgra.device.mgt.core.device.mgt.core.util.DeviceManagerUtil; import javax.sql.DataSource; import javax.xml.bind.JAXBContext; diff --git a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/test/java/io/entgra/device/mgt/core/operation/template/mock/MockConnection.java b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/test/java/io/entgra/device/mgt/core/operation/template/mock/MockConnection.java index a29ad73fae..bd16dbac88 100644 --- a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/test/java/io/entgra/device/mgt/core/operation/template/mock/MockConnection.java +++ b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/test/java/io/entgra/device/mgt/core/operation/template/mock/MockConnection.java @@ -18,21 +18,7 @@ package io.entgra.device.mgt.core.operation.template.mock; -import java.sql.CallableStatement; -import java.sql.SQLWarning; -import java.sql.Savepoint; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.Statement; -import java.sql.Clob; -import java.sql.Blob; -import java.sql.NClob; -import java.sql.SQLXML; -import java.sql.Struct; -import java.sql.Array; -import java.sql.SQLClientInfoException; -import java.sql.DatabaseMetaData; -import java.sql.SQLException; +import java.sql.*; import java.util.ArrayList; import java.util.List; import java.util.Map; diff --git a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/test/java/io/entgra/device/mgt/core/operation/template/mock/MockDatabaseMetaData.java b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/test/java/io/entgra/device/mgt/core/operation/template/mock/MockDatabaseMetaData.java index 7320892182..fab59016ca 100644 --- a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/test/java/io/entgra/device/mgt/core/operation/template/mock/MockDatabaseMetaData.java +++ b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/test/java/io/entgra/device/mgt/core/operation/template/mock/MockDatabaseMetaData.java @@ -20,11 +20,7 @@ package io.entgra.device.mgt.core.operation.template.mock; import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.RowIdLifetime; -import java.sql.DatabaseMetaData; -import java.sql.SQLException; +import java.sql.*; public class MockDatabaseMetaData implements DatabaseMetaData { private final String url; diff --git a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/test/java/io/entgra/device/mgt/core/operation/template/mock/MockResultSet.java b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/test/java/io/entgra/device/mgt/core/operation/template/mock/MockResultSet.java index a77146b901..1549ac78b2 100644 --- a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/test/java/io/entgra/device/mgt/core/operation/template/mock/MockResultSet.java +++ b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/test/java/io/entgra/device/mgt/core/operation/template/mock/MockResultSet.java @@ -22,21 +22,7 @@ import java.io.InputStream; import java.io.Reader; import java.math.BigDecimal; import java.net.URL; -import java.sql.ResultSet; -import java.sql.SQLWarning; -import java.sql.Date; -import java.sql.Time; -import java.sql.Timestamp; -import java.sql.Clob; -import java.sql.Blob; -import java.sql.NClob; -import java.sql.SQLXML; -import java.sql.Ref; -import java.sql.Array; -import java.sql.ResultSetMetaData; -import java.sql.RowId; -import java.sql.Statement; -import java.sql.SQLException; +import java.sql.*; import java.util.ArrayList; import java.util.Calendar; import java.util.List; diff --git a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/test/java/io/entgra/device/mgt/core/operation/template/mock/MockStatement.java b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/test/java/io/entgra/device/mgt/core/operation/template/mock/MockStatement.java index a749066de6..c4ced59a34 100644 --- a/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/test/java/io/entgra/device/mgt/core/operation/template/mock/MockStatement.java +++ b/components/operation-template-mgt/io.entgra.device.mgt.core.operation.template/src/test/java/io/entgra/device/mgt/core/operation/template/mock/MockStatement.java @@ -22,23 +22,7 @@ import java.io.InputStream; import java.io.Reader; import java.math.BigDecimal; import java.net.URL; -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.SQLWarning; -import java.sql.Date; -import java.sql.Time; -import java.sql.Timestamp; -import java.sql.PreparedStatement; -import java.sql.ParameterMetaData; -import java.sql.Clob; -import java.sql.Blob; -import java.sql.NClob; -import java.sql.SQLXML; -import java.sql.Ref; -import java.sql.Array; -import java.sql.ResultSetMetaData; -import java.sql.RowId; -import java.sql.SQLException; +import java.sql.*; import java.util.ArrayList; import java.util.Calendar; import java.util.List; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/pom.xml b/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/pom.xml index fee58a77a1..0eff71e8f9 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/pom.xml +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/pom.xml @@ -30,13 +30,17 @@ bundle WSO2 Carbon - Policy Decision Point WSO2 Carbon - Policy Decision Point - http://wso2.org + https://entgra.io - org.apache.felix - maven-scr-plugin + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + org.apache.felix @@ -50,14 +54,18 @@ Policy Decision Point Bundle io.entgra.device.mgt.core.policy.decision.point.internal - org.wso2.carbon.context;version="${carbon.kernel.version.range}", + io.entgra.device.mgt.core.device.mgt.common;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.policy.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.policy.decision.point.internal, + io.entgra.device.mgt.core.policy.decision.point.merged, + io.entgra.device.mgt.core.policy.decision.point.simple, + io.entgra.device.mgt.core.policy.mgt.common;version="[5.0,6)", + io.entgra.device.mgt.core.policy.mgt.core;version="[5.0,6)", + org.apache.commons.logging;version="[1.2,2)", org.osgi.framework.*;version="${imp.package.version.osgi.framework}", org.osgi.service.*;version="${imp.package.version.osgi.service}", - org.apache.commons.logging, - io.entgra.device.mgt.core.policy.mgt.common.*, - io.entgra.device.mgt.core.policy.mgt.core.*, - org.wso2.carbon.user.core.*, - io.entgra.device.mgt.core.device.mgt.common.* + org.wso2.carbon.context;version="[4.8,5)", + org.wso2.carbon.user.core.service;version="[4.8,5)" io.entgra.device.mgt.core.policy.decision.point.* @@ -95,12 +103,9 @@ - org.eclipse.osgi - org.eclipse.osgi - - - org.eclipse.equinox - org.eclipse.equinox.common + org.apache.felix + org.apache.felix.scr.ds-annotations + provided org.ops4j.pax.logging diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/src/main/java/io/entgra/device/mgt/core/policy/decision/point/internal/MergedPolicyEvaluationServiceComponent.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/src/main/java/io/entgra/device/mgt/core/policy/decision/point/internal/MergedPolicyEvaluationServiceComponent.java index 5157146f0a..0a13209c21 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/src/main/java/io/entgra/device/mgt/core/policy/decision/point/internal/MergedPolicyEvaluationServiceComponent.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/src/main/java/io/entgra/device/mgt/core/policy/decision/point/internal/MergedPolicyEvaluationServiceComponent.java @@ -19,33 +19,22 @@ package io.entgra.device.mgt.core.policy.decision.point.internal; import io.entgra.device.mgt.core.policy.decision.point.merged.MergedEvaluationPoint; +import io.entgra.device.mgt.core.policy.mgt.common.PolicyEvaluationPoint; +import io.entgra.device.mgt.core.policy.mgt.core.PolicyManagerService; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.service.component.ComponentContext; -import io.entgra.device.mgt.core.policy.mgt.common.PolicyEvaluationPoint; -import io.entgra.device.mgt.core.policy.mgt.core.PolicyManagerService; +import org.osgi.service.component.annotations.*; import org.wso2.carbon.user.core.service.RealmService; -/** - * @scr.component name="org.wso2.carbon.policy.decision.MergedPolicyEvaluationServiceComponent" immediate="true" - * @scr.reference name="user.realmservice.default" - * interface="org.wso2.carbon.user.core.service.RealmService" - * cardinality="1..1" - * policy="dynamic" - * bind="setRealmService" - * unbind="unsetRealmService" - * @scr.reference name="org.wso2.carbon.devicemgt.policy.manager" - * interface="io.entgra.device.mgt.core.policy.mgt.core.PolicyManagerService" - * cardinality="0..1" - * policy="dynamic" - * bind="setPolicyManagerService" - * unbind="unsetPolicyManagerService" - */ - +@Component( + name = "io.entgra.device.mgt.core.policy.decision.point.internal.MergedPolicyEvaluationServiceComponent", + immediate = true) public class MergedPolicyEvaluationServiceComponent { private static Log log = LogFactory.getLog(MergedPolicyEvaluationServiceComponent.class); + @Activate protected void activate(ComponentContext componentContext) { if (log.isDebugEnabled()) { log.debug("Activating the policy evaluation bundle."); @@ -59,6 +48,7 @@ public class MergedPolicyEvaluationServiceComponent { } } + @Deactivate protected void deactivate(ComponentContext componentContext) { if (log.isDebugEnabled()) { log.debug("De-activating the policy evaluation bundle."); @@ -70,6 +60,12 @@ public class MergedPolicyEvaluationServiceComponent { * * @param realmService An instance of RealmService */ + @Reference( + name = "realm.service", + service = org.wso2.carbon.user.core.service.RealmService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRealmService") protected void setRealmService(RealmService realmService) { if (log.isDebugEnabled()) { @@ -90,6 +86,12 @@ public class MergedPolicyEvaluationServiceComponent { PolicyDecisionPointDataHolder.getInstance().setRealmService(null); } + @Reference( + name = "policy.mgt.service", + service = io.entgra.device.mgt.core.policy.mgt.core.PolicyManagerService.class, + cardinality = ReferenceCardinality.OPTIONAL, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetPolicyManagerService") protected void setPolicyManagerService(PolicyManagerService policyManagerService) { if (log.isDebugEnabled()) { log.debug("Unsetting PolicyManagerService Service"); diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/src/main/java/io/entgra/device/mgt/core/policy/decision/point/internal/PolicyEvaluationServiceComponent.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/src/main/java/io/entgra/device/mgt/core/policy/decision/point/internal/PolicyEvaluationServiceComponent.java index 46d1855776..2697e10b51 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/src/main/java/io/entgra/device/mgt/core/policy/decision/point/internal/PolicyEvaluationServiceComponent.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/src/main/java/io/entgra/device/mgt/core/policy/decision/point/internal/PolicyEvaluationServiceComponent.java @@ -19,33 +19,22 @@ package io.entgra.device.mgt.core.policy.decision.point.internal; import io.entgra.device.mgt.core.policy.decision.point.simple.PolicyEvaluationServiceImpl; +import io.entgra.device.mgt.core.policy.mgt.common.PolicyEvaluationPoint; +import io.entgra.device.mgt.core.policy.mgt.core.PolicyManagerService; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.service.component.ComponentContext; -import io.entgra.device.mgt.core.policy.mgt.common.PolicyEvaluationPoint; -import io.entgra.device.mgt.core.policy.mgt.core.PolicyManagerService; +import org.osgi.service.component.annotations.*; import org.wso2.carbon.user.core.service.RealmService; -/** - * @scr.component name="org.wso2.carbon.simple.policy.decision.PolicyEvaluationServiceComponent" immediate="true" - * @scr.reference name="user.realmservice.default" - * interface="org.wso2.carbon.user.core.service.RealmService" - * cardinality="1..1" - * policy="dynamic" - * bind="setRealmService" - * unbind="unsetRealmService" - * @scr.reference name="org.wso2.carbon.devicemgt.policy.manager" - * interface="io.entgra.device.mgt.core.policy.mgt.core.PolicyManagerService" - * cardinality="0..1" - * policy="dynamic" - * bind="setPolicyManagerService" - * unbind="unsetPolicyManagerService" - */ - +@Component( + name = "io.entgra.device.mgt.core.policy.decision.point.internal.PolicyEvaluationServiceComponent", + immediate = true) public class PolicyEvaluationServiceComponent { private static Log log = LogFactory.getLog(PolicyEvaluationServiceComponent.class); + @Activate protected void activate(ComponentContext componentContext) { if (log.isDebugEnabled()) { log.debug("Activating the policy evaluation bundle."); @@ -58,7 +47,7 @@ public class PolicyEvaluationServiceComponent { log.error("Error occurred while initializing the policy evaluation bundle"); } } - + @Deactivate protected void deactivate(ComponentContext componentContext) { if (log.isDebugEnabled()) { log.debug("De-activating the policy evaluation bundle."); @@ -70,6 +59,12 @@ public class PolicyEvaluationServiceComponent { * * @param realmService An instance of RealmService */ + @Reference( + name = "realm.service", + service = org.wso2.carbon.user.core.service.RealmService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRealmService") protected void setRealmService(RealmService realmService) { if (log.isDebugEnabled()) { @@ -90,6 +85,12 @@ public class PolicyEvaluationServiceComponent { PolicyDecisionPointDataHolder.getInstance().setRealmService(null); } + @Reference( + name = "policy.mgt.service", + service = io.entgra.device.mgt.core.policy.mgt.core.PolicyManagerService.class, + cardinality = ReferenceCardinality.OPTIONAL, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetPolicyManagerService") protected void setPolicyManagerService(PolicyManagerService policyManagerService) { if (log.isDebugEnabled()) { diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/src/main/java/io/entgra/device/mgt/core/policy/decision/point/merged/MergedEvaluationPoint.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/src/main/java/io/entgra/device/mgt/core/policy/decision/point/merged/MergedEvaluationPoint.java index e675994e41..9ddc449742 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/src/main/java/io/entgra/device/mgt/core/policy/decision/point/merged/MergedEvaluationPoint.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/src/main/java/io/entgra/device/mgt/core/policy/decision/point/merged/MergedEvaluationPoint.java @@ -18,16 +18,16 @@ package io.entgra.device.mgt.core.policy.decision.point.merged; -import io.entgra.device.mgt.core.policy.decision.point.internal.PolicyDecisionPointDataHolder; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Policy; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Profile; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.ProfileFeature; +import io.entgra.device.mgt.core.policy.decision.point.internal.PolicyDecisionPointDataHolder; import io.entgra.device.mgt.core.policy.mgt.common.*; import io.entgra.device.mgt.core.policy.mgt.core.PolicyManagerService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.PrivilegedCarbonContext; import java.sql.Timestamp; import java.util.*; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/src/main/java/io/entgra/device/mgt/core/policy/decision/point/simple/PolicyEvaluationServiceImpl.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/src/main/java/io/entgra/device/mgt/core/policy/decision/point/simple/PolicyEvaluationServiceImpl.java index fd978d94e5..181705e792 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/src/main/java/io/entgra/device/mgt/core/policy/decision/point/simple/PolicyEvaluationServiceImpl.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/src/main/java/io/entgra/device/mgt/core/policy/decision/point/simple/PolicyEvaluationServiceImpl.java @@ -20,9 +20,9 @@ package io.entgra.device.mgt.core.policy.decision.point.simple; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Policy; +import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.ProfileFeature; import io.entgra.device.mgt.core.policy.mgt.common.PolicyEvaluationException; import io.entgra.device.mgt.core.policy.mgt.common.PolicyEvaluationPoint; -import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.ProfileFeature; import java.util.List; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/src/main/java/io/entgra/device/mgt/core/policy/decision/point/simple/SimpleEvaluationImpl.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/src/main/java/io/entgra/device/mgt/core/policy/decision/point/simple/SimpleEvaluationImpl.java index 05f78e6874..28f63374b9 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/src/main/java/io/entgra/device/mgt/core/policy/decision/point/simple/SimpleEvaluationImpl.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.decision.point/src/main/java/io/entgra/device/mgt/core/policy/decision/point/simple/SimpleEvaluationImpl.java @@ -18,13 +18,13 @@ package io.entgra.device.mgt.core.policy.decision.point.simple; -import io.entgra.device.mgt.core.policy.decision.point.internal.PolicyDecisionPointDataHolder; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Policy; +import io.entgra.device.mgt.core.policy.decision.point.internal.PolicyDecisionPointDataHolder; import io.entgra.device.mgt.core.policy.mgt.common.*; import io.entgra.device.mgt.core.policy.mgt.core.PolicyManagerService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.util.ArrayList; import java.util.Collections; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/pom.xml b/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/pom.xml index 9fc0b9e8be..10fa65047d 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/pom.xml +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/pom.xml @@ -31,14 +31,18 @@ bundle WSO2 Carbon - Policy Information Point WSO2 Carbon - Policy Information Point - http://wso2.org + https://entgra.io - org.apache.felix - maven-scr-plugin + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + org.apache.felix @@ -55,6 +59,14 @@ io.entgra.device.mgt.core.policy.information.point.* + + io.entgra.device.mgt.core.device.mgt.common;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.policy.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.policy.information.point, + io.entgra.device.mgt.core.policy.mgt.common;version="[5.0,6)", + org.apache.commons.logging;version="[1.2,2)", + org.osgi.framework.*;version="${imp.package.version.osgi.framework}" + @@ -88,12 +100,9 @@ - org.eclipse.osgi - org.eclipse.osgi - - - org.eclipse.equinox - org.eclipse.equinox.common + org.apache.felix + org.apache.felix.scr.ds-annotations + provided org.ops4j.pax.logging diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/src/main/java/io/entgra/device/mgt/core/policy/information/point/PolicyInformationServiceImpl.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/src/main/java/io/entgra/device/mgt/core/policy/information/point/PolicyInformationServiceImpl.java index 752baf00e5..fab3d9b7a2 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/src/main/java/io/entgra/device/mgt/core/policy/information/point/PolicyInformationServiceImpl.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/src/main/java/io/entgra/device/mgt/core/policy/information/point/PolicyInformationServiceImpl.java @@ -20,8 +20,8 @@ package io.entgra.device.mgt.core.policy.information.point; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.Feature; -import io.entgra.device.mgt.core.policy.mgt.common.PIPDevice; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Policy; +import io.entgra.device.mgt.core.policy.mgt.common.PIPDevice; import io.entgra.device.mgt.core.policy.mgt.common.PolicyInformationPoint; import java.util.List; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/src/main/java/io/entgra/device/mgt/core/policy/information/point/internal/PolicyInformationPointBundleActivator.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/src/main/java/io/entgra/device/mgt/core/policy/information/point/internal/PolicyInformationPointBundleActivator.java index c4b944befe..a01841f2da 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/src/main/java/io/entgra/device/mgt/core/policy/information/point/internal/PolicyInformationPointBundleActivator.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.information.point/src/main/java/io/entgra/device/mgt/core/policy/information/point/internal/PolicyInformationPointBundleActivator.java @@ -18,13 +18,13 @@ package io.entgra.device.mgt.core.policy.information.point.internal; +import io.entgra.device.mgt.core.policy.information.point.PolicyInformationServiceImpl; +import io.entgra.device.mgt.core.policy.mgt.common.PolicyInformationPoint; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceRegistration; -import io.entgra.device.mgt.core.policy.information.point.PolicyInformationServiceImpl; -import io.entgra.device.mgt.core.policy.mgt.common.PolicyInformationPoint; public class PolicyInformationPointBundleActivator implements BundleActivator { diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/pom.xml b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/pom.xml index ba8f90e752..52d3c6c045 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/pom.xml +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/pom.xml @@ -31,13 +31,17 @@ bundle WSO2 Carbon - Policy Management Common WSO2 Carbon - Policy Management Common - http://wso2.org + https://entgra.io - org.apache.felix - maven-scr-plugin + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + org.apache.felix @@ -50,11 +54,11 @@ ${io.entgra.device.mgt.core.version} Policy Management Common Bundle - javax.xml.bind.annotation, - io.swagger.annotations.*;resolution:=optional, - io.entgra.device.mgt.core.device.mgt.common.*, - io.entgra.device.mgt.core.device.mgt.core.dto.*, - javax.xml.bind.*, + io.entgra.device.mgt.core.device.mgt.common;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.group.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.policy.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.core.dto;version="[5.0,6)" io.entgra.device.mgt.core.policy.mgt.common.* @@ -93,18 +97,14 @@ - org.eclipse.osgi - org.eclipse.osgi - - - org.eclipse.equinox - org.eclipse.equinox.common + org.apache.felix + org.apache.felix.scr.ds-annotations + provided org.ops4j.pax.logging pax-logging-api provided - org.testng diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/src/main/java/io/entgra/device/mgt/core/policy/mgt/common/PolicyAdministratorPoint.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/src/main/java/io/entgra/device/mgt/core/policy/mgt/common/PolicyAdministratorPoint.java index 0d8219b290..7101bc6c78 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/src/main/java/io/entgra/device/mgt/core/policy/mgt/common/PolicyAdministratorPoint.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/src/main/java/io/entgra/device/mgt/core/policy/mgt/common/PolicyAdministratorPoint.java @@ -17,8 +17,8 @@ */ package io.entgra.device.mgt.core.policy.mgt.common; + import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; -import io.entgra.device.mgt.core.device.mgt.common.DynamicTaskContext; import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.PolicyPaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Policy; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/src/main/java/io/entgra/device/mgt/core/policy/mgt/common/monitor/ComplianceDecisionPoint.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/src/main/java/io/entgra/device/mgt/core/policy/mgt/common/monitor/ComplianceDecisionPoint.java index c56387094d..0ff1d5b766 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/src/main/java/io/entgra/device/mgt/core/policy/mgt/common/monitor/ComplianceDecisionPoint.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.common/src/main/java/io/entgra/device/mgt/core/policy/mgt/common/monitor/ComplianceDecisionPoint.java @@ -22,9 +22,9 @@ package io.entgra.device.mgt.core.policy.mgt.common.monitor; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; +import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Policy; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.NonComplianceData; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.PolicyComplianceException; -import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Policy; import java.util.List; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml index 289b1625be..6887a4f3e5 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/pom.xml @@ -31,13 +31,17 @@ bundle WSO2 Carbon - Policy Management Core WSO2 Carbon - Policy Management Core - http://wso2.org + https://entgra.io - org.apache.felix - maven-scr-plugin + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + org.apache.felix @@ -51,24 +55,53 @@ Policy Management Core Bundle io.entgra.device.mgt.core.policy.mgt.core.internal + com.google.gson;version="[2.9,3)", + io.entgra.device.mgt.core.device.mgt.common;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.configuration.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.exceptions;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.group.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.operation.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.policy.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.core.config;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.core.config.policy;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.core.config.tenant;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.core.dto;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.core.operation.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.core.service;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.core.task.impl;version="[5.0,6)", + io.entgra.device.mgt.core.policy.mgt.common;version="[5.0,6)", + io.entgra.device.mgt.core.policy.mgt.common.monitor;version="[5.0,6)", + io.entgra.device.mgt.core.policy.mgt.core.cache, + io.entgra.device.mgt.core.policy.mgt.core.cache.impl, + io.entgra.device.mgt.core.policy.mgt.core.config, + io.entgra.device.mgt.core.policy.mgt.core.config.datasource, + io.entgra.device.mgt.core.policy.mgt.core.dao, + io.entgra.device.mgt.core.policy.mgt.core.dao.impl, + io.entgra.device.mgt.core.policy.mgt.core.dao.impl.feature, + io.entgra.device.mgt.core.policy.mgt.core.dao.impl.policy, + io.entgra.device.mgt.core.policy.mgt.core.dao.util, + io.entgra.device.mgt.core.policy.mgt.core.mgt, + io.entgra.device.mgt.core.policy.mgt.core.mgt.bean, + io.entgra.device.mgt.core.policy.mgt.core.util, + javax.cache;version="[1.0,2)", + javax.naming, + javax.sql, + javax.xml.bind;version="[0.0,1)", + javax.xml.bind.annotation;version="[0.0,1)", + javax.xml.parsers;version="${javax.xml.parsers.import.pkg.version}", + org.apache.commons.lang;version="[2.6,3)", + org.apache.commons.logging;version="[1.2,2)", org.osgi.framework.*;version="${imp.package.version.osgi.framework}", org.osgi.service.*;version="${imp.package.version.osgi.service}", - org.apache.commons.logging, - javax.sql, - javax.cache, - javax.naming, - javax.xml.*, - javax.xml.parsers;version="${javax.xml.parsers.import.pkg.version}";resolution:=optional, org.w3c.dom, - io.entgra.device.mgt.core.policy.mgt.common.*, - org.wso2.carbon.user.core.*, - org.wso2.carbon.utils.*, - org.wso2.carbon.context.*, - org.wso2.carbon.user.api.*, - io.entgra.device.mgt.core.device.mgt.core.*, - io.entgra.device.mgt.core.device.mgt.common.*, - org.wso2.carbon.ntask.*, - org.wso2.carbon.caching.* + org.wso2.carbon.context;version="[4.8,5)", + org.wso2.carbon.ntask.common;version="[4.9,5)", + org.wso2.carbon.ntask.core;version="[4.9,5)", + org.wso2.carbon.ntask.core.service;version="[4.9,5)", + org.wso2.carbon.user.api;version="[1.0,2)", + org.wso2.carbon.user.core.service;version="[4.8,5)", + org.wso2.carbon.utils;version="[4.8,5)" !io.entgra.device.mgt.core.policy.mgt.core.internal, @@ -122,27 +155,19 @@ - org.eclipse.osgi - org.eclipse.osgi - - - org.eclipse.equinox - org.eclipse.equinox.common + org.apache.felix + org.apache.felix.scr.ds-annotations + provided org.ops4j.pax.logging pax-logging-api provided - org.wso2.carbon org.wso2.carbon.utils - - - - org.wso2.carbon org.wso2.carbon.core @@ -212,11 +237,6 @@ h2 test - - - - - diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/PolicyManagerService.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/PolicyManagerService.java index 176987eb54..648a5e9cd8 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/PolicyManagerService.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/PolicyManagerService.java @@ -19,18 +19,15 @@ package io.entgra.device.mgt.core.policy.mgt.core; -import io.entgra.device.mgt.core.device.mgt.common.Device; -import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.Feature; -import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; -import io.entgra.device.mgt.core.device.mgt.common.PaginationResult; +import io.entgra.device.mgt.core.device.mgt.common.*; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Policy; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Profile; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.ProfileFeature; -import io.entgra.device.mgt.core.policy.mgt.common.*; -import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.NonComplianceData; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.ComplianceFeature; +import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.NonComplianceData; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.PolicyComplianceException; +import io.entgra.device.mgt.core.policy.mgt.common.*; import io.entgra.device.mgt.core.policy.mgt.core.task.TaskScheduleService; import java.util.List; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/PolicyManagerServiceImpl.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/PolicyManagerServiceImpl.java index e7a919d969..48b392ebe0 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/PolicyManagerServiceImpl.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/PolicyManagerServiceImpl.java @@ -18,22 +18,17 @@ package io.entgra.device.mgt.core.policy.mgt.core; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.device.mgt.common.Device; -import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.Feature; -import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; -import io.entgra.device.mgt.core.device.mgt.common.PaginationResult; +import io.entgra.device.mgt.core.device.mgt.common.*; import io.entgra.device.mgt.core.device.mgt.common.exceptions.InvalidDeviceException; import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.OperationManagementException; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Policy; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Profile; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.ProfileFeature; -import io.entgra.device.mgt.core.policy.mgt.common.*; -import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.NonComplianceData; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.ComplianceFeature; +import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.NonComplianceData; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.PolicyComplianceException; +import io.entgra.device.mgt.core.policy.mgt.common.*; import io.entgra.device.mgt.core.policy.mgt.core.impl.PolicyAdministratorPointImpl; import io.entgra.device.mgt.core.policy.mgt.core.impl.PolicyInformationPointImpl; import io.entgra.device.mgt.core.policy.mgt.core.internal.PolicyManagementDataHolder; @@ -44,6 +39,8 @@ import io.entgra.device.mgt.core.policy.mgt.core.mgt.impl.PolicyManagerImpl; import io.entgra.device.mgt.core.policy.mgt.core.task.TaskScheduleService; import io.entgra.device.mgt.core.policy.mgt.core.task.TaskScheduleServiceImpl; import io.entgra.device.mgt.core.policy.mgt.core.util.PolicyManagerUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.util.ArrayList; import java.util.List; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/cache/PolicyCacheManager.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/cache/PolicyCacheManager.java index 7361ad0466..ec402a96d1 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/cache/PolicyCacheManager.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/cache/PolicyCacheManager.java @@ -19,7 +19,6 @@ package io.entgra.device.mgt.core.policy.mgt.core.cache; -import io.entgra.device.mgt.core.device.mgt.common.DynamicTaskContext; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Policy; import io.entgra.device.mgt.core.policy.mgt.common.PolicyManagementException; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/cache/impl/PolicyCacheManagerImpl.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/cache/impl/PolicyCacheManagerImpl.java index 9dfc2839c4..187d711da5 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/cache/impl/PolicyCacheManagerImpl.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/cache/impl/PolicyCacheManagerImpl.java @@ -19,9 +19,6 @@ package io.entgra.device.mgt.core.policy.mgt.core.cache.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.device.mgt.common.DynamicTaskContext; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Policy; import io.entgra.device.mgt.core.policy.mgt.common.PolicyManagementException; import io.entgra.device.mgt.core.policy.mgt.core.cache.PolicyCacheManager; @@ -29,6 +26,8 @@ import io.entgra.device.mgt.core.policy.mgt.core.mgt.PolicyManager; import io.entgra.device.mgt.core.policy.mgt.core.mgt.impl.PolicyManagerImpl; import io.entgra.device.mgt.core.policy.mgt.core.util.PolicyManagementConstants; import io.entgra.device.mgt.core.policy.mgt.core.util.PolicyManagerUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import javax.cache.Cache; import java.util.ArrayList; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/config/PolicyConfigurationManager.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/config/PolicyConfigurationManager.java index a475162a57..fff3995214 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/config/PolicyConfigurationManager.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/config/PolicyConfigurationManager.java @@ -18,11 +18,11 @@ package io.entgra.device.mgt.core.policy.mgt.core.config; -import org.w3c.dom.Document; import io.entgra.device.mgt.core.policy.mgt.common.PolicyManagementException; import io.entgra.device.mgt.core.policy.mgt.core.config.datasource.DataSourceConfig; import io.entgra.device.mgt.core.policy.mgt.core.util.PolicyManagementConstants; import io.entgra.device.mgt.core.policy.mgt.core.util.PolicyManagerUtil; +import org.w3c.dom.Document; import org.wso2.carbon.utils.CarbonUtils; import javax.xml.bind.JAXBContext; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/dao/MonitoringDAO.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/dao/MonitoringDAO.java index 6e11d63965..a3bf9343a6 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/dao/MonitoringDAO.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/dao/MonitoringDAO.java @@ -21,8 +21,8 @@ package io.entgra.device.mgt.core.policy.mgt.core.dao; import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.ComplianceData; -import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.NonComplianceData; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.ComplianceFeature; +import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.NonComplianceData; import io.entgra.device.mgt.core.policy.mgt.common.monitor.PolicyDeviceWrapper; import java.util.List; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/dao/PolicyDAO.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/dao/PolicyDAO.java index a755a5c6b3..f5d7f4c238 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/dao/PolicyDAO.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/dao/PolicyDAO.java @@ -22,10 +22,10 @@ import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.PolicyPaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.CorrectiveAction; -import io.entgra.device.mgt.core.policy.mgt.common.Criterion; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.DeviceGroupWrapper; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Policy; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.PolicyCriterion; +import io.entgra.device.mgt.core.policy.mgt.common.Criterion; import java.util.HashMap; import java.util.List; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/dao/PolicyManagementDAOFactory.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/dao/PolicyManagementDAOFactory.java index 74b692543a..ea58d00b92 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/dao/PolicyManagementDAOFactory.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/dao/PolicyManagementDAOFactory.java @@ -18,8 +18,6 @@ package io.entgra.device.mgt.core.policy.mgt.core.dao; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; import io.entgra.device.mgt.core.device.mgt.common.exceptions.IllegalTransactionStateException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.UnsupportedDatabaseEngineException; @@ -35,6 +33,8 @@ import io.entgra.device.mgt.core.policy.mgt.core.dao.impl.policy.OraclePolicyDAO import io.entgra.device.mgt.core.policy.mgt.core.dao.impl.policy.PostgreSQLPolicyDAOImpl; import io.entgra.device.mgt.core.policy.mgt.core.dao.impl.policy.SQLServerPolicyDAOImpl; import io.entgra.device.mgt.core.policy.mgt.core.dao.util.PolicyManagementDAOUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import javax.sql.DataSource; import java.sql.Connection; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/dao/impl/MonitoringDAOImpl.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/dao/impl/MonitoringDAOImpl.java index 885c80bd41..a003fac641 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/dao/impl/MonitoringDAOImpl.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/dao/impl/MonitoringDAOImpl.java @@ -19,19 +19,19 @@ package io.entgra.device.mgt.core.policy.mgt.core.dao.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.ComplianceData; -import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.NonComplianceData; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.ComplianceFeature; +import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.NonComplianceData; import io.entgra.device.mgt.core.policy.mgt.common.monitor.PolicyDeviceWrapper; import io.entgra.device.mgt.core.policy.mgt.core.dao.MonitoringDAO; import io.entgra.device.mgt.core.policy.mgt.core.dao.MonitoringDAOException; import io.entgra.device.mgt.core.policy.mgt.core.dao.PolicyManagementDAOFactory; import io.entgra.device.mgt.core.policy.mgt.core.dao.util.PolicyManagementDAOUtil; import io.entgra.device.mgt.core.policy.mgt.core.util.PolicyManagerUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.PrivilegedCarbonContext; import java.sql.*; import java.util.*; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/dao/impl/ProfileDAOImpl.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/dao/impl/ProfileDAOImpl.java index 05bf17ed16..5845104f3b 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/dao/impl/ProfileDAOImpl.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/dao/impl/ProfileDAOImpl.java @@ -18,15 +18,14 @@ package io.entgra.device.mgt.core.policy.mgt.core.dao.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.device.mgt.common.DynamicTaskContext; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Profile; import io.entgra.device.mgt.core.policy.mgt.core.dao.PolicyManagementDAOFactory; import io.entgra.device.mgt.core.policy.mgt.core.dao.ProfileDAO; import io.entgra.device.mgt.core.policy.mgt.core.dao.ProfileManagerDAOException; import io.entgra.device.mgt.core.policy.mgt.core.dao.util.PolicyManagementDAOUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.PrivilegedCarbonContext; import java.sql.Connection; import java.sql.PreparedStatement; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/dao/impl/feature/AbstractFeatureDAO.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/dao/impl/feature/AbstractFeatureDAO.java index 71b4a3a728..7c1ac4d3f2 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/dao/impl/feature/AbstractFeatureDAO.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/dao/impl/feature/AbstractFeatureDAO.java @@ -18,9 +18,6 @@ package io.entgra.device.mgt.core.policy.mgt.core.dao.impl.feature; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.Feature; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Profile; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.ProfileFeature; @@ -29,6 +26,9 @@ import io.entgra.device.mgt.core.policy.mgt.core.dao.FeatureManagerDAOException; import io.entgra.device.mgt.core.policy.mgt.core.dao.PolicyManagementDAOFactory; import io.entgra.device.mgt.core.policy.mgt.core.dao.util.PolicyManagementDAOUtil; import io.entgra.device.mgt.core.policy.mgt.core.util.PolicyManagerUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.PrivilegedCarbonContext; import java.io.ByteArrayInputStream; import java.io.IOException; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/dao/impl/feature/GenericFeatureDAOImpl.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/dao/impl/feature/GenericFeatureDAOImpl.java index b9b1799e13..34d23a569a 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/dao/impl/feature/GenericFeatureDAOImpl.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/dao/impl/feature/GenericFeatureDAOImpl.java @@ -18,14 +18,14 @@ package io.entgra.device.mgt.core.policy.mgt.core.dao.impl.feature; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.ProfileFeature; import io.entgra.device.mgt.core.policy.mgt.core.dao.FeatureManagerDAOException; import io.entgra.device.mgt.core.policy.mgt.core.dao.PolicyManagementDAOFactory; import io.entgra.device.mgt.core.policy.mgt.core.dao.util.PolicyManagementDAOUtil; import io.entgra.device.mgt.core.policy.mgt.core.util.PolicyManagerUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.PrivilegedCarbonContext; import java.io.IOException; import java.sql.Connection; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/dao/impl/feature/OracleServerFeatureDAOImpl.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/dao/impl/feature/OracleServerFeatureDAOImpl.java index ee439bc07e..e9962c6cf7 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/dao/impl/feature/OracleServerFeatureDAOImpl.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/dao/impl/feature/OracleServerFeatureDAOImpl.java @@ -17,12 +17,12 @@ */ package io.entgra.device.mgt.core.policy.mgt.core.dao.impl.feature; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.ProfileFeature; import io.entgra.device.mgt.core.policy.mgt.core.dao.FeatureManagerDAOException; import io.entgra.device.mgt.core.policy.mgt.core.dao.PolicyManagementDAOFactory; import io.entgra.device.mgt.core.policy.mgt.core.dao.util.PolicyManagementDAOUtil; import io.entgra.device.mgt.core.policy.mgt.core.util.PolicyManagerUtil; +import org.wso2.carbon.context.PrivilegedCarbonContext; import java.io.IOException; import java.sql.Connection; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/dao/impl/feature/SQLServerFeatureDAOImpl.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/dao/impl/feature/SQLServerFeatureDAOImpl.java index 617867ef8b..1237236174 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/dao/impl/feature/SQLServerFeatureDAOImpl.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/dao/impl/feature/SQLServerFeatureDAOImpl.java @@ -18,14 +18,14 @@ package io.entgra.device.mgt.core.policy.mgt.core.dao.impl.feature; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.ProfileFeature; import io.entgra.device.mgt.core.policy.mgt.core.dao.FeatureManagerDAOException; import io.entgra.device.mgt.core.policy.mgt.core.dao.PolicyManagementDAOFactory; import io.entgra.device.mgt.core.policy.mgt.core.dao.util.PolicyManagementDAOUtil; import io.entgra.device.mgt.core.policy.mgt.core.util.PolicyManagerUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.PrivilegedCarbonContext; import java.io.IOException; import java.sql.Connection; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/dao/impl/policy/AbstractPolicyDAOImpl.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/dao/impl/policy/AbstractPolicyDAOImpl.java index 85bd77d859..71960551ef 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/dao/impl/policy/AbstractPolicyDAOImpl.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/dao/impl/policy/AbstractPolicyDAOImpl.java @@ -18,9 +18,6 @@ package io.entgra.device.mgt.core.policy.mgt.core.dao.impl.policy; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.CorrectiveAction; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.DeviceGroupWrapper; @@ -33,21 +30,15 @@ import io.entgra.device.mgt.core.policy.mgt.core.dao.PolicyManagerDAOException; import io.entgra.device.mgt.core.policy.mgt.core.dao.util.PolicyManagementDAOUtil; import io.entgra.device.mgt.core.policy.mgt.core.util.PolicyManagerUtil; import io.entgra.device.mgt.core.policy.mgt.core.util.SetReferenceTransformer; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.PrivilegedCarbonContext; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.ObjectInputStream; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Timestamp; -import java.sql.Types; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.HashMap; -import java.util.List; -import java.util.Properties; +import java.sql.*; +import java.util.*; /** * Abstract implementation of PolicyDAO which holds generic SQL queries. diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/enforcement/DelegationTask.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/enforcement/DelegationTask.java index c1bdd4fba7..d9a8f02d09 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/enforcement/DelegationTask.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/enforcement/DelegationTask.java @@ -18,8 +18,6 @@ package io.entgra.device.mgt.core.policy.mgt.core.enforcement; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; @@ -33,6 +31,8 @@ import io.entgra.device.mgt.core.policy.mgt.core.internal.PolicyManagementDataHo import io.entgra.device.mgt.core.policy.mgt.core.mgt.PolicyManager; import io.entgra.device.mgt.core.policy.mgt.core.mgt.bean.UpdatedPolicyDeviceListBean; import io.entgra.device.mgt.core.policy.mgt.core.mgt.impl.PolicyManagerImpl; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.util.ArrayList; import java.util.List; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/enforcement/PolicyEnforcementDelegatorImpl.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/enforcement/PolicyEnforcementDelegatorImpl.java index bbb8413ad6..a56eee3ab2 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/enforcement/PolicyEnforcementDelegatorImpl.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/enforcement/PolicyEnforcementDelegatorImpl.java @@ -17,8 +17,6 @@ */ package io.entgra.device.mgt.core.policy.mgt.core.enforcement; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.exceptions.InvalidDeviceException; @@ -36,6 +34,8 @@ import io.entgra.device.mgt.core.policy.mgt.common.PolicyTransformException; import io.entgra.device.mgt.core.policy.mgt.core.PolicyManagerService; import io.entgra.device.mgt.core.policy.mgt.core.internal.PolicyManagementDataHolder; import io.entgra.device.mgt.core.policy.mgt.core.util.PolicyManagerUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.util.ArrayList; import java.util.List; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/impl/ComplianceDecisionPointImpl.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/impl/ComplianceDecisionPointImpl.java index 07380972d2..7767844778 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/impl/ComplianceDecisionPointImpl.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/impl/ComplianceDecisionPointImpl.java @@ -19,24 +19,26 @@ package io.entgra.device.mgt.core.policy.mgt.core.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.device.mgt.common.*; +import io.entgra.device.mgt.core.device.mgt.common.Device; +import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; +import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.InvalidDeviceException; import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Operation; import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.OperationManagementException; -import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.PolicyOperation; -import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.ProfileOperation; -import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Policy; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.ProfileFeature; -import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.NonComplianceData; -import io.entgra.device.mgt.core.policy.mgt.common.monitor.ComplianceDecisionPoint; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.ComplianceFeature; +import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.NonComplianceData; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.PolicyComplianceException; +import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.PolicyOperation; +import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.ProfileOperation; +import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; +import io.entgra.device.mgt.core.policy.mgt.common.monitor.ComplianceDecisionPoint; import io.entgra.device.mgt.core.policy.mgt.core.internal.PolicyManagementDataHolder; import io.entgra.device.mgt.core.policy.mgt.core.util.PolicyManagementConstants; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.util.ArrayList; import java.util.List; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/impl/PolicyAdministratorPointImpl.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/impl/PolicyAdministratorPointImpl.java index 2521eab3a1..b07f311ce1 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/impl/PolicyAdministratorPointImpl.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/impl/PolicyAdministratorPointImpl.java @@ -23,17 +23,14 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; -import io.entgra.device.mgt.core.device.mgt.common.DynamicTaskContext; import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Policy; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Profile; import io.entgra.device.mgt.core.device.mgt.core.config.DeviceConfigurationManager; import io.entgra.device.mgt.core.device.mgt.core.config.policy.PolicyConfiguration; -import org.wso2.carbon.ntask.common.TaskException; -import org.wso2.carbon.ntask.core.TaskInfo; -import org.wso2.carbon.ntask.core.TaskManager; -import org.wso2.carbon.ntask.core.service.TaskService; -import io.entgra.device.mgt.core.policy.mgt.common.*; +import io.entgra.device.mgt.core.policy.mgt.common.PolicyAdministratorPoint; +import io.entgra.device.mgt.core.policy.mgt.common.PolicyManagementException; +import io.entgra.device.mgt.core.policy.mgt.common.ProfileManagementException; import io.entgra.device.mgt.core.policy.mgt.core.cache.PolicyCacheManager; import io.entgra.device.mgt.core.policy.mgt.core.cache.impl.PolicyCacheManagerImpl; import io.entgra.device.mgt.core.policy.mgt.core.internal.PolicyManagementDataHolder; @@ -42,6 +39,13 @@ import io.entgra.device.mgt.core.policy.mgt.core.mgt.ProfileManager; import io.entgra.device.mgt.core.policy.mgt.core.mgt.impl.PolicyManagerImpl; import io.entgra.device.mgt.core.policy.mgt.core.mgt.impl.ProfileManagerImpl; import io.entgra.device.mgt.core.policy.mgt.core.util.PolicyManagementConstants; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.PrivilegedCarbonContext; +import org.wso2.carbon.ntask.common.TaskException; +import org.wso2.carbon.ntask.core.TaskInfo; +import org.wso2.carbon.ntask.core.TaskManager; +import org.wso2.carbon.ntask.core.service.TaskService; import java.util.HashMap; import java.util.List; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/impl/PolicyFilterImpl.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/impl/PolicyFilterImpl.java index 6d856d049b..94a5082c1a 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/impl/PolicyFilterImpl.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/impl/PolicyFilterImpl.java @@ -19,13 +19,13 @@ package io.entgra.device.mgt.core.policy.mgt.core.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.DeviceGroupWrapper; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Policy; import io.entgra.device.mgt.core.policy.mgt.common.PolicyFilter; import io.entgra.device.mgt.core.policy.mgt.core.util.PolicyManagementConstants; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.util.ArrayList; import java.util.HashMap; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/impl/PolicyInformationPointImpl.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/impl/PolicyInformationPointImpl.java index 657a2bd923..6b164e2803 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/impl/PolicyInformationPointImpl.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/impl/PolicyInformationPointImpl.java @@ -18,9 +18,6 @@ package io.entgra.device.mgt.core.policy.mgt.core.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.CarbonContext; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.Feature; @@ -31,16 +28,15 @@ import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Policy; import io.entgra.device.mgt.core.device.mgt.core.dto.DeviceType; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; import io.entgra.device.mgt.core.device.mgt.core.service.GroupManagementProviderService; -import io.entgra.device.mgt.core.policy.mgt.common.FeatureManagementException; -import io.entgra.device.mgt.core.policy.mgt.common.PIPDevice; -import io.entgra.device.mgt.core.policy.mgt.common.PolicyFilter; -import io.entgra.device.mgt.core.policy.mgt.common.PolicyInformationPoint; -import io.entgra.device.mgt.core.policy.mgt.common.PolicyManagementException; +import io.entgra.device.mgt.core.policy.mgt.common.*; import io.entgra.device.mgt.core.policy.mgt.core.internal.PolicyManagementDataHolder; import io.entgra.device.mgt.core.policy.mgt.core.mgt.FeatureManager; import io.entgra.device.mgt.core.policy.mgt.core.mgt.PolicyManager; import io.entgra.device.mgt.core.policy.mgt.core.mgt.impl.FeatureManagerImpl; import io.entgra.device.mgt.core.policy.mgt.core.mgt.impl.PolicyManagerImpl; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.user.api.UserRealm; import org.wso2.carbon.user.api.UserStoreException; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/internal/PolicyManagementDataHolder.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/internal/PolicyManagementDataHolder.java index 27965ba21e..eb1e8f960d 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/internal/PolicyManagementDataHolder.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/internal/PolicyManagementDataHolder.java @@ -18,17 +18,17 @@ package io.entgra.device.mgt.core.policy.mgt.core.internal; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.core.config.DeviceConfigurationManager; import io.entgra.device.mgt.core.device.mgt.core.config.policy.PolicyConfiguration; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; import io.entgra.device.mgt.core.device.mgt.core.service.GroupManagementProviderService; -import org.wso2.carbon.ntask.core.service.TaskService; import io.entgra.device.mgt.core.policy.mgt.common.PolicyEvaluationPoint; import io.entgra.device.mgt.core.policy.mgt.common.PolicyInformationPoint; import io.entgra.device.mgt.core.policy.mgt.core.PolicyManagerService; import io.entgra.device.mgt.core.policy.mgt.core.mgt.MonitoringManager; import io.entgra.device.mgt.core.policy.mgt.core.mgt.PolicyManager; +import org.wso2.carbon.context.PrivilegedCarbonContext; +import org.wso2.carbon.ntask.core.service.TaskService; import org.wso2.carbon.user.core.service.RealmService; import java.util.HashMap; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/internal/PolicyManagementServiceComponent.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/internal/PolicyManagementServiceComponent.java index 05bb07ee70..e9b7489428 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/internal/PolicyManagementServiceComponent.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/internal/PolicyManagementServiceComponent.java @@ -18,13 +18,9 @@ package io.entgra.device.mgt.core.policy.mgt.core.internal; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.osgi.service.component.ComponentContext; import io.entgra.device.mgt.core.device.mgt.core.config.DeviceConfigurationManager; import io.entgra.device.mgt.core.device.mgt.core.config.policy.PolicyConfiguration; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; -import org.wso2.carbon.ntask.core.service.TaskService; import io.entgra.device.mgt.core.policy.mgt.common.PolicyEvaluationPoint; import io.entgra.device.mgt.core.policy.mgt.core.PolicyManagerService; import io.entgra.device.mgt.core.policy.mgt.core.PolicyManagerServiceImpl; @@ -35,40 +31,22 @@ import io.entgra.device.mgt.core.policy.mgt.core.dao.PolicyManagementDAOFactory; import io.entgra.device.mgt.core.policy.mgt.core.task.TaskScheduleService; import io.entgra.device.mgt.core.policy.mgt.core.task.TaskScheduleServiceImpl; import io.entgra.device.mgt.core.policy.mgt.core.util.PolicyManagerUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.*; +import org.wso2.carbon.ntask.core.service.TaskService; import org.wso2.carbon.user.core.service.RealmService; -/** - * @scr.component name="org.wso2.carbon.devicemgt.policy.manager" immediate="true" - * @scr.reference name="user.realmservice.default" - * interface="org.wso2.carbon.user.core.service.RealmService" - * cardinality="1..1" - * policy="dynamic" - * bind="setRealmService" - * unbind="unsetRealmService" - * @scr.reference name="org.wso2.carbon.devicemgt.policy.evaluation.manager" - * interface="io.entgra.device.mgt.core.policy.mgt.common.PolicyEvaluationPoint" - * cardinality="1..n" - * policy="dynamic" - * bind="setPEPService" - * unbind="unsetPEPService" - * @scr.reference name="org.wso2.carbon.device.manager" - * interface="io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService" - * cardinality="1..1" - * policy="dynamic" - * bind="setDeviceManagementService" - * unbind="unsetDeviceManagementService" - * @scr.reference name="ntask.component" - * interface="org.wso2.carbon.ntask.core.service.TaskService" - * cardinality="1..1" - * policy="dynamic" - * bind="setTaskService" - * unbind="unsetTaskService" - */ @SuppressWarnings("unused") +@Component( + name = "io.entgra.device.mgt.core.policy.mgt.core.internal.PolicyManagementServiceComponent", + immediate = true) public class PolicyManagementServiceComponent { private static final Log log = LogFactory.getLog(PolicyManagementServiceComponent.class); + @Activate protected void activate(ComponentContext componentContext) { try { @@ -95,6 +73,7 @@ public class PolicyManagementServiceComponent { } @SuppressWarnings("unused") + @Deactivate protected void deactivate(ComponentContext componentContext) { try { PolicyConfiguration policyConfiguration = @@ -114,6 +93,12 @@ public class PolicyManagementServiceComponent { * * @param realmService An instance of RealmService */ + @Reference( + name = "realm.service", + service = org.wso2.carbon.user.core.service.RealmService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRealmService") protected void setRealmService(RealmService realmService) { if (log.isDebugEnabled()) { @@ -149,7 +134,12 @@ public class PolicyManagementServiceComponent { PolicyManagementDataHolder.getInstance().setPolicyInformationPoint(null); }*/ - + @Reference( + name = "pep.service", + service = io.entgra.device.mgt.core.policy.mgt.common.PolicyEvaluationPoint.class, + cardinality = ReferenceCardinality.MULTIPLE, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetPEPService") protected void setPEPService(PolicyEvaluationPoint pepService) { if (log.isDebugEnabled()) { log.debug("Setting Policy Information Service"); @@ -164,6 +154,12 @@ public class PolicyManagementServiceComponent { PolicyManagementDataHolder.getInstance().removePolicyEvaluationPoint(pepService); } + @Reference( + name = "device.mgt.provider.service", + service = io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetDeviceManagementService") protected void setDeviceManagementService(DeviceManagementProviderService deviceManagerService) { if (log.isDebugEnabled()) { log.debug("Setting Device Management Service"); @@ -178,6 +174,12 @@ public class PolicyManagementServiceComponent { PolicyManagementDataHolder.getInstance().setDeviceManagementService(null); } + @Reference( + name = "task.service", + service = org.wso2.carbon.ntask.core.service.TaskService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetTaskService") protected void setTaskService(TaskService taskService) { if (log.isDebugEnabled()) { log.debug("Setting the task service."); diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/mgt/MonitoringManager.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/mgt/MonitoringManager.java index 96356359c5..d62d3536ae 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/mgt/MonitoringManager.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/mgt/MonitoringManager.java @@ -22,8 +22,8 @@ import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.PaginationResult; -import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.NonComplianceData; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.ComplianceFeature; +import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.NonComplianceData; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.PolicyComplianceException; import java.util.List; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/mgt/PolicyManager.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/mgt/PolicyManager.java index abecb53712..dc066033ce 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/mgt/PolicyManager.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/mgt/PolicyManager.java @@ -19,7 +19,6 @@ package io.entgra.device.mgt.core.policy.mgt.core.mgt; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; -import io.entgra.device.mgt.core.device.mgt.common.DynamicTaskContext; import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.PolicyPaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Policy; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/mgt/impl/FeatureManagerImpl.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/mgt/impl/FeatureManagerImpl.java index 23c8d2e629..ea4e71f526 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/mgt/impl/FeatureManagerImpl.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/mgt/impl/FeatureManagerImpl.java @@ -18,19 +18,14 @@ package io.entgra.device.mgt.core.policy.mgt.core.mgt.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.Feature; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Profile; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.ProfileFeature; import io.entgra.device.mgt.core.policy.mgt.common.FeatureManagementException; -import io.entgra.device.mgt.core.policy.mgt.core.dao.FeatureDAO; -import io.entgra.device.mgt.core.policy.mgt.core.dao.FeatureManagerDAOException; -import io.entgra.device.mgt.core.policy.mgt.core.dao.PolicyManagementDAOFactory; -import io.entgra.device.mgt.core.policy.mgt.core.dao.PolicyManagerDAOException; -import io.entgra.device.mgt.core.policy.mgt.core.dao.ProfileDAO; -import io.entgra.device.mgt.core.policy.mgt.core.dao.ProfileManagerDAOException; +import io.entgra.device.mgt.core.policy.mgt.core.dao.*; import io.entgra.device.mgt.core.policy.mgt.core.mgt.FeatureManager; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.sql.SQLException; import java.util.List; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/mgt/impl/MonitoringManagerImpl.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/mgt/impl/MonitoringManagerImpl.java index cc451c10d5..a93662775d 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/mgt/impl/MonitoringManagerImpl.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/mgt/impl/MonitoringManagerImpl.java @@ -18,8 +18,6 @@ package io.entgra.device.mgt.core.policy.mgt.core.mgt.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; @@ -40,15 +38,13 @@ import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProvide import io.entgra.device.mgt.core.policy.mgt.common.PolicyManagementException; import io.entgra.device.mgt.core.policy.mgt.common.monitor.ComplianceDecisionPoint; import io.entgra.device.mgt.core.policy.mgt.common.monitor.PolicyDeviceWrapper; -import io.entgra.device.mgt.core.policy.mgt.core.dao.MonitoringDAO; -import io.entgra.device.mgt.core.policy.mgt.core.dao.MonitoringDAOException; -import io.entgra.device.mgt.core.policy.mgt.core.dao.PolicyDAO; -import io.entgra.device.mgt.core.policy.mgt.core.dao.PolicyManagementDAOFactory; -import io.entgra.device.mgt.core.policy.mgt.core.dao.PolicyManagerDAOException; +import io.entgra.device.mgt.core.policy.mgt.core.dao.*; import io.entgra.device.mgt.core.policy.mgt.core.impl.ComplianceDecisionPointImpl; import io.entgra.device.mgt.core.policy.mgt.core.internal.PolicyManagementDataHolder; import io.entgra.device.mgt.core.policy.mgt.core.mgt.MonitoringManager; import io.entgra.device.mgt.core.policy.mgt.core.mgt.PolicyManager; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.sql.SQLException; import java.util.ArrayList; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/mgt/impl/PolicyManagerImpl.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/mgt/impl/PolicyManagerImpl.java index fd5b3b5fdb..5cc0dc35b8 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/mgt/impl/PolicyManagerImpl.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/mgt/impl/PolicyManagerImpl.java @@ -18,26 +18,16 @@ package io.entgra.device.mgt.core.policy.mgt.core.mgt.impl; -import io.entgra.device.mgt.core.device.mgt.common.PolicyPaginationRequest; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; -import io.entgra.device.mgt.core.device.mgt.common.DynamicTaskContext; -import io.entgra.device.mgt.core.device.mgt.common.PaginationRequest; +import io.entgra.device.mgt.core.device.mgt.common.PolicyPaginationRequest; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.common.exceptions.InvalidDeviceException; import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup; import io.entgra.device.mgt.core.device.mgt.common.group.mgt.GroupManagementException; import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Operation; import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.OperationManagementException; -import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.CorrectiveAction; -import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.DeviceGroupWrapper; -import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Policy; -import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.PolicyCriterion; -import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Profile; -import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.ProfileFeature; +import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.*; import io.entgra.device.mgt.core.device.mgt.core.config.DeviceConfigurationManager; import io.entgra.device.mgt.core.device.mgt.core.config.policy.PolicyConfiguration; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.CommandOperation; @@ -48,28 +38,20 @@ import io.entgra.device.mgt.core.policy.mgt.common.Criterion; import io.entgra.device.mgt.core.policy.mgt.common.PolicyManagementException; import io.entgra.device.mgt.core.policy.mgt.common.ProfileManagementException; import io.entgra.device.mgt.core.policy.mgt.core.cache.impl.PolicyCacheManagerImpl; -import io.entgra.device.mgt.core.policy.mgt.core.dao.FeatureDAO; -import io.entgra.device.mgt.core.policy.mgt.core.dao.FeatureManagerDAOException; -import io.entgra.device.mgt.core.policy.mgt.core.dao.PolicyDAO; -import io.entgra.device.mgt.core.policy.mgt.core.dao.PolicyManagementDAOFactory; -import io.entgra.device.mgt.core.policy.mgt.core.dao.PolicyManagerDAOException; -import io.entgra.device.mgt.core.policy.mgt.core.dao.ProfileDAO; -import io.entgra.device.mgt.core.policy.mgt.core.dao.ProfileManagerDAOException; +import io.entgra.device.mgt.core.policy.mgt.core.dao.*; import io.entgra.device.mgt.core.policy.mgt.core.internal.PolicyManagementDataHolder; import io.entgra.device.mgt.core.policy.mgt.core.mgt.PolicyManager; import io.entgra.device.mgt.core.policy.mgt.core.mgt.ProfileManager; import io.entgra.device.mgt.core.policy.mgt.core.mgt.bean.UpdatedPolicyDeviceListBean; import io.entgra.device.mgt.core.policy.mgt.core.util.PolicyManagementConstants; import io.entgra.device.mgt.core.policy.mgt.core.util.PolicyManagerUtil; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.sql.SQLException; import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; public class PolicyManagerImpl implements PolicyManager { @@ -1445,7 +1427,7 @@ public class PolicyManagerImpl implements PolicyManager { * @return */ private List getSingleCorrectiveAction - (List allCorrectiveActions, int policyId) { + (List allCorrectiveActions, int policyId) { List correctiveActionsOfPolicy = new ArrayList<>(); for (CorrectiveAction correctiveAction : allCorrectiveActions) { if (correctiveAction.getAssociatedGeneralPolicyId() != null && diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/mgt/impl/ProfileManagerImpl.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/mgt/impl/ProfileManagerImpl.java index 96979f7aca..f41ea1ffa1 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/mgt/impl/ProfileManagerImpl.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/mgt/impl/ProfileManagerImpl.java @@ -18,19 +18,13 @@ package io.entgra.device.mgt.core.policy.mgt.core.mgt.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.device.mgt.common.DynamicTaskContext; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Profile; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.ProfileFeature; import io.entgra.device.mgt.core.policy.mgt.common.ProfileManagementException; -import io.entgra.device.mgt.core.policy.mgt.core.dao.FeatureDAO; -import io.entgra.device.mgt.core.policy.mgt.core.dao.FeatureManagerDAOException; -import io.entgra.device.mgt.core.policy.mgt.core.dao.PolicyManagementDAOFactory; -import io.entgra.device.mgt.core.policy.mgt.core.dao.PolicyManagerDAOException; -import io.entgra.device.mgt.core.policy.mgt.core.dao.ProfileDAO; -import io.entgra.device.mgt.core.policy.mgt.core.dao.ProfileManagerDAOException; +import io.entgra.device.mgt.core.policy.mgt.core.dao.*; import io.entgra.device.mgt.core.policy.mgt.core.mgt.ProfileManager; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.sql.SQLException; import java.sql.Timestamp; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/task/MonitoringTask.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/task/MonitoringTask.java index 8836b00892..310aacfd33 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/task/MonitoringTask.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/task/MonitoringTask.java @@ -18,10 +18,6 @@ package io.entgra.device.mgt.core.policy.mgt.core.task; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.base.MultitenantConstants; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.PolicyMonitoringManager; @@ -31,6 +27,10 @@ import io.entgra.device.mgt.core.device.mgt.core.task.impl.DynamicPartitionedSch import io.entgra.device.mgt.core.policy.mgt.core.internal.PolicyManagementDataHolder; import io.entgra.device.mgt.core.policy.mgt.core.mgt.MonitoringManager; import io.entgra.device.mgt.core.policy.mgt.core.util.PolicyManagementConstants; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.base.MultitenantConstants; +import org.wso2.carbon.context.PrivilegedCarbonContext; import java.util.ArrayList; import java.util.List; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/task/TaskScheduleServiceImpl.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/task/TaskScheduleServiceImpl.java index c6fd1fd469..5a20f38cef 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/task/TaskScheduleServiceImpl.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/task/TaskScheduleServiceImpl.java @@ -19,19 +19,19 @@ package io.entgra.device.mgt.core.policy.mgt.core.task; +import io.entgra.device.mgt.core.device.mgt.core.config.DeviceConfigurationManager; +import io.entgra.device.mgt.core.device.mgt.core.config.policy.PolicyConfiguration; +import io.entgra.device.mgt.core.policy.mgt.common.PolicyMonitoringTaskException; +import io.entgra.device.mgt.core.policy.mgt.core.internal.PolicyManagementDataHolder; +import io.entgra.device.mgt.core.policy.mgt.core.util.PolicyManagementConstants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.device.mgt.core.config.DeviceConfigurationManager; -import io.entgra.device.mgt.core.device.mgt.core.config.policy.PolicyConfiguration; import org.wso2.carbon.ntask.common.TaskException; import org.wso2.carbon.ntask.core.TaskInfo; +import org.wso2.carbon.ntask.core.TaskInfo.TriggerInfo; import org.wso2.carbon.ntask.core.TaskManager; import org.wso2.carbon.ntask.core.service.TaskService; -import io.entgra.device.mgt.core.policy.mgt.common.PolicyMonitoringTaskException; -import io.entgra.device.mgt.core.policy.mgt.core.internal.PolicyManagementDataHolder; -import io.entgra.device.mgt.core.policy.mgt.core.util.PolicyManagementConstants; -import org.wso2.carbon.ntask.core.TaskInfo.TriggerInfo; import java.util.HashMap; import java.util.Map; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/util/PolicyManagerUtil.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/util/PolicyManagerUtil.java index 0bd3c36396..6d7b220f45 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/util/PolicyManagerUtil.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/main/java/io/entgra/device/mgt/core/policy/mgt/core/util/PolicyManagerUtil.java @@ -19,13 +19,6 @@ package io.entgra.device.mgt.core.policy.mgt.core.util; import com.google.gson.Gson; -import org.apache.commons.lang.StringUtils; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.w3c.dom.Document; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.ConfigurationEntry; import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.ConfigurationManagementException; @@ -34,20 +27,24 @@ import io.entgra.device.mgt.core.device.mgt.common.configuration.mgt.PlatformCon import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup; import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.Operation; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.CorrectiveAction; +import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Policy; +import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.ProfileFeature; import io.entgra.device.mgt.core.device.mgt.core.config.DeviceConfigurationManager; import io.entgra.device.mgt.core.device.mgt.core.config.policy.PolicyConfiguration; import io.entgra.device.mgt.core.device.mgt.core.config.tenant.PlatformConfigurationManagementServiceImpl; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.PolicyOperation; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.ProfileOperation; -import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Policy; import io.entgra.device.mgt.core.policy.mgt.common.PolicyAdministratorPoint; import io.entgra.device.mgt.core.policy.mgt.common.PolicyManagementException; -import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.ProfileFeature; import io.entgra.device.mgt.core.policy.mgt.common.PolicyTransformException; import io.entgra.device.mgt.core.policy.mgt.core.config.datasource.DataSourceConfig; import io.entgra.device.mgt.core.policy.mgt.core.config.datasource.JNDILookupDefinition; import io.entgra.device.mgt.core.policy.mgt.core.dao.util.PolicyManagementDAOUtil; import io.entgra.device.mgt.core.policy.mgt.core.impl.PolicyAdministratorPointImpl; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.w3c.dom.Document; import javax.cache.Cache; import javax.cache.CacheManager; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/BasePolicyManagementDAOTest.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/BasePolicyManagementDAOTest.java index 0e58ef2c11..af0cddd87f 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/BasePolicyManagementDAOTest.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/BasePolicyManagementDAOTest.java @@ -17,24 +17,6 @@ */ package io.entgra.device.mgt.core.policy.mgt.core; -import io.entgra.device.mgt.core.policy.mgt.common.PolicyEvaluationPoint; -import io.entgra.device.mgt.core.policy.mgt.common.PolicyManagementException; -import io.entgra.device.mgt.core.policy.mgt.core.common.DataSourceConfig; -import io.entgra.device.mgt.core.policy.mgt.core.dao.PolicyManagementDAOFactory; -import io.entgra.device.mgt.core.policy.mgt.core.internal.PolicyManagementDataHolder; -import io.entgra.device.mgt.core.policy.mgt.core.mgt.ProfileManager; -import io.entgra.device.mgt.core.policy.mgt.core.mgt.impl.ProfileManagerImpl; -import io.entgra.device.mgt.core.policy.mgt.core.services.SimplePolicyEvaluationTest; -import io.entgra.device.mgt.core.policy.mgt.core.util.PolicyManagerUtil; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.tomcat.jdbc.pool.PoolProperties; -import org.testng.Assert; -import org.testng.annotations.BeforeSuite; -import org.testng.internal.collections.Pair; -import org.w3c.dom.Document; -import org.wso2.carbon.base.MultitenantConstants; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; @@ -56,6 +38,24 @@ import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProvide import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderServiceImpl; import io.entgra.device.mgt.core.device.mgt.core.service.GroupManagementProviderService; import io.entgra.device.mgt.core.device.mgt.core.service.GroupManagementProviderServiceImpl; +import io.entgra.device.mgt.core.policy.mgt.common.PolicyEvaluationPoint; +import io.entgra.device.mgt.core.policy.mgt.common.PolicyManagementException; +import io.entgra.device.mgt.core.policy.mgt.core.common.DataSourceConfig; +import io.entgra.device.mgt.core.policy.mgt.core.dao.PolicyManagementDAOFactory; +import io.entgra.device.mgt.core.policy.mgt.core.internal.PolicyManagementDataHolder; +import io.entgra.device.mgt.core.policy.mgt.core.mgt.ProfileManager; +import io.entgra.device.mgt.core.policy.mgt.core.mgt.impl.ProfileManagerImpl; +import io.entgra.device.mgt.core.policy.mgt.core.services.SimplePolicyEvaluationTest; +import io.entgra.device.mgt.core.policy.mgt.core.util.PolicyManagerUtil; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.tomcat.jdbc.pool.PoolProperties; +import org.testng.Assert; +import org.testng.annotations.BeforeSuite; +import org.testng.internal.collections.Pair; +import org.w3c.dom.Document; +import org.wso2.carbon.base.MultitenantConstants; +import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.registry.core.config.RegistryContext; import org.wso2.carbon.registry.core.exceptions.RegistryException; import org.wso2.carbon.registry.core.internal.RegistryDataHolder; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/MonitoringTestCase.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/MonitoringTestCase.java index 89ed6d8df9..8758454341 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/MonitoringTestCase.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/MonitoringTestCase.java @@ -19,17 +19,6 @@ package io.entgra.device.mgt.core.policy.mgt.core; -import io.entgra.device.mgt.core.policy.mgt.common.PolicyManagementException; -import io.entgra.device.mgt.core.policy.mgt.core.internal.PolicyManagementDataHolder; -import io.entgra.device.mgt.core.policy.mgt.core.mgt.MonitoringManager; -import io.entgra.device.mgt.core.policy.mgt.core.mgt.PolicyManager; -import io.entgra.device.mgt.core.policy.mgt.core.mgt.impl.MonitoringManagerImpl; -import io.entgra.device.mgt.core.policy.mgt.core.mgt.impl.PolicyManagerImpl; -import io.entgra.device.mgt.core.policy.mgt.core.services.PolicyMonitoringManagerTest; -import junit.framework.Assert; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.testng.annotations.Test; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; @@ -42,6 +31,17 @@ import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.OperationManagerI import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderServiceImpl; import io.entgra.device.mgt.core.device.mgt.core.service.GroupManagementProviderServiceImpl; +import io.entgra.device.mgt.core.policy.mgt.common.PolicyManagementException; +import io.entgra.device.mgt.core.policy.mgt.core.internal.PolicyManagementDataHolder; +import io.entgra.device.mgt.core.policy.mgt.core.mgt.MonitoringManager; +import io.entgra.device.mgt.core.policy.mgt.core.mgt.PolicyManager; +import io.entgra.device.mgt.core.policy.mgt.core.mgt.impl.MonitoringManagerImpl; +import io.entgra.device.mgt.core.policy.mgt.core.mgt.impl.PolicyManagerImpl; +import io.entgra.device.mgt.core.policy.mgt.core.services.PolicyMonitoringManagerTest; +import junit.framework.Assert; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.testng.annotations.Test; import java.util.List; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/PolicyDAOTestCase.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/PolicyDAOTestCase.java index d31916cf74..cc32493c6a 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/PolicyDAOTestCase.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/PolicyDAOTestCase.java @@ -17,18 +17,6 @@ */ package io.entgra.device.mgt.core.policy.mgt.core; -import io.entgra.device.mgt.core.policy.mgt.common.FeatureManagementException; -import io.entgra.device.mgt.core.policy.mgt.common.PolicyAdministratorPoint; -import io.entgra.device.mgt.core.policy.mgt.common.PolicyManagementException; -import io.entgra.device.mgt.core.policy.mgt.common.ProfileManagementException; -import io.entgra.device.mgt.core.policy.mgt.core.impl.PolicyAdministratorPointImpl; -import io.entgra.device.mgt.core.policy.mgt.core.internal.PolicyManagementDataHolder; -import io.entgra.device.mgt.core.policy.mgt.core.util.*; -import junit.framework.Assert; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.Feature; @@ -42,6 +30,18 @@ import io.entgra.device.mgt.core.device.mgt.core.dao.*; import io.entgra.device.mgt.core.device.mgt.core.dto.DeviceType; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderServiceImpl; +import io.entgra.device.mgt.core.policy.mgt.common.FeatureManagementException; +import io.entgra.device.mgt.core.policy.mgt.common.PolicyAdministratorPoint; +import io.entgra.device.mgt.core.policy.mgt.common.PolicyManagementException; +import io.entgra.device.mgt.core.policy.mgt.common.ProfileManagementException; +import io.entgra.device.mgt.core.policy.mgt.core.impl.PolicyAdministratorPointImpl; +import io.entgra.device.mgt.core.policy.mgt.core.internal.PolicyManagementDataHolder; +import io.entgra.device.mgt.core.policy.mgt.core.util.*; +import junit.framework.Assert; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; import java.util.ArrayList; import java.util.List; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/PolicyEvaluationTestCase.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/PolicyEvaluationTestCase.java index 36f4604c4b..608af3b541 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/PolicyEvaluationTestCase.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/PolicyEvaluationTestCase.java @@ -19,6 +19,12 @@ package io.entgra.device.mgt.core.policy.mgt.core; +import io.entgra.device.mgt.core.device.mgt.common.Device; +import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; +import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Policy; +import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; +import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderServiceImpl; import io.entgra.device.mgt.core.policy.mgt.common.PolicyAdministratorPoint; import io.entgra.device.mgt.core.policy.mgt.common.PolicyEvaluationException; import io.entgra.device.mgt.core.policy.mgt.common.PolicyEvaluationPoint; @@ -31,12 +37,6 @@ import org.apache.commons.logging.LogFactory; import org.testng.annotations.BeforeClass; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; -import io.entgra.device.mgt.core.device.mgt.common.Device; -import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; -import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Policy; -import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; -import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderServiceImpl; import org.wso2.carbon.ntask.common.TaskException; import java.util.Collections; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/PolicyManagerServiceImplTest.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/PolicyManagerServiceImplTest.java index 8158bb8052..37cec7717a 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/PolicyManagerServiceImplTest.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/PolicyManagerServiceImplTest.java @@ -17,26 +17,6 @@ */ package io.entgra.device.mgt.core.policy.mgt.core; -import io.entgra.device.mgt.core.policy.mgt.common.FeatureManagementException; -import io.entgra.device.mgt.core.policy.mgt.common.PolicyEvaluationException; -import io.entgra.device.mgt.core.policy.mgt.common.PolicyEvaluationPoint; -import io.entgra.device.mgt.core.policy.mgt.common.PolicyManagementException; -import io.entgra.device.mgt.core.policy.mgt.core.enforcement.DelegationTask; -import io.entgra.device.mgt.core.policy.mgt.core.internal.PolicyManagementDataHolder; -import io.entgra.device.mgt.core.policy.mgt.core.mgt.MonitoringManager; -import io.entgra.device.mgt.core.policy.mgt.core.mgt.impl.MonitoringManagerImpl; -import io.entgra.device.mgt.core.policy.mgt.core.mock.TestHeartBeatManagementService; -import io.entgra.device.mgt.core.policy.mgt.core.mock.TypeXDeviceManagementService; -import io.entgra.device.mgt.core.policy.mgt.core.task.MonitoringTask; -import io.entgra.device.mgt.core.policy.mgt.core.task.TaskScheduleService; -import io.entgra.device.mgt.core.policy.mgt.core.util.PolicyManagementConstants; -import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service.HeartBeatManagementService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.testng.Assert; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.common.Device; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; @@ -59,6 +39,26 @@ import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHo import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.OperationManagerImpl; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.PolicyOperation; import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.ProfileOperation; +import io.entgra.device.mgt.core.policy.mgt.common.FeatureManagementException; +import io.entgra.device.mgt.core.policy.mgt.common.PolicyEvaluationException; +import io.entgra.device.mgt.core.policy.mgt.common.PolicyEvaluationPoint; +import io.entgra.device.mgt.core.policy.mgt.common.PolicyManagementException; +import io.entgra.device.mgt.core.policy.mgt.core.enforcement.DelegationTask; +import io.entgra.device.mgt.core.policy.mgt.core.internal.PolicyManagementDataHolder; +import io.entgra.device.mgt.core.policy.mgt.core.mgt.MonitoringManager; +import io.entgra.device.mgt.core.policy.mgt.core.mgt.impl.MonitoringManagerImpl; +import io.entgra.device.mgt.core.policy.mgt.core.mock.TestHeartBeatManagementService; +import io.entgra.device.mgt.core.policy.mgt.core.mock.TypeXDeviceManagementService; +import io.entgra.device.mgt.core.policy.mgt.core.task.MonitoringTask; +import io.entgra.device.mgt.core.policy.mgt.core.task.TaskScheduleService; +import io.entgra.device.mgt.core.policy.mgt.core.util.PolicyManagementConstants; +import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service.HeartBeatManagementService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.testng.Assert; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; +import org.wso2.carbon.context.PrivilegedCarbonContext; import java.sql.Timestamp; import java.util.ArrayList; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/mgt/impl/FeatureManagerImplTest.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/mgt/impl/FeatureManagerImplTest.java index f939231650..8671f74508 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/mgt/impl/FeatureManagerImplTest.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/mgt/impl/FeatureManagerImplTest.java @@ -17,6 +17,14 @@ */ package io.entgra.device.mgt.core.policy.mgt.core.mgt.impl; +import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.IllegalTransactionStateException; +import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup; +import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.OperationManager; +import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Profile; +import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.ProfileFeature; +import io.entgra.device.mgt.core.device.mgt.common.spi.DeviceManagementService; +import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.OperationManagerImpl; import io.entgra.device.mgt.core.policy.mgt.common.FeatureManagementException; import io.entgra.device.mgt.core.policy.mgt.core.BasePolicyManagementDAOTest; import io.entgra.device.mgt.core.policy.mgt.core.PolicyManagerServiceImpl; @@ -33,14 +41,6 @@ import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import org.testng.internal.collections.Pair; import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.IllegalTransactionStateException; -import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup; -import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.OperationManager; -import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Profile; -import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.ProfileFeature; -import io.entgra.device.mgt.core.device.mgt.common.spi.DeviceManagementService; -import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.OperationManagerImpl; import javax.sql.DataSource; import java.sql.Connection; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/mgt/impl/MonitoringManagerImplTest.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/mgt/impl/MonitoringManagerImplTest.java index 37bf27d664..26d834ffd2 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/mgt/impl/MonitoringManagerImplTest.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/mgt/impl/MonitoringManagerImplTest.java @@ -18,6 +18,21 @@ package io.entgra.device.mgt.core.policy.mgt.core.mgt.impl; +import io.entgra.device.mgt.core.device.mgt.common.Device; +import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.IllegalTransactionStateException; +import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup; +import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.OperationManager; +import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.DeviceGroupWrapper; +import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Policy; +import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Profile; +import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.ProfileFeature; +import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.ComplianceFeature; +import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.PolicyComplianceException; +import io.entgra.device.mgt.core.device.mgt.common.spi.DeviceManagementService; +import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.OperationManagerImpl; +import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; import io.entgra.device.mgt.core.policy.mgt.core.BasePolicyManagementDAOTest; import io.entgra.device.mgt.core.policy.mgt.core.PolicyManagerService; import io.entgra.device.mgt.core.policy.mgt.core.PolicyManagerServiceImpl; @@ -42,21 +57,6 @@ import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import org.testng.internal.collections.Pair; import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.device.mgt.common.Device; -import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.IllegalTransactionStateException; -import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup; -import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.OperationManager; -import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.DeviceGroupWrapper; -import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Policy; -import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Profile; -import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.ProfileFeature; -import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.ComplianceFeature; -import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.PolicyComplianceException; -import io.entgra.device.mgt.core.device.mgt.common.spi.DeviceManagementService; -import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.OperationManagerImpl; -import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; import javax.sql.DataSource; import java.lang.reflect.Field; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/mgt/impl/ProfileManagerImplTest.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/mgt/impl/ProfileManagerImplTest.java index 3fe0cad3cf..afcf4b82d3 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/mgt/impl/ProfileManagerImplTest.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/mgt/impl/ProfileManagerImplTest.java @@ -17,6 +17,14 @@ */ package io.entgra.device.mgt.core.policy.mgt.core.mgt.impl; +import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.IllegalTransactionStateException; +import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup; +import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.OperationManager; +import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Profile; +import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.ProfileFeature; +import io.entgra.device.mgt.core.device.mgt.common.spi.DeviceManagementService; +import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.OperationManagerImpl; import io.entgra.device.mgt.core.policy.mgt.common.ProfileManagementException; import io.entgra.device.mgt.core.policy.mgt.core.BasePolicyManagementDAOTest; import io.entgra.device.mgt.core.policy.mgt.core.PolicyManagerServiceImpl; @@ -32,14 +40,6 @@ import org.testng.Assert; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import org.testng.internal.collections.Pair; -import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.IllegalTransactionStateException; -import io.entgra.device.mgt.core.device.mgt.common.group.mgt.DeviceGroup; -import io.entgra.device.mgt.core.device.mgt.common.operation.mgt.OperationManager; -import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Profile; -import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.ProfileFeature; -import io.entgra.device.mgt.core.device.mgt.common.spi.DeviceManagementService; -import io.entgra.device.mgt.core.device.mgt.core.operation.mgt.OperationManagerImpl; import javax.sql.DataSource; import java.sql.Connection; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/mock/TestHeartBeatManagementService.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/mock/TestHeartBeatManagementService.java index 3272091675..7dae55b96b 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/mock/TestHeartBeatManagementService.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/mock/TestHeartBeatManagementService.java @@ -18,11 +18,11 @@ package io.entgra.device.mgt.core.policy.mgt.core.mock; +import io.entgra.device.mgt.core.device.mgt.common.ServerCtxInfo; import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.dto.HeartBeatEvent; import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.dto.ServerContext; import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.exception.HeartBeatManagementException; import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service.HeartBeatManagementService; -import io.entgra.device.mgt.core.device.mgt.common.ServerCtxInfo; import java.util.Map; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/mock/TestPolicyMonitoringManager.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/mock/TestPolicyMonitoringManager.java index 6a7f83499d..739aedda49 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/mock/TestPolicyMonitoringManager.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/mock/TestPolicyMonitoringManager.java @@ -17,14 +17,14 @@ */ package io.entgra.device.mgt.core.policy.mgt.core.mock; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Policy; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.PolicyMonitoringManager; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.ComplianceFeature; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.NonComplianceData; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.PolicyComplianceException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.util.ArrayList; import java.util.List; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/services/PolicyMonitoringManagerTest.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/services/PolicyMonitoringManagerTest.java index ea01630c29..f65a23fc21 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/services/PolicyMonitoringManagerTest.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/services/PolicyMonitoringManagerTest.java @@ -19,8 +19,6 @@ package io.entgra.device.mgt.core.policy.mgt.core.services; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Policy; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.PolicyMonitoringManager; @@ -28,6 +26,8 @@ import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.ProfileFeature; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.ComplianceFeature; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.NonComplianceData; import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.monitor.PolicyComplianceException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.util.ArrayList; import java.util.List; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/services/SimplePolicyEvaluationTest.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/services/SimplePolicyEvaluationTest.java index ed712b40dd..2846432c6b 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/services/SimplePolicyEvaluationTest.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/services/SimplePolicyEvaluationTest.java @@ -19,14 +19,14 @@ package io.entgra.device.mgt.core.policy.mgt.core.services; +import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; +import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Policy; +import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.ProfileFeature; import io.entgra.device.mgt.core.policy.mgt.common.*; import io.entgra.device.mgt.core.policy.mgt.core.PolicyManagerService; import io.entgra.device.mgt.core.policy.mgt.core.PolicyManagerServiceImpl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.device.mgt.common.DeviceIdentifier; -import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.Policy; -import io.entgra.device.mgt.core.device.mgt.common.policy.mgt.ProfileFeature; import java.util.Collections; import java.util.List; diff --git a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/task/TaskSchedulerServiceImplTest.java b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/task/TaskSchedulerServiceImplTest.java index 23fc0ab994..8235774c6e 100644 --- a/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/task/TaskSchedulerServiceImplTest.java +++ b/components/policy-mgt/io.entgra.device.mgt.core.policy.mgt.core/src/test/java/io/entgra/device/mgt/core/policy/mgt/core/task/TaskSchedulerServiceImplTest.java @@ -18,6 +18,8 @@ package io.entgra.device.mgt.core.policy.mgt.core.task; +import io.entgra.device.mgt.core.device.mgt.core.config.DeviceConfigurationManager; +import io.entgra.device.mgt.core.device.mgt.core.config.policy.PolicyConfiguration; import io.entgra.device.mgt.core.policy.mgt.common.PolicyMonitoringTaskException; import io.entgra.device.mgt.core.policy.mgt.core.internal.PolicyManagementDataHolder; import io.entgra.device.mgt.core.policy.mgt.core.util.PolicyManagementConstants; @@ -27,8 +29,6 @@ import org.mockito.Mockito; import org.testng.Assert; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; -import io.entgra.device.mgt.core.device.mgt.core.config.DeviceConfigurationManager; -import io.entgra.device.mgt.core.device.mgt.core.config.policy.PolicyConfiguration; import org.wso2.carbon.ntask.common.TaskException; import org.wso2.carbon.ntask.core.TaskInfo; import org.wso2.carbon.ntask.core.TaskManager; diff --git a/components/policy-mgt/org.wso2.carbon.complex.policy.decision.point/pom.xml b/components/policy-mgt/org.wso2.carbon.complex.policy.decision.point/pom.xml index 81c42b7037..41edc660b2 100644 --- a/components/policy-mgt/org.wso2.carbon.complex.policy.decision.point/pom.xml +++ b/components/policy-mgt/org.wso2.carbon.complex.policy.decision.point/pom.xml @@ -32,7 +32,7 @@ bundle WSO2 Carbon - Policy Decision Point WSO2 Carbon - Policy Decision Point - http://wso2.org + https://entgra.io diff --git a/components/policy-mgt/pom.xml b/components/policy-mgt/pom.xml index c2e2304e58..2daade26a6 100644 --- a/components/policy-mgt/pom.xml +++ b/components/policy-mgt/pom.xml @@ -31,34 +31,14 @@ policy-mgt pom WSO2 Carbon - Policy Management Component - http://wso2.org + https://entgra.io io.entgra.device.mgt.core.policy.mgt.common io.entgra.device.mgt.core.policy.mgt.core io.entgra.device.mgt.core.policy.information.point io.entgra.device.mgt.core.policy.decision.point - - - - - - - - - - - - - - - - - - - - diff --git a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml index 562066922a..e274b0192a 100644 --- a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml +++ b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/pom.xml @@ -33,13 +33,13 @@ - - org.apache.felix - maven-scr-plugin - org.apache.maven.plugins maven-compiler-plugin + + 1.8 + 1.8 + org.apache.felix @@ -53,37 +53,29 @@ Subtype Management Bundle io.entgra.device.mgt.core.subtype.mgt.internal + com.fasterxml.jackson.core;version="[2.10,3)", + com.google.common.cache;version="[31.0,32)", + io.entgra.device.mgt.core.device.mgt.common.exceptions;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.core.config;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.core.config.datasource;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.core.service;version="[5.0,6)", + io.entgra.device.mgt.core.subtype.mgt.cache, + io.entgra.device.mgt.core.subtype.mgt.dao, + io.entgra.device.mgt.core.subtype.mgt.dao.impl, + io.entgra.device.mgt.core.subtype.mgt.dao.util, + io.entgra.device.mgt.core.subtype.mgt.dto, + io.entgra.device.mgt.core.subtype.mgt.exception, + io.entgra.device.mgt.core.subtype.mgt.impl, + io.entgra.device.mgt.core.subtype.mgt.spi, + io.entgra.device.mgt.core.subtype.mgt.util, + javax.naming, + javax.sql, + org.apache.commons.logging;version="[1.2,2)", org.osgi.framework.*;version="${imp.package.version.osgi.framework}", org.osgi.service.*;version="${imp.package.version.osgi.service}", - org.apache.commons.logging, - org.apache.commons.lang, - javax.xml, - javax.xml.stream, - javax.xml.bind.*, - javax.sql, - javax.xml.parsers; version=0.0.0, - org.w3c.dom, - javax.naming, - org.wso2.carbon.context, - org.wso2.carbon.base, - org.wso2.carbon.utils.*, - io.entgra.device.mgt.core.device.mgt.common.*, - io.entgra.device.mgt.core.device.mgt.core.*, - org.wso2.carbon.ndatasource.core, - org.wso2.carbon.registry.core, - org.wso2.carbon.registry.core.session, - org.wso2.carbon.registry.core.service, - org.wso2.carbon.registry.api, - io.entgra.device.mgt.core.device.mgt.extensions.license.mgt.registry, - javax.net.ssl, - org.wso2.carbon.core.util, - okhttp3, - org.json.*, - com.google.gson.*, - com.fasterxml.jackson.core.*, - com.fasterxml.jackson.databind.*, - com.fasterxml.jackson.annotation.*, - com.google.common.cache.*, + org.wso2.carbon.context;version="[4.8,5)", + org.wso2.carbon.ndatasource.core;version="[4.8,5)", + org.wso2.carbon.registry.core.service;version="[1.0,2)" !io.entgra.device.mgt.core.subtype.mgt.internal, @@ -135,6 +127,11 @@ + + org.apache.felix + org.apache.felix.scr.ds-annotations + provided + io.entgra.device.mgt.core io.entgra.device.mgt.core.device.mgt.common @@ -164,10 +161,6 @@ org.codehaus.woodstox wstx-asl - - - - org.wso2.carbon.analytics org.wso2.carbon.analytics.api @@ -227,16 +220,6 @@ - - org.eclipse.osgi - org.eclipse.osgi - provided - - - org.eclipse.osgi - org.eclipse.osgi.services - provided - org.wso2.carbon org.wso2.carbon.core @@ -246,7 +229,6 @@ org.ops4j.pax.logging pax-logging-api provided - org.wso2.carbon @@ -341,19 +323,16 @@ com.google.guava guava - provided org.json.wso2 json - provided org.wso2.orbit.com.fasterxml.jackson.core jackson-databind - provided diff --git a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/cache/GetDeviceSubTypeCacheLoader.java b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/cache/GetDeviceSubTypeCacheLoader.java index 7819a2ed99..6510eb26c5 100644 --- a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/cache/GetDeviceSubTypeCacheLoader.java +++ b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/cache/GetDeviceSubTypeCacheLoader.java @@ -19,11 +19,11 @@ package io.entgra.device.mgt.core.subtype.mgt.cache; import com.google.common.cache.CacheLoader; -import io.entgra.device.mgt.core.subtype.mgt.dto.DeviceSubTypeCacheKey; import io.entgra.device.mgt.core.subtype.mgt.dao.DeviceSubTypeDAO; import io.entgra.device.mgt.core.subtype.mgt.dao.DeviceSubTypeDAOFactory; import io.entgra.device.mgt.core.subtype.mgt.dao.util.ConnectionManagerUtil; import io.entgra.device.mgt.core.subtype.mgt.dto.DeviceSubType; +import io.entgra.device.mgt.core.subtype.mgt.dto.DeviceSubTypeCacheKey; import io.entgra.device.mgt.core.subtype.mgt.exception.DBConnectionException; import io.entgra.device.mgt.core.subtype.mgt.exception.SubTypeMgtDAOException; import io.entgra.device.mgt.core.subtype.mgt.exception.SubTypeMgtPluginException; diff --git a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/dao/DeviceSubTypeDAO.java b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/dao/DeviceSubTypeDAO.java index dd5e8b182f..ee7df4703a 100644 --- a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/dao/DeviceSubTypeDAO.java +++ b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/dao/DeviceSubTypeDAO.java @@ -18,8 +18,8 @@ package io.entgra.device.mgt.core.subtype.mgt.dao; -import io.entgra.device.mgt.core.subtype.mgt.exception.SubTypeMgtDAOException; import io.entgra.device.mgt.core.subtype.mgt.dto.DeviceSubType; +import io.entgra.device.mgt.core.subtype.mgt.exception.SubTypeMgtDAOException; import java.util.List; diff --git a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/dao/DeviceSubTypeDAOFactory.java b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/dao/DeviceSubTypeDAOFactory.java index 0a6c962cd4..baef7f9c3e 100644 --- a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/dao/DeviceSubTypeDAOFactory.java +++ b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/dao/DeviceSubTypeDAOFactory.java @@ -18,13 +18,13 @@ package io.entgra.device.mgt.core.subtype.mgt.dao; +import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; +import io.entgra.device.mgt.core.device.mgt.core.config.datasource.DataSourceConfig; import io.entgra.device.mgt.core.subtype.mgt.dao.impl.DeviceSubTypeDAOImpl; import io.entgra.device.mgt.core.subtype.mgt.dao.impl.DeviceSubTypeMySQLDAOImpl; +import io.entgra.device.mgt.core.subtype.mgt.dao.util.ConnectionManagerUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; -import io.entgra.device.mgt.core.subtype.mgt.dao.util.ConnectionManagerUtil; -import io.entgra.device.mgt.core.device.mgt.core.config.datasource.DataSourceConfig; public class DeviceSubTypeDAOFactory { private static final Log log = LogFactory.getLog(DeviceSubTypeDAOFactory.class); diff --git a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/dao/impl/DeviceSubTypeDAOImpl.java b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/dao/impl/DeviceSubTypeDAOImpl.java index a6224a2ed2..7e903e22f2 100644 --- a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/dao/impl/DeviceSubTypeDAOImpl.java +++ b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/dao/impl/DeviceSubTypeDAOImpl.java @@ -18,12 +18,12 @@ package io.entgra.device.mgt.core.subtype.mgt.dao.impl; -import io.entgra.device.mgt.core.subtype.mgt.exception.DBConnectionException; -import io.entgra.device.mgt.core.subtype.mgt.exception.SubTypeMgtDAOException; import io.entgra.device.mgt.core.subtype.mgt.dao.DeviceSubTypeDAO; import io.entgra.device.mgt.core.subtype.mgt.dao.util.ConnectionManagerUtil; -import io.entgra.device.mgt.core.subtype.mgt.dto.DeviceSubType; import io.entgra.device.mgt.core.subtype.mgt.dao.util.DAOUtil; +import io.entgra.device.mgt.core.subtype.mgt.dto.DeviceSubType; +import io.entgra.device.mgt.core.subtype.mgt.exception.DBConnectionException; +import io.entgra.device.mgt.core.subtype.mgt.exception.SubTypeMgtDAOException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/dao/util/ConnectionManagerUtil.java b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/dao/util/ConnectionManagerUtil.java index 57ea6c7c1e..d7a0d31cf3 100644 --- a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/dao/util/ConnectionManagerUtil.java +++ b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/dao/util/ConnectionManagerUtil.java @@ -18,12 +18,12 @@ package io.entgra.device.mgt.core.subtype.mgt.dao.util; -import io.entgra.device.mgt.core.subtype.mgt.exception.DBConnectionException; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.exceptions.IllegalTransactionStateException; import io.entgra.device.mgt.core.device.mgt.core.config.datasource.DataSourceConfig; import io.entgra.device.mgt.core.device.mgt.core.config.datasource.JNDILookupDefinition; +import io.entgra.device.mgt.core.subtype.mgt.exception.DBConnectionException; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import javax.naming.InitialContext; import javax.sql.DataSource; diff --git a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/impl/DeviceSubTypeServiceImpl.java b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/impl/DeviceSubTypeServiceImpl.java index 5af54eabf9..f1e44e325c 100644 --- a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/impl/DeviceSubTypeServiceImpl.java +++ b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/impl/DeviceSubTypeServiceImpl.java @@ -22,16 +22,16 @@ import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; import io.entgra.device.mgt.core.subtype.mgt.cache.GetDeviceSubTypeCacheLoader; +import io.entgra.device.mgt.core.subtype.mgt.dao.DeviceSubTypeDAO; +import io.entgra.device.mgt.core.subtype.mgt.dao.DeviceSubTypeDAOFactory; +import io.entgra.device.mgt.core.subtype.mgt.dao.util.ConnectionManagerUtil; +import io.entgra.device.mgt.core.subtype.mgt.dto.DeviceSubType; import io.entgra.device.mgt.core.subtype.mgt.exception.BadRequestException; import io.entgra.device.mgt.core.subtype.mgt.exception.DBConnectionException; import io.entgra.device.mgt.core.subtype.mgt.exception.SubTypeMgtDAOException; import io.entgra.device.mgt.core.subtype.mgt.exception.SubTypeMgtPluginException; -import io.entgra.device.mgt.core.subtype.mgt.util.DeviceSubTypeMgtUtil; -import io.entgra.device.mgt.core.subtype.mgt.dto.DeviceSubType; -import io.entgra.device.mgt.core.subtype.mgt.dao.DeviceSubTypeDAO; -import io.entgra.device.mgt.core.subtype.mgt.dao.DeviceSubTypeDAOFactory; -import io.entgra.device.mgt.core.subtype.mgt.dao.util.ConnectionManagerUtil; import io.entgra.device.mgt.core.subtype.mgt.spi.DeviceSubTypeService; +import io.entgra.device.mgt.core.subtype.mgt.util.DeviceSubTypeMgtUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.context.CarbonContext; diff --git a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/internal/DeviceSubTypeMgtDataHolder.java b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/internal/DeviceSubTypeMgtDataHolder.java index e3cd330d19..8efcdac5f7 100644 --- a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/internal/DeviceSubTypeMgtDataHolder.java +++ b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/internal/DeviceSubTypeMgtDataHolder.java @@ -18,8 +18,8 @@ package io.entgra.device.mgt.core.subtype.mgt.internal; -import io.entgra.device.mgt.core.subtype.mgt.spi.DeviceSubTypeService; import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; +import io.entgra.device.mgt.core.subtype.mgt.spi.DeviceSubTypeService; import org.wso2.carbon.registry.core.service.RegistryService; public class DeviceSubTypeMgtDataHolder { diff --git a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/internal/DeviceSubTypeMgtServiceComponent.java b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/internal/DeviceSubTypeMgtServiceComponent.java index ab322c4db7..c0fc960352 100644 --- a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/internal/DeviceSubTypeMgtServiceComponent.java +++ b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/internal/DeviceSubTypeMgtServiceComponent.java @@ -18,45 +18,29 @@ package io.entgra.device.mgt.core.subtype.mgt.internal; +import io.entgra.device.mgt.core.device.mgt.core.config.DeviceConfigurationManager; +import io.entgra.device.mgt.core.device.mgt.core.config.DeviceManagementConfig; +import io.entgra.device.mgt.core.device.mgt.core.config.datasource.DataSourceConfig; +import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; +import io.entgra.device.mgt.core.subtype.mgt.dao.DeviceSubTypeDAOFactory; import io.entgra.device.mgt.core.subtype.mgt.impl.DeviceSubTypeServiceImpl; import io.entgra.device.mgt.core.subtype.mgt.spi.DeviceSubTypeService; -import io.entgra.device.mgt.core.subtype.mgt.dao.DeviceSubTypeDAOFactory; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.framework.BundleContext; import org.osgi.service.component.ComponentContext; -import io.entgra.device.mgt.core.device.mgt.core.config.DeviceConfigurationManager; -import io.entgra.device.mgt.core.device.mgt.core.config.DeviceManagementConfig; -import io.entgra.device.mgt.core.device.mgt.core.config.datasource.DataSourceConfig; -import io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService; +import org.osgi.service.component.annotations.*; import org.wso2.carbon.ndatasource.core.DataSourceService; import org.wso2.carbon.registry.core.service.RegistryService; -/** - * @scr.component name="io.entgra.device.mgt.core.subtype.mgt.internal.DeviceSubTypeMgtServiceComponent" immediate="true" - * @scr.reference name="org.wso2.carbon.device.manager" - * interface="io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService" - * cardinality="1..1" - * policy="dynamic" - * bind="setDeviceManagementService" - * unbind="unsetDeviceManagementService" - * @scr.reference name="org.wso2.carbon.ndatasource" - * interface="org.wso2.carbon.ndatasource.core.DataSourceService" - * cardinality="1..1" - * policy="dynamic" - * bind="setDataSourceService" - * unbind="unsetDataSourceService" - * @scr.reference name="registry.service" - * interface="org.wso2.carbon.registry.core.service.RegistryService" - * cardinality="0..1" - * policy="dynamic" - * bind="setRegistryService" - * unbind="unsetRegistryService" - */ +@Component( + name = "io.entgra.device.mgt.core.subtype.mgt.internal.DeviceSubTypeMgtServiceComponent", + immediate = true) public class DeviceSubTypeMgtServiceComponent { private static final Log log = LogFactory.getLog(DeviceSubTypeMgtServiceComponent.class); + @Activate protected void activate(ComponentContext componentContext) { if (log.isDebugEnabled()) { @@ -80,7 +64,7 @@ public class DeviceSubTypeMgtServiceComponent { log.error("Error occurred while activating Device SubType Management Service Component", e); } } - + @Deactivate protected void deactivate(ComponentContext componentContext) { if (log.isDebugEnabled()) { log.debug("De-activating Device SubType Management Service Component"); @@ -88,6 +72,12 @@ public class DeviceSubTypeMgtServiceComponent { } @SuppressWarnings("unused") + @Reference( + name = "data.mgt.provider.service", + service = io.entgra.device.mgt.core.device.mgt.core.service.DeviceManagementProviderService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetDeviceManagementService") protected void setDeviceManagementService(DeviceManagementProviderService deviceManagementProviderService) { if (log.isDebugEnabled()) { log.debug("Setting Device Management Service to Device SubType Mgt SC"); @@ -103,6 +93,12 @@ public class DeviceSubTypeMgtServiceComponent { DeviceSubTypeMgtDataHolder.getInstance().setDeviceManagementProviderService(null); } + @Reference( + name = "datasource.service", + service = org.wso2.carbon.ndatasource.core.DataSourceService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetDataSourceService") protected void setDataSourceService(DataSourceService dataSourceService) { /* This is to avoid mobile device management component getting initialized before the underlying datasources are registered */ @@ -118,7 +114,12 @@ public class DeviceSubTypeMgtServiceComponent { } } - + @Reference( + name = "registry.service", + service = org.wso2.carbon.registry.core.service.RegistryService.class, + cardinality = ReferenceCardinality.OPTIONAL, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRegistryService") protected void setRegistryService(RegistryService registryService) { if (log.isDebugEnabled()) { log.debug("RegistryService set to Device SubType Mgt component"); diff --git a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/spi/DeviceSubTypeService.java b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/spi/DeviceSubTypeService.java index 6ccf98d748..f5bb01d6e2 100644 --- a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/spi/DeviceSubTypeService.java +++ b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/spi/DeviceSubTypeService.java @@ -18,8 +18,8 @@ package io.entgra.device.mgt.core.subtype.mgt.spi; -import io.entgra.device.mgt.core.subtype.mgt.exception.SubTypeMgtPluginException; import io.entgra.device.mgt.core.subtype.mgt.dto.DeviceSubType; +import io.entgra.device.mgt.core.subtype.mgt.exception.SubTypeMgtPluginException; import java.util.List; diff --git a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/util/DeviceSubTypeMgtUtil.java b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/util/DeviceSubTypeMgtUtil.java index 76222e21f7..8b19b37dcb 100644 --- a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/util/DeviceSubTypeMgtUtil.java +++ b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/main/java/io/entgra/device/mgt/core/subtype/mgt/util/DeviceSubTypeMgtUtil.java @@ -18,8 +18,8 @@ package io.entgra.device.mgt.core.subtype.mgt.util; -import io.entgra.device.mgt.core.subtype.mgt.dto.DeviceSubTypeCacheKey; import io.entgra.device.mgt.core.subtype.mgt.dto.DeviceSubType; +import io.entgra.device.mgt.core.subtype.mgt.dto.DeviceSubTypeCacheKey; public class DeviceSubTypeMgtUtil { public static String setDeviceSubTypeCacheKey(int tenantId, String subTypeId, DeviceSubType.DeviceType deviceType) { diff --git a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/test/java/io/entgra/device/mgt/core/subtype/mgt/mock/BaseDeviceSubTypePluginTest.java b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/test/java/io/entgra/device/mgt/core/subtype/mgt/mock/BaseDeviceSubTypePluginTest.java index 9c47c7ac22..ac11855263 100644 --- a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/test/java/io/entgra/device/mgt/core/subtype/mgt/mock/BaseDeviceSubTypePluginTest.java +++ b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/test/java/io/entgra/device/mgt/core/subtype/mgt/mock/BaseDeviceSubTypePluginTest.java @@ -18,9 +18,12 @@ package io.entgra.device.mgt.core.subtype.mgt.mock; +import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; +import io.entgra.device.mgt.core.device.mgt.core.util.DeviceManagerUtil; +import io.entgra.device.mgt.core.subtype.mgt.DataSourceConfig; import io.entgra.device.mgt.core.subtype.mgt.TestUtils; import io.entgra.device.mgt.core.subtype.mgt.dao.DeviceSubTypeDAOFactory; -import io.entgra.device.mgt.core.subtype.mgt.DataSourceConfig; import io.entgra.device.mgt.core.subtype.mgt.dao.util.ConnectionManagerUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -32,9 +35,6 @@ import org.testng.annotations.Parameters; import org.w3c.dom.Document; import org.wso2.carbon.base.MultitenantConstants; import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; -import io.entgra.device.mgt.core.device.mgt.core.util.DeviceManagerUtil; import javax.sql.DataSource; import javax.xml.bind.JAXBContext; diff --git a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/test/java/io/entgra/device/mgt/core/subtype/mgt/mock/MockConnection.java b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/test/java/io/entgra/device/mgt/core/subtype/mgt/mock/MockConnection.java index 8a758b4204..3c677e5f9d 100644 --- a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/test/java/io/entgra/device/mgt/core/subtype/mgt/mock/MockConnection.java +++ b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/test/java/io/entgra/device/mgt/core/subtype/mgt/mock/MockConnection.java @@ -18,21 +18,7 @@ package io.entgra.device.mgt.core.subtype.mgt.mock; -import java.sql.CallableStatement; -import java.sql.SQLWarning; -import java.sql.Savepoint; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.Statement; -import java.sql.Clob; -import java.sql.Blob; -import java.sql.NClob; -import java.sql.SQLXML; -import java.sql.Struct; -import java.sql.Array; -import java.sql.SQLClientInfoException; -import java.sql.DatabaseMetaData; -import java.sql.SQLException; +import java.sql.*; import java.util.ArrayList; import java.util.List; import java.util.Map; diff --git a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/test/java/io/entgra/device/mgt/core/subtype/mgt/mock/MockDatabaseMetaData.java b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/test/java/io/entgra/device/mgt/core/subtype/mgt/mock/MockDatabaseMetaData.java index 0eac68516e..4c31273fcb 100644 --- a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/test/java/io/entgra/device/mgt/core/subtype/mgt/mock/MockDatabaseMetaData.java +++ b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/test/java/io/entgra/device/mgt/core/subtype/mgt/mock/MockDatabaseMetaData.java @@ -20,11 +20,7 @@ package io.entgra.device.mgt.core.subtype.mgt.mock; import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.RowIdLifetime; -import java.sql.DatabaseMetaData; -import java.sql.SQLException; +import java.sql.*; public class MockDatabaseMetaData implements DatabaseMetaData { private final String url; diff --git a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/test/java/io/entgra/device/mgt/core/subtype/mgt/mock/MockResultSet.java b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/test/java/io/entgra/device/mgt/core/subtype/mgt/mock/MockResultSet.java index bb5d512925..4136297ce0 100644 --- a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/test/java/io/entgra/device/mgt/core/subtype/mgt/mock/MockResultSet.java +++ b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/test/java/io/entgra/device/mgt/core/subtype/mgt/mock/MockResultSet.java @@ -22,21 +22,7 @@ import java.io.InputStream; import java.io.Reader; import java.math.BigDecimal; import java.net.URL; -import java.sql.ResultSet; -import java.sql.SQLWarning; -import java.sql.Date; -import java.sql.Time; -import java.sql.Timestamp; -import java.sql.Clob; -import java.sql.Blob; -import java.sql.NClob; -import java.sql.SQLXML; -import java.sql.Ref; -import java.sql.Array; -import java.sql.ResultSetMetaData; -import java.sql.RowId; -import java.sql.Statement; -import java.sql.SQLException; +import java.sql.*; import java.util.ArrayList; import java.util.Calendar; import java.util.List; diff --git a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/test/java/io/entgra/device/mgt/core/subtype/mgt/mock/MockStatement.java b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/test/java/io/entgra/device/mgt/core/subtype/mgt/mock/MockStatement.java index 40671beab9..2d9330360f 100644 --- a/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/test/java/io/entgra/device/mgt/core/subtype/mgt/mock/MockStatement.java +++ b/components/subtype-mgt/io.entgra.device.mgt.core.subtype.mgt/src/test/java/io/entgra/device/mgt/core/subtype/mgt/mock/MockStatement.java @@ -22,23 +22,7 @@ import java.io.InputStream; import java.io.Reader; import java.math.BigDecimal; import java.net.URL; -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.SQLWarning; -import java.sql.Date; -import java.sql.Time; -import java.sql.Timestamp; -import java.sql.PreparedStatement; -import java.sql.ParameterMetaData; -import java.sql.Clob; -import java.sql.Blob; -import java.sql.NClob; -import java.sql.SQLXML; -import java.sql.Ref; -import java.sql.Array; -import java.sql.ResultSetMetaData; -import java.sql.RowId; -import java.sql.SQLException; +import java.sql.*; import java.util.ArrayList; import java.util.Calendar; import java.util.List; diff --git a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/pom.xml b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/pom.xml index bdeef9c25e..daf623b335 100755 --- a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/pom.xml +++ b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/pom.xml @@ -33,6 +33,14 @@ + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + org.apache.felix maven-bundle-plugin @@ -46,6 +54,10 @@ io.entgra.device.mgt.core.task.mgt.common.* + + io.entgra.device.mgt.core.task.mgt.common.bean, + io.entgra.device.mgt.core.task.mgt.common.exception + diff --git a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/src/main/java/io/entgra/device/mgt/core/task/mgt/common/spi/TaskManagementService.java b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/src/main/java/io/entgra/device/mgt/core/task/mgt/common/spi/TaskManagementService.java index f07cb49083..54154ecbd1 100755 --- a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/src/main/java/io/entgra/device/mgt/core/task/mgt/common/spi/TaskManagementService.java +++ b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.common/src/main/java/io/entgra/device/mgt/core/task/mgt/common/spi/TaskManagementService.java @@ -18,8 +18,8 @@ package io.entgra.device.mgt.core.task.mgt.common.spi; import io.entgra.device.mgt.core.task.mgt.common.bean.DynamicTask; -import io.entgra.device.mgt.core.task.mgt.common.exception.TaskNotFoundException; import io.entgra.device.mgt.core.task.mgt.common.exception.TaskManagementException; +import io.entgra.device.mgt.core.task.mgt.common.exception.TaskNotFoundException; import java.util.List; diff --git a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/pom.xml b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/pom.xml index 5353e83b27..802b4fc403 100755 --- a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/pom.xml +++ b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/pom.xml @@ -35,8 +35,12 @@ - org.apache.felix - maven-scr-plugin + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + org.apache.felix @@ -50,26 +54,36 @@ Task Management Core Bundle io.entgra.device.mgt.core.task.mgt.core.internal + com.google.gson;version="[2.9,3)", + io.entgra.device.mgt.core.device.mgt.common;version="[5.0,6)", + io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.exception;version="[5.0,6)", + io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service;version="[5.0,6)", + io.entgra.device.mgt.core.task.mgt.common.bean;version="[5.0,6)", + io.entgra.device.mgt.core.task.mgt.common.exception;version="[5.0,6)", + io.entgra.device.mgt.core.task.mgt.common.spi;version="[5.0,6)", + io.entgra.device.mgt.core.task.mgt.core.config, + io.entgra.device.mgt.core.task.mgt.core.config.datasource, + io.entgra.device.mgt.core.task.mgt.core.dao, + io.entgra.device.mgt.core.task.mgt.core.dao.common, + io.entgra.device.mgt.core.task.mgt.core.dao.impl, + io.entgra.device.mgt.core.task.mgt.core.dao.util, + javax.naming, + javax.sql, + javax.xml.bind;version="[0.0,1)", + javax.xml.bind.annotation;version="[0.0,1)", + javax.xml.parsers;version="${javax.xml.parsers.import.pkg.version}", + org.apache.commons.codec.digest;version="[1.4,2)", + org.apache.commons.lang;version="[2.4,3)", + org.apache.commons.logging;version="[1.2,2)", org.osgi.framework.*;version="${imp.package.version.osgi.framework}", org.osgi.service.*;version="${imp.package.version.osgi.service}", - org.apache.commons.logging, - org.wso2.carbon.ndatasource.core, org.w3c.dom, - javax.xml.bind.annotation, - javax.xml.bind, - javax.sql, - javax.naming, - io.entgra.device.mgt.core.task.mgt.common.*, - org.wso2.carbon.utils.*, - org.wso2.carbon.ntask.core.*, - org.wso2.carbon.ntask.common, - io.entgra.device.mgt.core.device.mgt.common.*, - org.wso2.carbon.context, - org.apache.commons.codec.binary;version="${commons-codec.wso2.osgi.version.range}", - org.apache.commons.codec.digest;version="${commons-codec.wso2.osgi.version.range}", - io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.dto, - io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.exception, - io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service, + org.wso2.carbon.context;version="[4.8,5)", + org.wso2.carbon.ndatasource.core;version="[4.8,5)", + org.wso2.carbon.ntask.common;version="[4.9,5)", + org.wso2.carbon.ntask.core;version="[4.9,5)", + org.wso2.carbon.ntask.core.service;version="[4.9,5)", + org.wso2.carbon.utils;version="[4.8,5)" !io.entgra.device.mgt.core.task.mgt.core.internal, @@ -83,13 +97,8 @@ - org.eclipse.osgi - org.eclipse.osgi - provided - - - org.eclipse.osgi - org.eclipse.osgi.services + org.apache.felix + org.apache.felix.scr.ds-annotations provided @@ -106,7 +115,6 @@ org.ops4j.pax.logging pax-logging-api provided - org.wso2.carbon diff --git a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/src/main/java/io/entgra/device/mgt/core/task/mgt/core/config/TaskConfigurationManager.java b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/src/main/java/io/entgra/device/mgt/core/task/mgt/core/config/TaskConfigurationManager.java index a6e7c78895..69fa1605d0 100755 --- a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/src/main/java/io/entgra/device/mgt/core/task/mgt/core/config/TaskConfigurationManager.java +++ b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/src/main/java/io/entgra/device/mgt/core/task/mgt/core/config/TaskConfigurationManager.java @@ -17,9 +17,9 @@ */ package io.entgra.device.mgt.core.task.mgt.core.config; -import io.entgra.device.mgt.core.task.mgt.core.util.TaskManagementUtil; import io.entgra.device.mgt.core.task.mgt.common.constant.TaskMgtConstants; import io.entgra.device.mgt.core.task.mgt.common.exception.TaskManagementException; +import io.entgra.device.mgt.core.task.mgt.core.util.TaskManagementUtil; import org.w3c.dom.Document; import org.wso2.carbon.utils.CarbonUtils; diff --git a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/src/main/java/io/entgra/device/mgt/core/task/mgt/core/dao/common/TaskManagementDAOFactory.java b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/src/main/java/io/entgra/device/mgt/core/task/mgt/core/dao/common/TaskManagementDAOFactory.java index be464c2a90..11d2ef208e 100755 --- a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/src/main/java/io/entgra/device/mgt/core/task/mgt/core/dao/common/TaskManagementDAOFactory.java +++ b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/src/main/java/io/entgra/device/mgt/core/task/mgt/core/dao/common/TaskManagementDAOFactory.java @@ -17,7 +17,6 @@ */ package io.entgra.device.mgt.core.task.mgt.core.dao.common; -import io.entgra.device.mgt.core.task.mgt.core.dao.DynamicTaskPropDAO; import io.entgra.device.mgt.core.task.mgt.common.constant.TaskMgtConstants; import io.entgra.device.mgt.core.task.mgt.common.exception.IllegalTransactionStateException; import io.entgra.device.mgt.core.task.mgt.common.exception.TransactionManagementException; @@ -25,6 +24,7 @@ import io.entgra.device.mgt.core.task.mgt.common.exception.UnsupportedDatabaseEn import io.entgra.device.mgt.core.task.mgt.core.config.datasource.DataSourceConfig; import io.entgra.device.mgt.core.task.mgt.core.config.datasource.JNDILookupDefinition; import io.entgra.device.mgt.core.task.mgt.core.dao.DynamicTaskDAO; +import io.entgra.device.mgt.core.task.mgt.core.dao.DynamicTaskPropDAO; import io.entgra.device.mgt.core.task.mgt.core.dao.impl.DynamicTaskDAOImpl; import io.entgra.device.mgt.core.task.mgt.core.dao.impl.DynamicTaskPropDAOImpl; import io.entgra.device.mgt.core.task.mgt.core.dao.util.TaskManagementDAOUtil; diff --git a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/src/main/java/io/entgra/device/mgt/core/task/mgt/core/dao/impl/DynamicTaskDAOImpl.java b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/src/main/java/io/entgra/device/mgt/core/task/mgt/core/dao/impl/DynamicTaskDAOImpl.java index f115176717..31c256b73c 100755 --- a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/src/main/java/io/entgra/device/mgt/core/task/mgt/core/dao/impl/DynamicTaskDAOImpl.java +++ b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/src/main/java/io/entgra/device/mgt/core/task/mgt/core/dao/impl/DynamicTaskDAOImpl.java @@ -17,11 +17,11 @@ */ package io.entgra.device.mgt.core.task.mgt.core.dao.impl; -import io.entgra.device.mgt.core.task.mgt.core.dao.common.TaskManagementDAOFactory; -import io.entgra.device.mgt.core.task.mgt.core.dao.util.TaskManagementDAOUtil; import io.entgra.device.mgt.core.task.mgt.common.bean.DynamicTask; import io.entgra.device.mgt.core.task.mgt.common.exception.TaskManagementDAOException; import io.entgra.device.mgt.core.task.mgt.core.dao.DynamicTaskDAO; +import io.entgra.device.mgt.core.task.mgt.core.dao.common.TaskManagementDAOFactory; +import io.entgra.device.mgt.core.task.mgt.core.dao.util.TaskManagementDAOUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.context.PrivilegedCarbonContext; diff --git a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/src/main/java/io/entgra/device/mgt/core/task/mgt/core/dao/impl/DynamicTaskPropDAOImpl.java b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/src/main/java/io/entgra/device/mgt/core/task/mgt/core/dao/impl/DynamicTaskPropDAOImpl.java index 10d502f322..d26406e1b3 100755 --- a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/src/main/java/io/entgra/device/mgt/core/task/mgt/core/dao/impl/DynamicTaskPropDAOImpl.java +++ b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/src/main/java/io/entgra/device/mgt/core/task/mgt/core/dao/impl/DynamicTaskPropDAOImpl.java @@ -17,11 +17,11 @@ */ package io.entgra.device.mgt.core.task.mgt.core.dao.impl; +import io.entgra.device.mgt.core.task.mgt.common.constant.TaskMgtConstants; +import io.entgra.device.mgt.core.task.mgt.common.exception.TaskManagementDAOException; import io.entgra.device.mgt.core.task.mgt.core.dao.DynamicTaskPropDAO; import io.entgra.device.mgt.core.task.mgt.core.dao.common.TaskManagementDAOFactory; import io.entgra.device.mgt.core.task.mgt.core.dao.util.TaskManagementDAOUtil; -import io.entgra.device.mgt.core.task.mgt.common.constant.TaskMgtConstants; -import io.entgra.device.mgt.core.task.mgt.common.exception.TaskManagementDAOException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.context.PrivilegedCarbonContext; diff --git a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/src/main/java/io/entgra/device/mgt/core/task/mgt/core/internal/TaskManagerServiceComponent.java b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/src/main/java/io/entgra/device/mgt/core/task/mgt/core/internal/TaskManagerServiceComponent.java index 2bc5e41393..db189da85b 100755 --- a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/src/main/java/io/entgra/device/mgt/core/task/mgt/core/internal/TaskManagerServiceComponent.java +++ b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/src/main/java/io/entgra/device/mgt/core/task/mgt/core/internal/TaskManagerServiceComponent.java @@ -17,12 +17,12 @@ */ package io.entgra.device.mgt.core.task.mgt.core.internal; -import io.entgra.device.mgt.core.task.mgt.core.dao.common.TaskManagementDAOFactory; import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service.HeartBeatManagementService; -import io.entgra.device.mgt.core.task.mgt.core.config.TaskManagementConfig; -import io.entgra.device.mgt.core.task.mgt.core.config.datasource.DataSourceConfig; import io.entgra.device.mgt.core.task.mgt.common.spi.TaskManagementService; import io.entgra.device.mgt.core.task.mgt.core.config.TaskConfigurationManager; +import io.entgra.device.mgt.core.task.mgt.core.config.TaskManagementConfig; +import io.entgra.device.mgt.core.task.mgt.core.config.datasource.DataSourceConfig; +import io.entgra.device.mgt.core.task.mgt.core.dao.common.TaskManagementDAOFactory; import io.entgra.device.mgt.core.task.mgt.core.service.TaskManagementServiceImpl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -30,32 +30,16 @@ import org.osgi.framework.BundleContext; import org.osgi.service.component.ComponentContext; import org.wso2.carbon.ndatasource.core.DataSourceService; import org.wso2.carbon.ntask.core.service.TaskService; +import org.osgi.service.component.annotations.*; -/** - * @scr.component name="io.entgra.task.mgt.service" immediate="true" - * @scr.reference name="datasource.service" - * interface="org.wso2.carbon.ndatasource.core.DataSourceService" - * cardinality="1..1" - * policy="dynamic" - * bind="setDataSourceService" - * unbind="unsetDataSourceService" - * @scr.reference name="app.mgt.ntask.component" - * interface="org.wso2.carbon.ntask.core.service.TaskService" - * cardinality="1..1" - * policy="dynamic" - * bind="setTaskService" - * unbind="unsetTaskService" - * @scr.reference name="entgra.heart.beat.service" - * interface="io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service.HeartBeatManagementService" - * cardinality="0..1" - * policy="dynamic" - * bind="setHeartBeatService" - * unbind="unsetHeartBeatService" - */ +@Component( + name = "io.entgra.device.mgt.core.task.mgt.core.internal.TaskManagerServiceComponent", + immediate = true) public class TaskManagerServiceComponent { private static final Log log = LogFactory.getLog(TaskManagerServiceComponent.class); + @Activate protected void activate(ComponentContext ctx) { if (log.isDebugEnabled()) { @@ -80,13 +64,19 @@ public class TaskManagerServiceComponent { log.error("Error occurred while activating Task Manager Service Component", e); } } - + @Deactivate protected void deactivate(ComponentContext ctx) { if (log.isDebugEnabled()) { log.debug("De-activating Task Manager Service Component"); } } + @Reference( + name = "datasource.service", + service = org.wso2.carbon.ndatasource.core.DataSourceService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetDataSourceService") protected void setDataSourceService(DataSourceService dataSourceService) { /* This is to avoid Task Manager Service Component getting initialized before the underlying datasources are registered */ @@ -99,6 +89,12 @@ public class TaskManagerServiceComponent { //do nothing } + @Reference( + name = "task.service", + service = org.wso2.carbon.ntask.core.service.TaskService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetTaskService") @SuppressWarnings("unused") public void setTaskService(TaskService taskService) { if (log.isDebugEnabled()) { @@ -115,6 +111,12 @@ public class TaskManagerServiceComponent { TaskManagerDataHolder.getInstance().setnTaskService(null); } + @Reference( + name = "heartbeat.service", + service = io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service.HeartBeatManagementService.class, + cardinality = ReferenceCardinality.OPTIONAL, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetHeartBeatService") @SuppressWarnings("unused") protected void setHeartBeatService(HeartBeatManagementService heartBeatService) { if (log.isDebugEnabled()) { diff --git a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/src/main/java/io/entgra/device/mgt/core/task/mgt/core/service/TaskManagementServiceImpl.java b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/src/main/java/io/entgra/device/mgt/core/task/mgt/core/service/TaskManagementServiceImpl.java index 4a8252a36b..285456ce0a 100755 --- a/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/src/main/java/io/entgra/device/mgt/core/task/mgt/core/service/TaskManagementServiceImpl.java +++ b/components/task-mgt/task-manager/io.entgra.device.mgt.core.task.mgt.core/src/main/java/io/entgra/device/mgt/core/task/mgt/core/service/TaskManagementServiceImpl.java @@ -17,10 +17,6 @@ */ package io.entgra.device.mgt.core.task.mgt.core.service; -import io.entgra.device.mgt.core.task.mgt.core.dao.DynamicTaskPropDAO; -import io.entgra.device.mgt.core.task.mgt.core.dao.common.TaskManagementDAOFactory; -import io.entgra.device.mgt.core.task.mgt.core.internal.TaskManagerDataHolder; -import io.entgra.device.mgt.core.task.mgt.core.util.TaskManagementUtil; import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.exception.HeartBeatManagementException; import io.entgra.device.mgt.core.task.mgt.common.bean.DynamicTask; import io.entgra.device.mgt.core.task.mgt.common.constant.TaskMgtConstants; @@ -30,6 +26,10 @@ import io.entgra.device.mgt.core.task.mgt.common.exception.TaskNotFoundException import io.entgra.device.mgt.core.task.mgt.common.exception.TransactionManagementException; import io.entgra.device.mgt.core.task.mgt.common.spi.TaskManagementService; import io.entgra.device.mgt.core.task.mgt.core.dao.DynamicTaskDAO; +import io.entgra.device.mgt.core.task.mgt.core.dao.DynamicTaskPropDAO; +import io.entgra.device.mgt.core.task.mgt.core.dao.common.TaskManagementDAOFactory; +import io.entgra.device.mgt.core.task.mgt.core.internal.TaskManagerDataHolder; +import io.entgra.device.mgt.core.task.mgt.core.util.TaskManagementUtil; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/pom.xml b/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/pom.xml index ade57069d5..e6c32be204 100755 --- a/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/pom.xml +++ b/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/pom.xml @@ -35,8 +35,12 @@ - org.apache.felix - maven-scr-plugin + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + org.apache.felix @@ -50,18 +54,27 @@ Task Watcher Bundle io.entgra.device.mgt.core.task.mgt.watcher.internal - io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.*, - io.entgra.device.mgt.core.task.mgt.common.*, - io.entgra.device.mgt.core.task.mgt.core.*, - org.apache.commons.logging, + io.entgra.device.mgt.core.device.mgt.common;version="[5.0,6)", + io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.exception;version="[5.0,6)", + io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service;version="[5.0,6)", + io.entgra.device.mgt.core.task.mgt.common.bean;version="[5.0,6)", + io.entgra.device.mgt.core.task.mgt.common.exception;version="[5.0,6)", + io.entgra.device.mgt.core.task.mgt.common.spi;version="[5.0,6)", + io.entgra.device.mgt.core.task.mgt.core.config;version="[5.0,6)", + io.entgra.device.mgt.core.task.mgt.core.util;version="[5.0,6)", + io.entgra.device.mgt.core.task.mgt.watcher, + io.entgra.device.mgt.core.task.mgt.watcher.internal, + org.apache.commons.logging;version="[1.2,2)", org.osgi.framework.*;version="${imp.package.version.osgi.framework}", org.osgi.service.*;version="${imp.package.version.osgi.service}", - org.wso2.carbon.context, - org.wso2.carbon.core, - io.entgra.device.mgt.core.device.mgt.common.*, - org.wso2.carbon.ntask.*, - org.wso2.carbon.user.api, - org.wso2.carbon.user.core.*, + org.wso2.carbon.context;version="[4.8,5)", + org.wso2.carbon.core;version="[4.8,5)", + org.wso2.carbon.ntask.common;version="[4.9,5)", + org.wso2.carbon.ntask.core;version="[4.9,5)", + org.wso2.carbon.ntask.core.service;version="[4.9,5)", + org.wso2.carbon.user.api;version="[1.0,2)", + org.wso2.carbon.user.core.service;version="[4.8,5)", + org.wso2.carbon.user.core.tenant;version="[4.8,5)" io.entgra.device.mgt.core.task.mgt.watcher.* @@ -74,20 +87,14 @@ - org.eclipse.osgi - org.eclipse.osgi - provided - - - org.eclipse.osgi - org.eclipse.osgi.services + org.apache.felix + org.apache.felix.scr.ds-annotations provided org.ops4j.pax.logging pax-logging-api provided - io.entgra.device.mgt.core diff --git a/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/src/main/java/io/entgra/device/mgt/core/task/mgt/watcher/IoTSStartupHandler.java b/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/src/main/java/io/entgra/device/mgt/core/task/mgt/watcher/IoTSStartupHandler.java index 8d51a240cc..716c3cabf9 100755 --- a/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/src/main/java/io/entgra/device/mgt/core/task/mgt/watcher/IoTSStartupHandler.java +++ b/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/src/main/java/io/entgra/device/mgt/core/task/mgt/watcher/IoTSStartupHandler.java @@ -36,14 +36,7 @@ import org.wso2.carbon.user.api.Tenant; import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.user.core.service.RealmService; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.Timer; -import java.util.TimerTask; +import java.util.*; public class IoTSStartupHandler implements ServerStartupObserver { private static final Log log = LogFactory.getLog(IoTSStartupHandler.class); diff --git a/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/src/main/java/io/entgra/device/mgt/core/task/mgt/watcher/internal/TaskWatcherServiceComponent.java b/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/src/main/java/io/entgra/device/mgt/core/task/mgt/watcher/internal/TaskWatcherServiceComponent.java index a84e3e5f42..138269395f 100755 --- a/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/src/main/java/io/entgra/device/mgt/core/task/mgt/watcher/internal/TaskWatcherServiceComponent.java +++ b/components/task-mgt/task-watcher/io.entgra.device.mgt.core.task.mgt.watcher/src/main/java/io/entgra/device/mgt/core/task/mgt/watcher/internal/TaskWatcherServiceComponent.java @@ -17,11 +17,11 @@ */ package io.entgra.device.mgt.core.task.mgt.watcher.internal; +import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service.HeartBeatManagementService; import io.entgra.device.mgt.core.task.mgt.common.spi.TaskManagementService; import io.entgra.device.mgt.core.task.mgt.core.config.TaskConfigurationManager; import io.entgra.device.mgt.core.task.mgt.core.config.TaskManagementConfig; import io.entgra.device.mgt.core.task.mgt.watcher.IoTSStartupHandler; -import io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service.HeartBeatManagementService; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.framework.BundleContext; @@ -29,39 +29,16 @@ import org.osgi.service.component.ComponentContext; import org.wso2.carbon.core.ServerStartupObserver; import org.wso2.carbon.ntask.core.service.TaskService; import org.wso2.carbon.user.core.service.RealmService; +import org.osgi.service.component.annotations.*; -/** - * @scr.component - * name="io.entgra.device.mgt.core.task.mgt.watcher" immediate="true" - * @scr.reference name="app.mgt.ntask.component" - * interface="org.wso2.carbon.ntask.core.service.TaskService" - * cardinality="1..1" - * policy="dynamic" - * bind="setTaskService" - * unbind="unsetTaskService" - * @scr.reference name="io.entgra.task.mgt.service" - * interface="io.entgra.device.mgt.core.task.mgt.common.spi.TaskManagementService" - * cardinality="1..1" - * policy="dynamic" - * bind="setTaskMgtService" - * unbind="unsetTaskMgtService" - * @scr.reference name="entgra.heart.beat.service" - * interface="io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service.HeartBeatManagementService" - * cardinality="0..1" - * policy="dynamic" - * bind="setHeartBeatService" - * unbind="unsetHeartBeatService" - * @scr.reference name="user.realmservice.default" - * interface="org.wso2.carbon.user.core.service.RealmService" - * cardinality="1..1" - * policy="dynamic" - * bind="setRealmService" - * unbind="unsetRealmService" - */ +@Component( + name = "io.entgra.device.mgt.core.task.mgt.watcher.internal.TaskWatcherServiceComponent", + immediate = true) public class TaskWatcherServiceComponent { private static final Log log = LogFactory.getLog(TaskWatcherServiceComponent.class); + @Activate protected void activate(ComponentContext ctx) { if (log.isDebugEnabled()) { log.debug("Activating Task Watcher Service Component"); @@ -83,7 +60,7 @@ public class TaskWatcherServiceComponent { log.error("Error occurred while activating Task Watcher Service Component", e); } } - + @Deactivate protected void deactivate(ComponentContext ctx) { if (log.isDebugEnabled()) { log.debug("De-activating Task Watcher Service Component"); @@ -91,6 +68,12 @@ public class TaskWatcherServiceComponent { } @SuppressWarnings("unused") + @Reference( + name = "task.service", + service = org.wso2.carbon.ntask.core.service.TaskService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetTaskService") public void setTaskService(TaskService taskService) { if (log.isDebugEnabled()) { log.debug("Setting the task service to Task Watcher Service Component "); @@ -107,6 +90,12 @@ public class TaskWatcherServiceComponent { } @SuppressWarnings("unused") + @Reference( + name = "task.mgt.service", + service = io.entgra.device.mgt.core.task.mgt.common.spi.TaskManagementService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetTaskMgtService") protected void setTaskMgtService(TaskManagementService taskManagementService) { if (log.isDebugEnabled()) { log.debug("Setting the task service to Task Watcher Service Component "); @@ -121,6 +110,12 @@ public class TaskWatcherServiceComponent { } TaskWatcherDataHolder.getInstance().setTaskManagementService(null); } + @Reference( + name = "heartbeat.service", + service = io.entgra.device.mgt.core.server.bootup.heartbeat.beacon.service.HeartBeatManagementService.class, + cardinality = ReferenceCardinality.OPTIONAL, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetHeartBeatService") @SuppressWarnings("unused") protected void setHeartBeatService(HeartBeatManagementService heartBeatService) { @@ -144,6 +139,12 @@ public class TaskWatcherServiceComponent { * @param realmService An instance of RealmService */ @SuppressWarnings("unused") + @Reference( + name = "realm.service", + service = org.wso2.carbon.user.core.service.RealmService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRealmService") protected void setRealmService(RealmService realmService) { if (log.isDebugEnabled()) { log.debug("Setting Realm Service"); diff --git a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/pom.xml b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/pom.xml index 7db50aadbf..1d07439a11 100644 --- a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/pom.xml +++ b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.common/pom.xml @@ -32,6 +32,14 @@ + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + org.apache.felix maven-bundle-plugin @@ -43,8 +51,8 @@ ${io.entgra.device.mgt.core.version} Tenant Management Common Bundle - org.apache.commons.logging, - org.wso2.carbon.stratos.common.beans + io.entgra.device.mgt.core.tenant.mgt.common.exception, + org.wso2.carbon.stratos.common.beans;version="[4.9,5)" io.entgra.device.mgt.core.tenant.mgt.common.* diff --git a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml index 94feb15285..5ed3918990 100644 --- a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml +++ b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/pom.xml @@ -33,8 +33,12 @@ - org.apache.felix - maven-scr-plugin + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + org.apache.felix @@ -48,26 +52,29 @@ Tenant Management Core Bundle io.entgra.device.mgt.core.tenant.mgt.core.internal + io.entgra.device.mgt.core.application.mgt.common.exception;version="[5.0,6)", + io.entgra.device.mgt.core.application.mgt.common.services;version="[5.0,6)", + io.entgra.device.mgt.core.application.mgt.core.config;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.exceptions;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.metadata.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.permission.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.roles.config;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.core.config;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.core.metadata.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.core.permission.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.tenant.mgt.common.exception;version="[5.0,6)", + io.entgra.device.mgt.core.tenant.mgt.common.spi;version="[5.0,6)", + io.entgra.device.mgt.core.tenant.mgt.core, + org.apache.commons.logging;version="[1.2,2)", org.osgi.framework.*;version="${imp.package.version.osgi.framework}", org.osgi.service.*;version="${imp.package.version.osgi.service}", - org.apache.commons.logging, - io.entgra.device.mgt.core.application.mgt.common.*, - io.entgra.device.mgt.core.application.mgt.core.config, - io.entgra.device.mgt.core.device.mgt.core, - org.wso2.carbon.user.api, - org.wso2.carbon.registry.core.exceptions, - io.entgra.device.mgt.core.tenant.mgt.common.*, - org.wso2.carbon.stratos.common.beans, - org.wso2.carbon.stratos.common.exception, - org.wso2.carbon.stratos.common.listeners, - io.entgra.device.mgt.core.device.mgt.common.metadata.mgt, - io.entgra.device.mgt.core.device.mgt.common.exceptions, - io.entgra.device.mgt.core.device.mgt.common.permission.mgt, - io.entgra.device.mgt.core.device.mgt.common.roles.config, - io.entgra.device.mgt.core.device.mgt.core.metadata.mgt, - io.entgra.device.mgt.core.device.mgt.core.config, - org.wso2.carbon.user.core.service, - org.wso2.carbon.context + org.wso2.carbon.context;version="[4.8,5)", + org.wso2.carbon.registry.core.exceptions;version="[1.0,2)", + org.wso2.carbon.stratos.common.beans;version="[4.9,5)", + org.wso2.carbon.stratos.common.exception;version="[4.9,5)", + org.wso2.carbon.stratos.common.listeners;version="[4.9,5)", + org.wso2.carbon.user.api;version="[1.0,2)", + org.wso2.carbon.user.core.service;version="[4.8,5)" !io.entgra.device.mgt.core.tenant.mgt.core.internal, @@ -81,12 +88,9 @@ - org.eclipse.osgi - org.eclipse.osgi - - - org.eclipse.osgi - org.eclipse.osgi.services + org.apache.felix + org.apache.felix.scr.ds-annotations + provided org.wso2.carbon.commons diff --git a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/impl/TenantManagerImpl.java b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/impl/TenantManagerImpl.java index edfb95360b..3ca9889ffd 100644 --- a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/impl/TenantManagerImpl.java +++ b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/impl/TenantManagerImpl.java @@ -18,23 +18,23 @@ package io.entgra.device.mgt.core.tenant.mgt.core.impl; import io.entgra.device.mgt.core.application.mgt.common.exception.ApplicationManagementException; -import io.entgra.device.mgt.core.application.mgt.core.config.ConfigurationManager; import io.entgra.device.mgt.core.application.mgt.common.services.ApplicationManager; -import io.entgra.device.mgt.core.tenant.mgt.core.TenantManager; +import io.entgra.device.mgt.core.application.mgt.core.config.ConfigurationManager; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataManagementException; +import io.entgra.device.mgt.core.device.mgt.common.permission.mgt.PermissionManagementException; +import io.entgra.device.mgt.core.device.mgt.common.roles.config.Role; +import io.entgra.device.mgt.core.device.mgt.core.config.DeviceConfigurationManager; +import io.entgra.device.mgt.core.device.mgt.core.config.DeviceManagementConfig; +import io.entgra.device.mgt.core.device.mgt.core.permission.mgt.PermissionUtils; import io.entgra.device.mgt.core.tenant.mgt.common.exception.TenantMgtException; +import io.entgra.device.mgt.core.tenant.mgt.core.TenantManager; import io.entgra.device.mgt.core.tenant.mgt.core.internal.TenantMgtDataHolder; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.context.PrivilegedCarbonContext; -import io.entgra.device.mgt.core.device.mgt.core.config.DeviceConfigurationManager; -import io.entgra.device.mgt.core.device.mgt.core.config.DeviceManagementConfig; -import io.entgra.device.mgt.core.device.mgt.core.permission.mgt.PermissionUtils; import org.wso2.carbon.registry.core.exceptions.RegistryException; import org.wso2.carbon.stratos.common.beans.TenantInfoBean; import org.wso2.carbon.user.api.Permission; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.MetadataManagementException; -import io.entgra.device.mgt.core.device.mgt.common.permission.mgt.PermissionManagementException; -import io.entgra.device.mgt.core.device.mgt.common.roles.config.Role; import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.user.api.UserStoreManager; diff --git a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/impl/TenantManagerServiceImpl.java b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/impl/TenantManagerServiceImpl.java index 79de1b0000..6153ef671c 100644 --- a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/impl/TenantManagerServiceImpl.java +++ b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/impl/TenantManagerServiceImpl.java @@ -17,8 +17,8 @@ */ package io.entgra.device.mgt.core.tenant.mgt.core.impl; -import io.entgra.device.mgt.core.tenant.mgt.common.spi.TenantManagerService; import io.entgra.device.mgt.core.tenant.mgt.common.exception.TenantMgtException; +import io.entgra.device.mgt.core.tenant.mgt.common.spi.TenantManagerService; import io.entgra.device.mgt.core.tenant.mgt.core.internal.TenantMgtDataHolder; import org.wso2.carbon.stratos.common.beans.TenantInfoBean; diff --git a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/internal/TenantMgtDataHolder.java b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/internal/TenantMgtDataHolder.java index 7c34b3c177..74eb25e5ca 100644 --- a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/internal/TenantMgtDataHolder.java +++ b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/internal/TenantMgtDataHolder.java @@ -18,8 +18,8 @@ package io.entgra.device.mgt.core.tenant.mgt.core.internal; import io.entgra.device.mgt.core.application.mgt.common.services.ApplicationManager; -import io.entgra.device.mgt.core.tenant.mgt.core.TenantManager; import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.WhiteLabelManagementService; +import io.entgra.device.mgt.core.tenant.mgt.core.TenantManager; import org.wso2.carbon.user.core.service.RealmService; public class TenantMgtDataHolder { diff --git a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/internal/TenantMgtServiceComponent.java b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/internal/TenantMgtServiceComponent.java index 7c7210213c..e88fdf6daf 100644 --- a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/internal/TenantMgtServiceComponent.java +++ b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/internal/TenantMgtServiceComponent.java @@ -18,6 +18,8 @@ package io.entgra.device.mgt.core.tenant.mgt.core.internal; import io.entgra.device.mgt.core.application.mgt.common.services.ApplicationManager; +import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.WhiteLabelManagementService; +import io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.WhiteLabelManagementServiceImpl; import io.entgra.device.mgt.core.tenant.mgt.common.spi.TenantManagerService; import io.entgra.device.mgt.core.tenant.mgt.core.TenantManager; import io.entgra.device.mgt.core.tenant.mgt.core.impl.TenantManagerImpl; @@ -26,33 +28,20 @@ import io.entgra.device.mgt.core.tenant.mgt.core.listener.DeviceMgtTenantListene import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.service.component.ComponentContext; -import io.entgra.device.mgt.core.device.mgt.common.metadata.mgt.WhiteLabelManagementService; -import io.entgra.device.mgt.core.device.mgt.core.metadata.mgt.WhiteLabelManagementServiceImpl; +import org.osgi.service.component.annotations.*; import org.wso2.carbon.stratos.common.listeners.TenantMgtListener; import org.wso2.carbon.user.core.service.RealmService; -/** - * @scr.component name="io.entgra.device.mgt.core.tenant.manager" immediate="true" - * @scr.reference name="org.wso2.carbon.application.mgt.service" - * interface="io.entgra.device.mgt.core.application.mgt.common.services.ApplicationManager" - * cardinality="1..1" - * policy="dynamic" - * bind="setApplicationManager" - * unbind="unsetApplicationManager" - * @scr.reference name="user.realmservice.default" - * interface="org.wso2.carbon.user.core.service.RealmService" - * cardinality="1..1" - * policy="dynamic" - * bind="setRealmService" - * unbind="unsetRealmService" - */ - +@Component( + name = "io.entgra.device.mgt.core.tenant.mgt.core.internal.TenantMgtServiceComponent", + immediate = true) @SuppressWarnings("unused") public class TenantMgtServiceComponent { private static final Log log = LogFactory.getLog(TenantManagerService.class); @SuppressWarnings("unused") + @Activate protected void activate(ComponentContext componentContext) { try { TenantManagerService tenantManagerService = new TenantManagerServiceImpl(); @@ -80,10 +69,17 @@ public class TenantMgtServiceComponent { } @SuppressWarnings("unused") + @Deactivate protected void deactivate(ComponentContext componentContext) { // nothing to do } + @Reference( + name = "application.mgr", + service = io.entgra.device.mgt.core.application.mgt.common.services.ApplicationManager.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetApplicationManager") protected void setApplicationManager(ApplicationManager applicationManager) { if(log.isDebugEnabled()) { log.info("Application manager service is binding"); @@ -98,6 +94,12 @@ public class TenantMgtServiceComponent { TenantMgtDataHolder.getInstance().setApplicationManager(null); } + @Reference( + name = "realm.service", + service = org.wso2.carbon.user.core.service.RealmService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRealmService") protected void setRealmService(RealmService realmService) { if(log.isDebugEnabled()) { log.info("Realm Service service is binding"); diff --git a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/listener/DeviceMgtTenantListener.java b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/listener/DeviceMgtTenantListener.java index 40b58efe7e..6f07af0372 100644 --- a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/listener/DeviceMgtTenantListener.java +++ b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/listener/DeviceMgtTenantListener.java @@ -17,8 +17,8 @@ */ package io.entgra.device.mgt.core.tenant.mgt.core.listener; -import io.entgra.device.mgt.core.tenant.mgt.core.TenantManager; import io.entgra.device.mgt.core.tenant.mgt.common.exception.TenantMgtException; +import io.entgra.device.mgt.core.tenant.mgt.core.TenantManager; import io.entgra.device.mgt.core.tenant.mgt.core.internal.TenantMgtDataHolder; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/pom.xml b/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/pom.xml index b372415435..2b70f9001d 100644 --- a/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/pom.xml +++ b/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/pom.xml @@ -31,13 +31,17 @@ bundle WSO2 Carbon - Email Sender Core WSO2 Carbon - Email Sender Core - http://wso2.org + https://entgra.io - org.apache.felix - maven-scr-plugin + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + org.apache.felix @@ -51,27 +55,33 @@ Email Management Core Bundle io.entgra.device.mgt.core.transport.mgt.email.sender.core.internal - org.apache.axis2.*;version="${axis2.osgi.version.range}", - org.apache.axiom.*; version="${axiom.osgi.version.range}", + io.entgra.device.mgt.core.transport.mgt.email.sender.core, + javax.xml.bind;version="[0.0,1)", + javax.xml.bind.annotation;version="[0.0,1)", + javax.xml.parsers, + javax.xml.stream;version="[1.0,2)", + org.apache.axiom.om;version="[1.2,2)", + org.apache.axiom.om.impl.llom.util;version="[1.2,2)", + org.apache.axis2;version="[1.6,2)", + org.apache.axis2.addressing;version="[1.6,2)", + org.apache.axis2.client;version="[1.6,2)", + org.apache.axis2.context;version="[1.6,2)", + org.apache.axis2.description;version="[1.6,2)", + org.apache.axis2.engine;version="[1.6,2)", + org.apache.commons.io;version="[2.4,3)", + org.apache.commons.logging;version="[1.2,2)", + org.apache.velocity;version="[2.3,3)", + org.apache.velocity.app;version="[2.3,3)", + org.apache.velocity.context;version="[2.3,3)", + org.apache.velocity.exception;version="[2.3,3)", + org.apache.velocity.runtime.resource;version="[2.3,3)", + org.apache.velocity.runtime.resource.loader;version="[2.3,3)", + org.apache.velocity.util;version="[2.3,3)", org.osgi.framework.*;version="${imp.package.version.osgi.framework}", org.osgi.service.*;version="${imp.package.version.osgi.service}", - org.apache.commons.logging, - javax.xml.parsers;version="${javax.xml.parsers.import.pkg.version}";resolution:=optional, - org.wso2.carbon.context, - org.wso2.carbon.utils.*, - org.wso2.carbon.registry.api, org.w3c.dom, - org.apache.velocity;version="${velocity.version}", - org.apache.velocity.app;version="${velocity.version}", - org.apache.velocity.context;version="${velocity.version}", - org.apache.velocity.exception;version="${velocity.version}", - org.apache.velocity.runtime.resource;version="${velocity.version}", - org.apache.velocity.runtime.resource.loader;version="${velocity.version}", - org.apache.commons.io, - org.apache.axis2.transport.mail, - org.wso2.carbon.registry.core.service, - org.wso2.carbon.registry.core.session, - org.apache.commons.collections + org.wso2.carbon.context;version="[4.8,5)", + org.wso2.carbon.utils;version="[4.8,5)" !io.entgra.device.mgt.core.transport.mgt.email.sender.core.internal, @@ -80,61 +90,19 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.eclipse.osgi - org.eclipse.osgi - - - org.eclipse.osgi - org.eclipse.osgi.services + org.apache.felix + org.apache.felix.scr.ds-annotations + provided org.ops4j.pax.logging pax-logging-api provided - org.wso2.carbon @@ -144,10 +112,6 @@ org.testng testng - - org.wso2.carbon - org.wso2.carbon.registry.api - org.wso2.carbon org.wso2.carbon.base @@ -157,8 +121,8 @@ axis2 - org.wso2.orbit.org.apache.velocity - velocity + org.apache.velocity + velocity-engine-core commons-io.wso2 @@ -168,10 +132,6 @@ org.apache.axis2.transport axis2-transport-mail - - org.wso2.carbon - org.wso2.carbon.registry.core - commons-collections.wso2 commons-collections diff --git a/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/src/main/java/io/entgra/device/mgt/core/transport/mgt/email/sender/core/EmailContext.java b/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/src/main/java/io/entgra/device/mgt/core/transport/mgt/email/sender/core/EmailContext.java index 5b54b36c07..cffe749ea5 100644 --- a/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/src/main/java/io/entgra/device/mgt/core/transport/mgt/email/sender/core/EmailContext.java +++ b/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/src/main/java/io/entgra/device/mgt/core/transport/mgt/email/sender/core/EmailContext.java @@ -17,7 +17,9 @@ */ package io.entgra.device.mgt.core.transport.mgt.email.sender.core; -import java.util.*; +import java.util.HashSet; +import java.util.Properties; +import java.util.Set; public class EmailContext { diff --git a/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/src/main/java/io/entgra/device/mgt/core/transport/mgt/email/sender/core/RegistryBasedResourceLoader.java b/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/src/main/java/io/entgra/device/mgt/core/transport/mgt/email/sender/core/RegistryBasedResourceLoader.java index 5c59bdfcb5..afdd807b52 100644 --- a/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/src/main/java/io/entgra/device/mgt/core/transport/mgt/email/sender/core/RegistryBasedResourceLoader.java +++ b/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/src/main/java/io/entgra/device/mgt/core/transport/mgt/email/sender/core/RegistryBasedResourceLoader.java @@ -17,44 +17,63 @@ */ package io.entgra.device.mgt.core.transport.mgt.email.sender.core; -import org.apache.commons.collections.ExtendedProperties; import org.apache.velocity.exception.ResourceNotFoundException; import org.apache.velocity.runtime.resource.Resource; import org.apache.velocity.runtime.resource.loader.ResourceLoader; -import org.wso2.carbon.context.CarbonContext; -import org.wso2.carbon.context.RegistryType; -import org.wso2.carbon.registry.api.Registry; -import org.wso2.carbon.registry.api.RegistryException; +import org.apache.velocity.util.ExtProperties; import java.io.InputStream; +import java.io.Reader; public class RegistryBasedResourceLoader extends ResourceLoader { private static final String EMAIL_CONFIG_BASE_LOCATION = "email-templates"; @Override - public void init(ExtendedProperties extendedProperties) { + public void init(ExtProperties extProperties) { } @Override + public Reader getResourceReader(String name, String encoding) throws ResourceNotFoundException { +// try { +// Registry registry = +// CarbonContext.getThreadLocalCarbonContext().getRegistry(RegistryType.SYSTEM_CONFIGURATION); +// if (registry == null) { +// throw new IllegalStateException("No valid registry instance is attached to the current carbon context"); +// } +// if (!registry.resourceExists(EMAIL_CONFIG_BASE_LOCATION + "/" + name)) { +// throw new ResourceNotFoundException("Resource '" + name + "' does not exist"); +// } +// org.wso2.carbon.registry.api.Resource resource = +// registry.get(EMAIL_CONFIG_BASE_LOCATION + "/" + name); +// resource.setMediaType("text/plain"); +// +// return new InputStreamReader(resource.getContentStream()); +// } catch (RegistryException e) { +// throw new ResourceNotFoundException("Error occurred while retrieving resource", e); +// } + return null; + } + public InputStream getResourceStream(String name) throws ResourceNotFoundException { - try { - Registry registry = - CarbonContext.getThreadLocalCarbonContext().getRegistry(RegistryType.SYSTEM_CONFIGURATION); - if (registry == null) { - throw new IllegalStateException("No valid registry instance is attached to the current carbon context"); - } - if (!registry.resourceExists(EMAIL_CONFIG_BASE_LOCATION + "/" + name)) { - throw new ResourceNotFoundException("Resource '" + name + "' does not exist"); - } - org.wso2.carbon.registry.api.Resource resource = - registry.get(EMAIL_CONFIG_BASE_LOCATION + "/" + name); - resource.setMediaType("text/plain"); - return resource.getContentStream(); - } catch (RegistryException e) { - throw new ResourceNotFoundException("Error occurred while retrieving resource", e); - } +// try { +// Registry registry = +// CarbonContext.getThreadLocalCarbonContext().getRegistry(RegistryType.SYSTEM_CONFIGURATION); +// if (registry == null) { +// throw new IllegalStateException("No valid registry instance is attached to the current carbon context"); +// } +// if (!registry.resourceExists(EMAIL_CONFIG_BASE_LOCATION + "/" + name)) { +// throw new ResourceNotFoundException("Resource '" + name + "' does not exist"); +// } +// org.wso2.carbon.registry.api.Resource resource = +// registry.get(EMAIL_CONFIG_BASE_LOCATION + "/" + name); +// resource.setMediaType("text/plain"); +// return resource.getContentStream(); +// } catch (RegistryException e) { +// throw new ResourceNotFoundException("Error occurred while retrieving resource", e); +// } + return null; } @Override diff --git a/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/src/main/java/io/entgra/device/mgt/core/transport/mgt/email/sender/core/VelocityBasedEmailContentProvider.java b/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/src/main/java/io/entgra/device/mgt/core/transport/mgt/email/sender/core/VelocityBasedEmailContentProvider.java index ac40d746e2..98a962ffdb 100644 --- a/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/src/main/java/io/entgra/device/mgt/core/transport/mgt/email/sender/core/VelocityBasedEmailContentProvider.java +++ b/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/src/main/java/io/entgra/device/mgt/core/transport/mgt/email/sender/core/VelocityBasedEmailContentProvider.java @@ -22,18 +22,13 @@ import org.apache.commons.logging.LogFactory; import org.apache.velocity.Template; import org.apache.velocity.VelocityContext; import org.apache.velocity.app.VelocityEngine; -import org.apache.velocity.runtime.resource.loader.ResourceLoader; -import org.wso2.carbon.context.CarbonContext; -import org.wso2.carbon.context.RegistryType; -import org.wso2.carbon.registry.api.Registry; +import org.apache.velocity.runtime.RuntimeConstants; +import org.wso2.carbon.utils.CarbonUtils; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Unmarshaller; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.StringWriter; +import java.io.*; import java.util.Map; public class VelocityBasedEmailContentProvider implements EmailContentProvider { @@ -41,12 +36,11 @@ public class VelocityBasedEmailContentProvider implements EmailContentProvider { private VelocityEngine engine; private static final Log log = LogFactory.getLog(VelocityBasedEmailContentProvider.class); + private static final String EMAIL_TEMPLATE_PATH = "repository" + File.separator + + "resources" + File.separator + "email-templates"; public VelocityBasedEmailContentProvider() { engine = new VelocityEngine(); - engine.setProperty("resource.loader", "registry"); - engine.setProperty("velocimacro.library", ""); - engine.setProperty("registry.resource.loader.class", - "io.entgra.device.mgt.core.transport.mgt.email.sender.core.RegistryBasedResourceLoader"); + engine.setProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, CarbonUtils.getCarbonHome()); engine.init(); } @@ -57,7 +51,7 @@ public class VelocityBasedEmailContentProvider implements EmailContentProvider { for (Map.Entry, Object>> param : params.entrySet()) { ctx.put(param.getKey(), param.getValue().getValue()); } - Template template = engine.getTemplate(name); + Template template = engine.getTemplate(EMAIL_TEMPLATE_PATH + File.separator + name + ".vm"); StringWriter content = new StringWriter(); template.merge(ctx, content); diff --git a/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/src/main/java/io/entgra/device/mgt/core/transport/mgt/email/sender/core/internal/EmailSenderAxis2ConfigContextObserver.java b/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/src/main/java/io/entgra/device/mgt/core/transport/mgt/email/sender/core/internal/EmailSenderAxis2ConfigContextObserver.java index 3c05662e0f..e43243e69b 100644 --- a/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/src/main/java/io/entgra/device/mgt/core/transport/mgt/email/sender/core/internal/EmailSenderAxis2ConfigContextObserver.java +++ b/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/src/main/java/io/entgra/device/mgt/core/transport/mgt/email/sender/core/internal/EmailSenderAxis2ConfigContextObserver.java @@ -17,10 +17,10 @@ */ package io.entgra.device.mgt.core.transport.mgt.email.sender.core.internal; +import io.entgra.device.mgt.core.transport.mgt.email.sender.core.EmailSenderConfigurationFailedException; import org.apache.axis2.context.ConfigurationContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.transport.mgt.email.sender.core.EmailSenderConfigurationFailedException; import org.wso2.carbon.utils.Axis2ConfigurationContextObserver; class EmailSenderAxis2ConfigContextObserver implements Axis2ConfigurationContextObserver { diff --git a/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/src/main/java/io/entgra/device/mgt/core/transport/mgt/email/sender/core/internal/EmailSenderDataHolder.java b/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/src/main/java/io/entgra/device/mgt/core/transport/mgt/email/sender/core/internal/EmailSenderDataHolder.java index 5c5936d8bf..def2e53fe2 100644 --- a/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/src/main/java/io/entgra/device/mgt/core/transport/mgt/email/sender/core/internal/EmailSenderDataHolder.java +++ b/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/src/main/java/io/entgra/device/mgt/core/transport/mgt/email/sender/core/internal/EmailSenderDataHolder.java @@ -19,12 +19,11 @@ package io.entgra.device.mgt.core.transport.mgt.email.sender.core.internal; import io.entgra.device.mgt.core.transport.mgt.email.sender.core.service.EmailSenderService; -import org.wso2.carbon.registry.core.service.RegistryService; import org.wso2.carbon.utils.ConfigurationContextService; public class EmailSenderDataHolder { - private RegistryService registryService; +// private RegistryService registryService; private ConfigurationContextService configurationContextService; private EmailSenderService emailServiceProvider; @@ -36,16 +35,16 @@ public class EmailSenderDataHolder { return thisInstance; } - public RegistryService getRegistryService() { - if (registryService == null) { - throw new IllegalStateException("Registry service is not initialized properly"); - } - return registryService; - } - - public void setRegistryService(RegistryService registryService) { - this.registryService = registryService; - } +// public RegistryService getRegistryService() { +// if (registryService == null) { +// throw new IllegalStateException("Registry service is not initialized properly"); +// } +// return registryService; +// } +// +// public void setRegistryService(RegistryService registryService) { +// this.registryService = registryService; +// } public ConfigurationContextService getConfigurationContextService() { if (configurationContextService == null) { diff --git a/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/src/main/java/io/entgra/device/mgt/core/transport/mgt/email/sender/core/internal/EmailSenderServiceComponent.java b/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/src/main/java/io/entgra/device/mgt/core/transport/mgt/email/sender/core/internal/EmailSenderServiceComponent.java index 45157d24f4..3a6ce00f32 100644 --- a/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/src/main/java/io/entgra/device/mgt/core/transport/mgt/email/sender/core/internal/EmailSenderServiceComponent.java +++ b/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/src/main/java/io/entgra/device/mgt/core/transport/mgt/email/sender/core/internal/EmailSenderServiceComponent.java @@ -17,37 +17,25 @@ */ package io.entgra.device.mgt.core.transport.mgt.email.sender.core.internal; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.osgi.service.component.ComponentContext; import io.entgra.device.mgt.core.transport.mgt.email.sender.core.EmailSenderConfig; import io.entgra.device.mgt.core.transport.mgt.email.sender.core.service.EmailSenderService; import io.entgra.device.mgt.core.transport.mgt.email.sender.core.service.EmailSenderServiceImpl; -import org.wso2.carbon.registry.core.service.RegistryService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.*; import org.wso2.carbon.utils.Axis2ConfigurationContextObserver; import org.wso2.carbon.utils.ConfigurationContextService; -/** - * @scr.component name="io.entgra.device.mgt.core.email.sender.emailsendereervicecomponent" - * immediate="true" - * @scr.reference name="registry.service" - * interface="org.wso2.carbon.registry.core.service.RegistryService" - * cardinality="1..1" - * policy="dynamic" - * bind="setRegistryService" - * unbind="unsetRegistryService" - * @scr.reference name="config.context.service" - * interface="org.wso2.carbon.utils.ConfigurationContextService" - * cardinality="0..1" - * policy="dynamic" - * bind="setConfigurationContextService" - * unbind="unsetConfigurationContextService" - */ +@Component( + name = "io.entgra.device.mgt.core.transport.mgt.email.sender.core.internal.EmailSenderServiceComponent", + immediate = true) public class EmailSenderServiceComponent { private static Log log = LogFactory.getLog(EmailSenderServiceComponent.class); @SuppressWarnings("unused") + @Activate protected void activate(ComponentContext componentContext) { try { if (log.isDebugEnabled()) { @@ -73,6 +61,7 @@ public class EmailSenderServiceComponent { } @SuppressWarnings("unused") + @Deactivate protected void deactivate(ComponentContext componentContext) { //do nothing } @@ -86,30 +75,42 @@ public class EmailSenderServiceComponent { componentContext.getBundleContext().registerService(EmailSenderService.class, emailServiceProvider, null); } - /** - * Sets Registry Service. - * - * @param registryService An instance of RegistryService - */ - protected void setRegistryService(RegistryService registryService) { - if (log.isDebugEnabled()) { - log.debug("Setting Registry Service"); - } - EmailSenderDataHolder.getInstance().setRegistryService(registryService); - } - - /** - * Unsets Registry Service. - * - * @param registryService An instance of RegistryService - */ - protected void unsetRegistryService(RegistryService registryService) { - if (log.isDebugEnabled()) { - log.debug("Un setting Registry Service"); - } - EmailSenderDataHolder.getInstance().setRegistryService(null); - } +// /** +// * Sets Registry Service. +// * +// * @param registryService An instance of RegistryService +// */ +// @Reference( +// name = "registry.service", +// service = org.wso2.carbon.registry.core.service.RegistryService.class, +// cardinality = ReferenceCardinality.MANDATORY, +// policy = ReferencePolicy.DYNAMIC, +// unbind = "unsetRegistryService") +// protected void setRegistryService(RegistryService registryService) { +// if (log.isDebugEnabled()) { +// log.debug("Setting Registry Service"); +// } +// EmailSenderDataHolder.getInstance().setRegistryService(registryService); +// } +// +// /** +// * Unsets Registry Service. +// * +// * @param registryService An instance of RegistryService +// */ +// protected void unsetRegistryService(RegistryService registryService) { +// if (log.isDebugEnabled()) { +// log.debug("Un setting Registry Service"); +// } +// EmailSenderDataHolder.getInstance().setRegistryService(null); +// } + @Reference( + name = "configuration.context.service", + service = org.wso2.carbon.utils.ConfigurationContextService.class, + cardinality = ReferenceCardinality.OPTIONAL, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetConfigurationContextService") protected void setConfigurationContextService(ConfigurationContextService configurationContextService) { if (log.isDebugEnabled()) { log.debug("Setting ConfigurationContextService"); diff --git a/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/src/main/java/io/entgra/device/mgt/core/transport/mgt/email/sender/core/internal/EmailUtils.java b/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/src/main/java/io/entgra/device/mgt/core/transport/mgt/email/sender/core/internal/EmailUtils.java index 4f89ad7f66..6e20932a80 100644 --- a/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/src/main/java/io/entgra/device/mgt/core/transport/mgt/email/sender/core/internal/EmailUtils.java +++ b/components/transport-mgt/email-sender/io.entgra.device.mgt.core.transport.mgt.email.sender.core/src/main/java/io/entgra/device/mgt/core/transport/mgt/email/sender/core/internal/EmailUtils.java @@ -17,20 +17,15 @@ */ package io.entgra.device.mgt.core.transport.mgt.email.sender.core.internal; +import io.entgra.device.mgt.core.transport.mgt.email.sender.core.EmailSenderConfigurationFailedException; import org.apache.commons.io.FileUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.context.CarbonContext; -import io.entgra.device.mgt.core.transport.mgt.email.sender.core.EmailSenderConfigurationFailedException; -import org.wso2.carbon.registry.api.Collection; -import org.wso2.carbon.registry.api.Registry; -import org.wso2.carbon.registry.api.RegistryException; -import org.wso2.carbon.registry.api.Resource; import org.wso2.carbon.utils.CarbonUtils; import java.io.File; import java.io.FileNotFoundException; -import java.io.FilenameFilter; import java.io.IOException; class EmailUtils { @@ -49,31 +44,11 @@ class EmailUtils { } } if (templateDir.canRead()) { - File[] templates = templateDir.listFiles(new FilenameFilter() { - @Override - public boolean accept(File dir, String name) { - name = name.toLowerCase(); - return name.endsWith(".vm"); - } - }); try { int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); - Registry registry = - EmailSenderDataHolder.getInstance().getRegistryService().getConfigSystemRegistry(tenantId); - if (!registry.resourceExists(EMAIL_TEMPLATE_DIR_RELATIVE_REGISTRY_PATH)) { - Collection collection = registry.newCollection(); - registry.put(EMAIL_TEMPLATE_DIR_RELATIVE_REGISTRY_PATH, collection); - for (File template : templates) { - Resource resource = registry.newResource(); - resource.setMediaType("text/plain"); - String contents = FileUtils.readFileToString(template); - resource.setContent(contents); - registry.put(EMAIL_TEMPLATE_DIR_RELATIVE_REGISTRY_PATH + "/" - + template.getName().replace(".vm", ""), resource); - } - } - } catch (RegistryException e) { - throw new EmailSenderConfigurationFailedException("Error occurred while setting up email templates", e); + String tenantTemplateDirectory = CarbonUtils.getCarbonTenantsDirPath() + File.separator + tenantId + File.separator; + File destinationDirectory = new File(tenantTemplateDirectory); + FileUtils.copyDirectoryToDirectory(templateDir, destinationDirectory); } catch (FileNotFoundException e) { throw new EmailSenderConfigurationFailedException("Error occurred while writing template file " + "contents as an input stream of a resource", e); diff --git a/components/transport-mgt/email-sender/pom.xml b/components/transport-mgt/email-sender/pom.xml index 511e64959c..77c2cf12cb 100644 --- a/components/transport-mgt/email-sender/pom.xml +++ b/components/transport-mgt/email-sender/pom.xml @@ -30,7 +30,7 @@ email-sender pom WSO2 Carbon - Email Sender Component - http://wso2.org + https://entgra.io io.entgra.device.mgt.core.transport.mgt.email.sender.core diff --git a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/pom.xml b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/pom.xml index de81d3d179..2e0dd266f5 100644 --- a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/pom.xml +++ b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/pom.xml @@ -133,7 +133,6 @@ org.ops4j.pax.logging pax-logging-api provided - io.entgra.device.mgt.core diff --git a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/src/main/java/io/entgra/device/mgt/core/transport/mgt/sms/handler/api/ConfigurationManagementService.java b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/src/main/java/io/entgra/device/mgt/core/transport/mgt/sms/handler/api/ConfigurationManagementService.java index fc2300a7fd..388270fb3b 100644 --- a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/src/main/java/io/entgra/device/mgt/core/transport/mgt/sms/handler/api/ConfigurationManagementService.java +++ b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/src/main/java/io/entgra/device/mgt/core/transport/mgt/sms/handler/api/ConfigurationManagementService.java @@ -18,19 +18,10 @@ package io.entgra.device.mgt.core.transport.mgt.sms.handler.api; -import io.entgra.device.mgt.core.transport.mgt.sms.handler.common.SMSHandlerConstants; -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 io.entgra.device.mgt.core.apimgt.annotations.Scope; import io.entgra.device.mgt.core.apimgt.annotations.Scopes; +import io.entgra.device.mgt.core.transport.mgt.sms.handler.common.SMSHandlerConstants; +import io.swagger.annotations.*; import javax.ws.rs.Consumes; import javax.ws.rs.GET; diff --git a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/src/main/java/io/entgra/device/mgt/core/transport/mgt/sms/handler/api/addons/ApiOriginFilter.java b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/src/main/java/io/entgra/device/mgt/core/transport/mgt/sms/handler/api/addons/ApiOriginFilter.java index 93568d35f2..af2a5c6e02 100644 --- a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/src/main/java/io/entgra/device/mgt/core/transport/mgt/sms/handler/api/addons/ApiOriginFilter.java +++ b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/src/main/java/io/entgra/device/mgt/core/transport/mgt/sms/handler/api/addons/ApiOriginFilter.java @@ -18,12 +18,7 @@ package io.entgra.device.mgt.core.transport.mgt.sms.handler.api.addons; -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.*; import javax.servlet.http.HttpServletResponse; import java.io.IOException; diff --git a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/src/main/java/io/entgra/device/mgt/core/transport/mgt/sms/handler/api/addons/GsonMessageBodyHandler.java b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/src/main/java/io/entgra/device/mgt/core/transport/mgt/sms/handler/api/addons/GsonMessageBodyHandler.java index d8707625b8..4aa7334727 100644 --- a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/src/main/java/io/entgra/device/mgt/core/transport/mgt/sms/handler/api/addons/GsonMessageBodyHandler.java +++ b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/src/main/java/io/entgra/device/mgt/core/transport/mgt/sms/handler/api/addons/GsonMessageBodyHandler.java @@ -24,11 +24,7 @@ import com.google.gson.GsonBuilder; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.OutputStreamWriter; +import java.io.*; import java.lang.annotation.Annotation; import java.lang.reflect.Type; diff --git a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/src/main/java/io/entgra/device/mgt/core/transport/mgt/sms/handler/api/impl/ConfigurationManagementServiceImpl.java b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/src/main/java/io/entgra/device/mgt/core/transport/mgt/sms/handler/api/impl/ConfigurationManagementServiceImpl.java index 636561c120..827654bb95 100644 --- a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/src/main/java/io/entgra/device/mgt/core/transport/mgt/sms/handler/api/impl/ConfigurationManagementServiceImpl.java +++ b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/src/main/java/io/entgra/device/mgt/core/transport/mgt/sms/handler/api/impl/ConfigurationManagementServiceImpl.java @@ -18,11 +18,11 @@ package io.entgra.device.mgt.core.transport.mgt.sms.handler.api.impl; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.transport.mgt.sms.handler.api.ConfigurationManagementService; import io.entgra.device.mgt.core.transport.mgt.sms.handler.core.config.SMSConfigurationManager; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import javax.ws.rs.GET; import javax.ws.rs.Path; diff --git a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/src/main/webapp/WEB-INF/cxf-servlet.xml b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/src/main/webapp/WEB-INF/cxf-servlet.xml index 4caf9d20c9..4348a1f532 100644 --- a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/src/main/webapp/WEB-INF/cxf-servlet.xml +++ b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.api/src/main/webapp/WEB-INF/cxf-servlet.xml @@ -19,9 +19,9 @@ + http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd"> diff --git a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.common/pom.xml b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.common/pom.xml index 93a527d489..fceb5e77d1 100644 --- a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.common/pom.xml +++ b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.common/pom.xml @@ -35,6 +35,14 @@ + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + org.apache.felix maven-bundle-plugin @@ -49,7 +57,10 @@ io.entgra.device.mgt.core.transport.mgt.sms.handler.common.* - io.swagger.annotations; version="${swagger.annotations.version}"; resolution:=optional, + io.entgra.device.mgt.core.transport.mgt.sms.handler.common.bean, + io.entgra.device.mgt.core.transport.mgt.sms.handler.common.exception, + io.swagger.annotations;version="[1.6,2)", + javax.xml.bind.annotation;version="[0.0,1)" diff --git a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/pom.xml b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/pom.xml index bc9f6d01e4..e91b0ed983 100644 --- a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/pom.xml +++ b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/pom.xml @@ -35,10 +35,6 @@ - - org.apache.felix - maven-scr-plugin - org.jacoco jacoco-maven-plugin @@ -65,6 +61,14 @@ + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + org.apache.felix maven-bundle-plugin @@ -77,14 +81,19 @@ SMS Management Core Bundle io.entgra.device.mgt.core.transport.mgt.sms.handler.core.internal - io.entgra.device.mgt.core.transport.mgt.sms.handler.common.*, - javax.xml.parsers;version="${javax.xml.parsers.import.pkg.version}";resolution:=optional, - javax.xml.bind.annotation, - javax.xml.bind, - org.apache.commons.lang, - org.wso2.carbon, - io.entgra.device.mgt.core.device.mgt.common.*, - io.entgra.device.mgt.core.device.mgt.core.* + io.entgra.device.mgt.core.device.mgt.common.exceptions;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.core.util;version="[5.0,6)", + io.entgra.device.mgt.core.transport.mgt.sms.handler.common.bean;version="[5.0,6)", + io.entgra.device.mgt.core.transport.mgt.sms.handler.common.config;version="[5.0,6)", + io.entgra.device.mgt.core.transport.mgt.sms.handler.common.exception;version="[5.0,6)", + io.entgra.device.mgt.core.transport.mgt.sms.handler.common.spi;version="[5.0,6)", + io.entgra.device.mgt.core.transport.mgt.sms.handler.core.config, + javax.xml.bind;version="[0.0,1)", + org.apache.commons.lang;version="[2.6,3)", + org.apache.commons.logging;version="[1.2,2)", + org.osgi.service.*;version="${imp.package.version.osgi.service}", + org.w3c.dom, + org.wso2.carbon.utils;version="[4.8,5)" !io.entgra.device.mgt.core.transport.mgt.sms.handler.core.internal, @@ -98,11 +107,15 @@ + + org.apache.felix + org.apache.felix.scr.ds-annotations + provided + org.ops4j.pax.logging pax-logging-api provided - org.wso2.carbon diff --git a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/src/main/java/io/entgra/device/mgt/core/transport/mgt/sms/handler/core/config/SMSConfigurationManager.java b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/src/main/java/io/entgra/device/mgt/core/transport/mgt/sms/handler/core/config/SMSConfigurationManager.java index e410dbd8a4..3921a27ad4 100644 --- a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/src/main/java/io/entgra/device/mgt/core/transport/mgt/sms/handler/core/config/SMSConfigurationManager.java +++ b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/src/main/java/io/entgra/device/mgt/core/transport/mgt/sms/handler/core/config/SMSConfigurationManager.java @@ -18,13 +18,13 @@ package io.entgra.device.mgt.core.transport.mgt.sms.handler.core.config; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; +import io.entgra.device.mgt.core.device.mgt.core.util.DeviceManagerUtil; import io.entgra.device.mgt.core.transport.mgt.sms.handler.common.SMSHandlerConstants; import io.entgra.device.mgt.core.transport.mgt.sms.handler.common.config.SMSConfiguration; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.w3c.dom.Document; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; -import io.entgra.device.mgt.core.device.mgt.core.util.DeviceManagerUtil; import org.wso2.carbon.utils.CarbonUtils; import javax.xml.bind.JAXBContext; diff --git a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/src/main/java/io/entgra/device/mgt/core/transport/mgt/sms/handler/core/internal/SMSHandlerServiceComponent.java b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/src/main/java/io/entgra/device/mgt/core/transport/mgt/sms/handler/core/internal/SMSHandlerServiceComponent.java index 3d4d4f0f99..fbd150d499 100644 --- a/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/src/main/java/io/entgra/device/mgt/core/transport/mgt/sms/handler/core/internal/SMSHandlerServiceComponent.java +++ b/components/transport-mgt/sms-handler/io.entgra.device.mgt.core.transport.mgt.sms.handler.core/src/main/java/io/entgra/device/mgt/core/transport/mgt/sms/handler/core/internal/SMSHandlerServiceComponent.java @@ -22,15 +22,18 @@ import io.entgra.device.mgt.core.transport.mgt.sms.handler.core.config.SMSConfig import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; -/** - * @scr.component - * name="io.entgra.device.mgt.core.transport.mgt.sms.handler.core.internal.SMSHandlerServiceComponent" immediate="true" - */ +@Component( + name = "io.entgra.device.mgt.core.transport.mgt.sms.handler.core.internal.SMSHandlerServiceComponent", + immediate = true) public class SMSHandlerServiceComponent { private static final Log log = LogFactory.getLog(SMSHandlerServiceComponent.class); + @Activate protected void activate(ComponentContext ctx) { if (log.isDebugEnabled()) { @@ -46,7 +49,7 @@ public class SMSHandlerServiceComponent { log.error("Error occurred while activating SMS Handler Service Component", e); } } - + @Deactivate protected void deactivate(ComponentContext ctx) { if (log.isDebugEnabled()) { log.debug("De-activating SMS Handler Service Component"); diff --git a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/DefaultTokenHandler.java b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/DefaultTokenHandler.java index 56bb34a285..1d757b421e 100644 --- a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/DefaultTokenHandler.java +++ b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/DefaultTokenHandler.java @@ -23,6 +23,7 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; import io.entgra.device.mgt.core.ui.request.interceptor.beans.AuthData; +import io.entgra.device.mgt.core.ui.request.interceptor.beans.ProxyResponse; import io.entgra.device.mgt.core.ui.request.interceptor.util.HandlerConstants; import io.entgra.device.mgt.core.ui.request.interceptor.util.HandlerUtil; import org.apache.commons.lang.StringUtils; @@ -33,7 +34,6 @@ import org.apache.http.HttpStatus; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.utils.URIBuilder; import org.apache.http.entity.ContentType; -import io.entgra.device.mgt.core.ui.request.interceptor.beans.ProxyResponse; import javax.servlet.annotation.MultipartConfig; import javax.servlet.annotation.WebServlet; diff --git a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/GrafanaHandler.java b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/GrafanaHandler.java index 72ba9aaa51..5fc86acde2 100644 --- a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/GrafanaHandler.java +++ b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/GrafanaHandler.java @@ -21,6 +21,7 @@ package io.entgra.device.mgt.core.ui.request.interceptor; import io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.common.exception.GrafanaManagementException; import io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core.exception.GrafanaEnvVariablesNotDefined; import io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core.util.GrafanaUtil; +import io.entgra.device.mgt.core.device.mgt.core.common.util.HttpUtil; import io.entgra.device.mgt.core.ui.request.interceptor.beans.AuthData; import io.entgra.device.mgt.core.ui.request.interceptor.beans.ProxyResponse; import io.entgra.device.mgt.core.ui.request.interceptor.util.GrafanaHandlerUtil; @@ -35,7 +36,6 @@ import org.apache.http.HttpStatus; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.*; import org.apache.http.impl.client.CloseableHttpClient; -import io.entgra.device.mgt.core.device.mgt.core.common.util.HttpUtil; import javax.servlet.annotation.MultipartConfig; import javax.servlet.annotation.WebServlet; diff --git a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/InvokerHandler.java b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/InvokerHandler.java index 00b35af06c..ed6d636afd 100644 --- a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/InvokerHandler.java +++ b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/InvokerHandler.java @@ -19,6 +19,7 @@ package io.entgra.device.mgt.core.ui.request.interceptor; import io.entgra.device.mgt.core.ui.request.interceptor.beans.AuthData; +import io.entgra.device.mgt.core.ui.request.interceptor.beans.ProxyResponse; import io.entgra.device.mgt.core.ui.request.interceptor.util.HandlerConstants; import io.entgra.device.mgt.core.ui.request.interceptor.util.HandlerUtil; import org.apache.commons.fileupload.FileUploadException; @@ -27,12 +28,8 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.HttpHeaders; import org.apache.http.HttpStatus; -import org.apache.http.client.methods.HttpDelete; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpHead; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.client.methods.HttpPut; -import io.entgra.device.mgt.core.ui.request.interceptor.beans.ProxyResponse; +import org.apache.http.client.methods.*; + import javax.servlet.annotation.MultipartConfig; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; diff --git a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/LoginHandler.java b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/LoginHandler.java index 82b31ce1a0..b058322933 100644 --- a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/LoginHandler.java +++ b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/LoginHandler.java @@ -18,12 +18,9 @@ package io.entgra.device.mgt.core.ui.request.interceptor; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; -import com.google.gson.JsonSyntaxException; +import com.google.gson.*; import io.entgra.device.mgt.core.ui.request.interceptor.beans.AuthData; +import io.entgra.device.mgt.core.ui.request.interceptor.beans.ProxyResponse; import io.entgra.device.mgt.core.ui.request.interceptor.cache.LoginCache; import io.entgra.device.mgt.core.ui.request.interceptor.cache.OAuthApp; import io.entgra.device.mgt.core.ui.request.interceptor.cache.OAuthAppCacheKey; @@ -38,7 +35,6 @@ import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; import org.apache.http.protocol.HTTP; -import io.entgra.device.mgt.core.ui.request.interceptor.beans.ProxyResponse; import javax.servlet.annotation.MultipartConfig; import javax.servlet.annotation.WebServlet; diff --git a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/LogoutHandler.java b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/LogoutHandler.java index 0d0bd5fbe7..88396bf6d4 100644 --- a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/LogoutHandler.java +++ b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/LogoutHandler.java @@ -18,11 +18,11 @@ package io.entgra.device.mgt.core.ui.request.interceptor; +import io.entgra.device.mgt.core.ui.request.interceptor.beans.ProxyResponse; import io.entgra.device.mgt.core.ui.request.interceptor.util.HandlerUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.HttpStatus; -import io.entgra.device.mgt.core.ui.request.interceptor.beans.ProxyResponse; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; diff --git a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/OTPInvokerHandler.java b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/OTPInvokerHandler.java index 1505bb9434..31d851ec03 100644 --- a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/OTPInvokerHandler.java +++ b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/OTPInvokerHandler.java @@ -18,6 +18,7 @@ package io.entgra.device.mgt.core.ui.request.interceptor; +import io.entgra.device.mgt.core.ui.request.interceptor.beans.ProxyResponse; import io.entgra.device.mgt.core.ui.request.interceptor.util.HandlerConstants; import io.entgra.device.mgt.core.ui.request.interceptor.util.HandlerUtil; import org.apache.commons.fileupload.FileUploadException; @@ -25,12 +26,8 @@ import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.HttpStatus; -import org.apache.http.client.methods.HttpDelete; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpHead; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.client.methods.HttpPut; -import io.entgra.device.mgt.core.ui.request.interceptor.beans.ProxyResponse; +import org.apache.http.client.methods.*; + import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; diff --git a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/SsoLoginCallbackHandler.java b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/SsoLoginCallbackHandler.java index 9e5c806723..9c76af9f39 100644 --- a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/SsoLoginCallbackHandler.java +++ b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/SsoLoginCallbackHandler.java @@ -22,6 +22,7 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; import io.entgra.device.mgt.core.ui.request.interceptor.beans.AuthData; +import io.entgra.device.mgt.core.ui.request.interceptor.beans.ProxyResponse; import io.entgra.device.mgt.core.ui.request.interceptor.util.HandlerConstants; import io.entgra.device.mgt.core.ui.request.interceptor.util.HandlerUtil; import org.apache.commons.logging.Log; @@ -30,7 +31,6 @@ import org.apache.http.HttpHeaders; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; -import io.entgra.device.mgt.core.ui.request.interceptor.beans.ProxyResponse; import javax.servlet.annotation.MultipartConfig; import javax.servlet.annotation.WebServlet; diff --git a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/SsoLoginHandler.java b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/SsoLoginHandler.java index 4686a8d0d7..de037d8bc1 100644 --- a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/SsoLoginHandler.java +++ b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/SsoLoginHandler.java @@ -18,11 +18,8 @@ package io.entgra.device.mgt.core.ui.request.interceptor; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; -import com.google.gson.JsonSyntaxException; +import com.google.gson.*; +import io.entgra.device.mgt.core.ui.request.interceptor.beans.ProxyResponse; import io.entgra.device.mgt.core.ui.request.interceptor.cache.LoginCache; import io.entgra.device.mgt.core.ui.request.interceptor.cache.OAuthApp; import io.entgra.device.mgt.core.ui.request.interceptor.cache.OAuthAppCacheKey; @@ -43,7 +40,6 @@ import org.json.JSONArray; import org.json.JSONObject; import org.w3c.dom.Document; import org.w3c.dom.NodeList; -import io.entgra.device.mgt.core.ui.request.interceptor.beans.ProxyResponse; import org.xml.sax.InputSource; import org.xml.sax.SAXException; diff --git a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/SsoLogoutHandler.java b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/SsoLogoutHandler.java index bc019fe0b8..f418199b0a 100644 --- a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/SsoLogoutHandler.java +++ b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/SsoLogoutHandler.java @@ -18,20 +18,16 @@ package io.entgra.device.mgt.core.ui.request.interceptor; +import io.entgra.device.mgt.core.ui.request.interceptor.beans.ProxyResponse; import io.entgra.device.mgt.core.ui.request.interceptor.util.HandlerConstants; import io.entgra.device.mgt.core.ui.request.interceptor.util.HandlerUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.HttpStatus; -import io.entgra.device.mgt.core.ui.request.interceptor.beans.ProxyResponse; import javax.servlet.annotation.MultipartConfig; import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; -import javax.servlet.http.Cookie; +import javax.servlet.http.*; import java.io.IOException; @MultipartConfig diff --git a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/UserHandler.java b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/UserHandler.java index f4ed2e0323..d5e8d2bf4d 100644 --- a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/UserHandler.java +++ b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/UserHandler.java @@ -22,20 +22,20 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; import com.google.gson.JsonSyntaxException; +import io.entgra.device.mgt.core.device.mgt.core.config.DeviceConfigurationManager; +import io.entgra.device.mgt.core.device.mgt.core.config.DeviceManagementConfig; +import io.entgra.device.mgt.core.device.mgt.extensions.logger.spi.EntgraLogger; +import io.entgra.device.mgt.core.notification.logger.UserLogContext; +import io.entgra.device.mgt.core.notification.logger.impl.EntgraUserLoggerImpl; import io.entgra.device.mgt.core.ui.request.interceptor.beans.AuthData; import io.entgra.device.mgt.core.ui.request.interceptor.beans.ProxyResponse; import io.entgra.device.mgt.core.ui.request.interceptor.util.HandlerConstants; import io.entgra.device.mgt.core.ui.request.interceptor.util.HandlerUtil; -import io.entgra.device.mgt.core.device.mgt.extensions.logger.spi.EntgraLogger; -import io.entgra.device.mgt.core.notification.logger.UserLogContext; -import io.entgra.device.mgt.core.notification.logger.impl.EntgraUserLoggerImpl; import org.apache.http.HttpHeaders; import org.apache.http.HttpStatus; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; -import io.entgra.device.mgt.core.device.mgt.core.config.DeviceConfigurationManager; -import io.entgra.device.mgt.core.device.mgt.core.config.DeviceManagementConfig; import javax.servlet.annotation.MultipartConfig; import javax.servlet.annotation.WebServlet; diff --git a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/util/HandlerUtil.java b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/util/HandlerUtil.java index 68aae89ee6..5a05a19425 100644 --- a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/util/HandlerUtil.java +++ b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/util/HandlerUtil.java @@ -18,12 +18,9 @@ package io.entgra.device.mgt.core.ui.request.interceptor.util; -import com.google.gson.Gson; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; +import com.google.gson.*; import io.entgra.device.mgt.core.ui.request.interceptor.beans.AuthData; +import io.entgra.device.mgt.core.ui.request.interceptor.beans.ProxyResponse; import io.entgra.device.mgt.core.ui.request.interceptor.cache.LoginCache; import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.FileUploadException; @@ -54,7 +51,6 @@ import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import org.w3c.dom.Document; -import io.entgra.device.mgt.core.ui.request.interceptor.beans.ProxyResponse; import org.xml.sax.SAXException; import javax.servlet.http.HttpServletRequest; @@ -63,12 +59,7 @@ import javax.servlet.http.HttpSession; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; -import java.io.BufferedReader; -import java.io.File; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.PrintWriter; -import java.io.StringWriter; +import java.io.*; import java.util.Enumeration; import java.util.List; diff --git a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/websocket/GrafanaLiveSecurityFilter.java b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/websocket/GrafanaLiveSecurityFilter.java index dfd3b61c51..77322c2839 100644 --- a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/websocket/GrafanaLiveSecurityFilter.java +++ b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/websocket/GrafanaLiveSecurityFilter.java @@ -23,12 +23,7 @@ import io.entgra.device.mgt.core.ui.request.interceptor.util.HandlerConstants; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -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.*; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import java.io.IOException; diff --git a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/websocket/GrafanaWebSocketClient.java b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/websocket/GrafanaWebSocketClient.java index 7638e53ab5..75fb5a7276 100644 --- a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/websocket/GrafanaWebSocketClient.java +++ b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/websocket/GrafanaWebSocketClient.java @@ -23,20 +23,9 @@ import io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core.util.GrafanaUt import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import javax.websocket.ClientEndpoint; -import javax.websocket.ContainerProvider; -import javax.websocket.Session; -import javax.websocket.OnOpen; -import javax.websocket.OnClose; -import javax.websocket.OnError; -import javax.websocket.CloseReason; -import javax.websocket.WebSocketContainer; -import java.net.URI; - -import javax.websocket.ClientEndpointConfig; -import javax.websocket.Endpoint; -import javax.websocket.EndpointConfig; +import javax.websocket.*; import javax.ws.rs.core.HttpHeaders; +import java.net.URI; import java.util.Collections; import java.util.List; import java.util.Map; diff --git a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/websocket/GrafanaWebSocketHandler.java b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/websocket/GrafanaWebSocketHandler.java index a9efaae87a..e492e79965 100644 --- a/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/websocket/GrafanaWebSocketHandler.java +++ b/components/ui-request-interceptor/io.entgra.device.mgt.core.ui.request.interceptor/src/main/java/io/entgra/device/mgt/core/ui/request/interceptor/websocket/GrafanaWebSocketHandler.java @@ -24,13 +24,8 @@ import io.entgra.device.mgt.core.analytics.mgt.grafana.proxy.core.util.GrafanaUt import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import javax.websocket.CloseReason; +import javax.websocket.*; import javax.websocket.server.ServerEndpoint; -import javax.websocket.Session; -import javax.websocket.OnOpen; -import javax.websocket.OnMessage; -import javax.websocket.OnClose; -import javax.websocket.OnError; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml index 60b9dfd6f7..6476fc0aa6 100644 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/pom.xml @@ -26,18 +26,21 @@ 4.0.0 - io.entgra.device.mgt.core io.entgra.device.mgt.core.webapp.authenticator.framework bundle WSO2 Carbon - Web Application Authenticator Framework Bundle WSO2 Carbon - Web Application Authenticator Framework Bundle - http://wso2.org + https://entgra.io - org.apache.felix - maven-scr-plugin + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + org.apache.felix @@ -55,65 +58,70 @@ io.entgra.device.mgt.core.webapp.authenticator.framework.* - com.nimbusds.jose;version="${nimbus.orbit.version.range}", - com.nimbusds.jose.crypto;version="${nimbus.orbit.version.range}", - com.nimbusds.jwt;version="${nimbus.orbit.version.range}", - javax.xml.bind, - javax.xml.bind.annotation, - javax.xml.parsers;version="${javax.xml.parsers.import.pkg.version}";resolution:=optional, - javax.xml.validation, - org.apache.catalina;version="9.0", - org.apache.catalina.connector;version="9.0", - org.apache.catalina.util;version="9.0", - org.apache.commons.logging, - org.apache.coyote;version="9.0", - org.apache.tomcat.util.buf;version="9.0", - org.apache.tomcat.util.http;version="9.0", + com.google.gson;version="[2.9,3)", + com.nimbusds.jose;version="[7.9,8)", + com.nimbusds.jose.crypto;version="[7.9,8)", + com.nimbusds.jwt;version="[7.9,8)", + io.entgra.device.mgt.core.certificate.mgt.core.dto;version="[5.0,6)", + io.entgra.device.mgt.core.certificate.mgt.core.exception;version="[5.0,6)", + io.entgra.device.mgt.core.certificate.mgt.core.scep;version="[5.0,6)", + io.entgra.device.mgt.core.certificate.mgt.core.service;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.otp.mgt.dto;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.permission.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.common.spi;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.core.permission.mgt;version="[5.0,6)", + io.entgra.device.mgt.core.device.mgt.core.util;version="[5.0,6)", + io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.oauth, + io.entgra.device.mgt.core.webapp.authenticator.framework.authorizer, + io.entgra.device.mgt.core.webapp.authenticator.framework.config, + io.entgra.device.mgt.core.webapp.authenticator.framework.config.impl, + javax.servlet;version="[2.6,3)", + + + javax.xml.parsers;version="${javax.xml.parsers.import.pkg.version}", + + javax.xml.stream.*;version="[1.0.1,1.1.0)", + org.apache.axiom.om;version="[1.2,2)", + org.apache.axiom.om.impl.builder;version="[1.2,2)", + org.apache.axiom.om.util;version="[1.2,2)", + org.apache.axiom.soap;version="[1.2,2)", + org.apache.axiom.soap.impl.builder;version="[1.2,2)", + org.apache.axis2;version="[1.6,2)", + org.apache.axis2.client;version="[1.6,2)", + org.apache.axis2.context;version="[1.6,2)", + org.apache.catalina;version="${catalina.version.range}", + org.apache.catalina.connector;version="${catalina.version.range}", + org.apache.commons.codec.binary;version="[1.14,2)", + org.apache.commons.httpclient;version="[3.1,4)", + org.apache.commons.httpclient.params;version="[3.1,4)", + org.apache.commons.lang;version="[2.6,3)", + org.apache.commons.logging;version="[1.2,2)", + org.apache.commons.pool;version="[1.5,2)", + org.apache.commons.pool.impl;version="[1.5,2)", + org.apache.coyote;version="[9.0,10)", + org.apache.tomcat.util.buf;version="[9.0,10)", + org.apache.tomcat.util.http;version="[9.0,10)", org.osgi.framework.*;version="${imp.package.version.osgi.framework}", org.osgi.service.*;version="${imp.package.version.osgi.service}", + org.owasp.encoder;version="[1.2,2)", org.w3c.dom, - org.wso2.carbon.context, - org.wso2.carbon.core.util, - org.wso2.carbon.identity.base; version="${carbon.identity.imp.pkg.version}", - org.wso2.carbon.identity.core.util; version="${carbon.identity.imp.pkg.version}", - org.wso2.carbon.identity.oauth2.*; - version="${carbon.identity-inbound-auth-oauth.imp.pkg.version}", - org.wso2.carbon.tomcat.ext.valves, - org.wso2.carbon.user.api, - org.wso2.carbon.user.core.service, - org.wso2.carbon.user.core.tenant, - org.wso2.carbon.utils, - org.wso2.carbon.utils.multitenancy, - org.xml.sax, - - javax.servlet, - javax.servlet.http, - javax.xml, - org.apache.axis2.transport.http, - io.entgra.device.mgt.core.certificate.mgt.core.*, - io.entgra.device.mgt.core.device.mgt.core.permission.mgt.*, - io.entgra.device.mgt.core.device.mgt.core.util.*, - io.entgra.device.mgt.core.device.mgt.common.*, - io.entgra.device.mgt.core.device.mgt.common.permission.mgt.*, - org.apache.axis2, - org.apache.axis2.client, - org.apache.commons.codec.binary;version="${commons-codec.wso2.osgi.version.range}", - org.apache.commons.httpclient, - org.wso2.carbon.core.security, - org.apache.axis2.context, - org.apache.commons.httpclient.params, - org.apache.commons.pool, - org.apache.commons.pool.impl, - org.apache.http.conn, - org.apache.http.impl.conn, - - javax.xml.stream, - org.apache.axiom.*; version="${axiom.osgi.version.range}", - org.wso2.carbon.registry.core.*, - org.wso2.carbon.registry.common.*;version="${carbon.registry.imp.pkg.version.range}", - org.wso2.carbon.registry.indexing.*; version="${carbon.registry.imp.pkg.version.range}", - org.wso2.carbon.base, - org.owasp.encoder + org.wso2.carbon.base;version="[1.0,2)", + org.wso2.carbon.context;version="[4.8,5)", + org.wso2.carbon.core.util;version="[4.8,5)", + org.wso2.carbon.identity.oauth2;version="[6.9,7)", + org.wso2.carbon.identity.oauth2.dto;version="[6.9,7)", + org.wso2.carbon.identity.oauth2.stub;version="[6.9,7)", + org.wso2.carbon.identity.oauth2.stub.dto;version="[6.9,7)", + org.wso2.carbon.registry.core.exceptions;version="[1.0,2)", + org.wso2.carbon.registry.core.service;version="[1.0,2)", + org.wso2.carbon.registry.indexing.service;version="[4.8,5)", + org.wso2.carbon.tomcat.ext.valves;version="[4.8,5)", + org.wso2.carbon.user.api;version="[1.0,2)", + org.wso2.carbon.user.core.service;version="[4.8,5)", + org.wso2.carbon.user.core.tenant;version="[4.8,5)", + org.wso2.carbon.utils;version="[4.8,5)", + org.wso2.carbon.utils.multitenancy;version="[4.8,5)" @@ -160,6 +168,11 @@ + + org.apache.felix + org.apache.felix.scr.ds-annotations + provided + org.wso2.tomcat tomcat diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/AuthenticationFrameworkUtil.java b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/AuthenticationFrameworkUtil.java index 9a1e8819dd..811204b630 100644 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/AuthenticationFrameworkUtil.java +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/AuthenticationFrameworkUtil.java @@ -17,6 +17,7 @@ */ package io.entgra.device.mgt.core.webapp.authenticator.framework; +import io.entgra.device.mgt.core.webapp.authenticator.framework.internal.AuthenticatorFrameworkDataHolder; import org.apache.catalina.connector.Request; import org.apache.catalina.connector.Response; import org.apache.commons.logging.Log; @@ -28,7 +29,6 @@ import org.wso2.carbon.user.api.UserRealm; import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.user.core.service.RealmService; import org.wso2.carbon.utils.multitenancy.MultitenantUtils; -import io.entgra.device.mgt.core.webapp.authenticator.framework.internal.AuthenticatorFrameworkDataHolder; import javax.xml.XMLConstants; import javax.xml.parsers.DocumentBuilder; diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/Utils/Utils.java b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/Utils/Utils.java index 08f27c1a5e..014b2fffed 100644 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/Utils/Utils.java +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/Utils/Utils.java @@ -18,14 +18,7 @@ package io.entgra.device.mgt.core.webapp.authenticator.framework.Utils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.PrivilegedCarbonContext; import io.entgra.device.mgt.core.device.mgt.core.util.DeviceManagerUtil; -import org.wso2.carbon.user.api.TenantManager; -import org.wso2.carbon.user.api.UserStoreException; -import org.wso2.carbon.user.core.service.RealmService; -import org.wso2.carbon.utils.multitenancy.MultitenantUtils; import io.entgra.device.mgt.core.webapp.authenticator.framework.AuthenticationException; import io.entgra.device.mgt.core.webapp.authenticator.framework.AuthenticationInfo; import io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.WebappAuthenticator; @@ -33,6 +26,13 @@ import io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.oa import io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.oauth.OAuthValidationResponse; import io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.oauth.OAuthValidatorFactory; import io.entgra.device.mgt.core.webapp.authenticator.framework.internal.AuthenticatorFrameworkDataHolder; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.PrivilegedCarbonContext; +import org.wso2.carbon.user.api.TenantManager; +import org.wso2.carbon.user.api.UserStoreException; +import org.wso2.carbon.user.core.service.RealmService; +import org.wso2.carbon.utils.multitenancy.MultitenantUtils; import java.util.Properties; import java.util.regex.Matcher; diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/WebappAuthenticationValve.java b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/WebappAuthenticationValve.java index b5df66b4b4..8b430ba012 100644 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/WebappAuthenticationValve.java +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/WebappAuthenticationValve.java @@ -18,6 +18,9 @@ package io.entgra.device.mgt.core.webapp.authenticator.framework; import com.google.gson.Gson; +import io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.WebappAuthenticator; +import io.entgra.device.mgt.core.webapp.authenticator.framework.authorizer.PermissionAuthorizer; +import io.entgra.device.mgt.core.webapp.authenticator.framework.authorizer.WebappTenantAuthorizer; import org.apache.catalina.Context; import org.apache.catalina.connector.Request; import org.apache.catalina.connector.Response; @@ -31,9 +34,6 @@ import org.wso2.carbon.tomcat.ext.valves.CompositeValve; import org.wso2.carbon.user.api.Tenant; import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.user.core.service.RealmService; -import io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.WebappAuthenticator; -import io.entgra.device.mgt.core.webapp.authenticator.framework.authorizer.PermissionAuthorizer; -import io.entgra.device.mgt.core.webapp.authenticator.framework.authorizer.WebappTenantAuthorizer; import javax.servlet.http.HttpServletResponse; import java.net.InetAddress; diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/WebappAuthenticatorFactory.java b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/WebappAuthenticatorFactory.java index bacd26902d..6d1e9a3c21 100644 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/WebappAuthenticatorFactory.java +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/WebappAuthenticatorFactory.java @@ -17,9 +17,9 @@ */ package io.entgra.device.mgt.core.webapp.authenticator.framework; -import org.apache.catalina.connector.Request; import io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.WebappAuthenticator; import io.entgra.device.mgt.core.webapp.authenticator.framework.internal.AuthenticatorFrameworkDataHolder; +import org.apache.catalina.connector.Request; import java.util.Map; diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/BSTAuthenticator.java b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/BSTAuthenticator.java index 3f488df019..5d64bc5c25 100644 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/BSTAuthenticator.java +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/BSTAuthenticator.java @@ -17,6 +17,12 @@ */ package io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator; +import io.entgra.device.mgt.core.webapp.authenticator.framework.AuthenticationException; +import io.entgra.device.mgt.core.webapp.authenticator.framework.AuthenticationInfo; +import io.entgra.device.mgt.core.webapp.authenticator.framework.Utils.Utils; +import io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.oauth.OAuth2TokenValidator; +import io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.oauth.OAuthTokenValidationException; +import io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.oauth.OAuthValidationResponse; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.impl.builder.StAXBuilder; import org.apache.axiom.om.util.StAXUtils; @@ -29,12 +35,6 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.coyote.InputBuffer; import org.apache.tomcat.util.buf.ByteChunk; -import io.entgra.device.mgt.core.webapp.authenticator.framework.AuthenticationException; -import io.entgra.device.mgt.core.webapp.authenticator.framework.AuthenticationInfo; -import io.entgra.device.mgt.core.webapp.authenticator.framework.Utils.Utils; -import io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.oauth.OAuth2TokenValidator; -import io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.oauth.OAuthTokenValidationException; -import io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.oauth.OAuthValidationResponse; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/BasicAuthAuthenticator.java b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/BasicAuthAuthenticator.java index 9c7de39b5b..6545b7bbab 100644 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/BasicAuthAuthenticator.java +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/BasicAuthAuthenticator.java @@ -17,6 +17,11 @@ */ package io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator; +import io.entgra.device.mgt.core.webapp.authenticator.framework.AuthenticationException; +import io.entgra.device.mgt.core.webapp.authenticator.framework.AuthenticationInfo; +import io.entgra.device.mgt.core.webapp.authenticator.framework.Constants; +import io.entgra.device.mgt.core.webapp.authenticator.framework.Utils.Utils; +import io.entgra.device.mgt.core.webapp.authenticator.framework.internal.AuthenticatorFrameworkDataHolder; import org.apache.catalina.connector.Request; import org.apache.catalina.connector.Response; import org.apache.commons.logging.Log; @@ -26,11 +31,6 @@ import org.apache.tomcat.util.buf.MessageBytes; import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.user.api.UserStoreManager; import org.wso2.carbon.utils.multitenancy.MultitenantUtils; -import io.entgra.device.mgt.core.webapp.authenticator.framework.AuthenticationException; -import io.entgra.device.mgt.core.webapp.authenticator.framework.AuthenticationInfo; -import io.entgra.device.mgt.core.webapp.authenticator.framework.internal.AuthenticatorFrameworkDataHolder; -import io.entgra.device.mgt.core.webapp.authenticator.framework.Constants; -import io.entgra.device.mgt.core.webapp.authenticator.framework.Utils.Utils; import java.nio.charset.Charset; import java.util.Base64; diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/CertificateAuthenticator.java b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/CertificateAuthenticator.java index 06e879e37a..5238828dd0 100644 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/CertificateAuthenticator.java +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/CertificateAuthenticator.java @@ -18,10 +18,6 @@ package io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator; -import org.apache.catalina.connector.Request; -import org.apache.catalina.connector.Response; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.certificate.mgt.core.dto.CertificateResponse; import io.entgra.device.mgt.core.certificate.mgt.core.exception.KeystoreException; import io.entgra.device.mgt.core.certificate.mgt.core.scep.SCEPException; @@ -32,8 +28,12 @@ import io.entgra.device.mgt.core.device.mgt.common.DeviceManagementConstants; import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; import io.entgra.device.mgt.core.webapp.authenticator.framework.AuthenticationException; import io.entgra.device.mgt.core.webapp.authenticator.framework.AuthenticationInfo; -import io.entgra.device.mgt.core.webapp.authenticator.framework.internal.AuthenticatorFrameworkDataHolder; import io.entgra.device.mgt.core.webapp.authenticator.framework.Utils.Utils; +import io.entgra.device.mgt.core.webapp.authenticator.framework.internal.AuthenticatorFrameworkDataHolder; +import org.apache.catalina.connector.Request; +import org.apache.catalina.connector.Response; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.security.cert.X509Certificate; import java.util.Properties; diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/JWTAuthenticator.java b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/JWTAuthenticator.java index 6759980b29..165a064ac4 100644 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/JWTAuthenticator.java +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/JWTAuthenticator.java @@ -21,6 +21,8 @@ package io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator; import com.nimbusds.jose.JWSVerifier; import com.nimbusds.jose.crypto.RSASSAVerifier; import com.nimbusds.jwt.SignedJWT; +import io.entgra.device.mgt.core.webapp.authenticator.framework.AuthenticationInfo; +import io.entgra.device.mgt.core.webapp.authenticator.framework.internal.AuthenticatorFrameworkDataHolder; import org.apache.catalina.connector.Request; import org.apache.catalina.connector.Response; import org.apache.commons.logging.Log; @@ -35,19 +37,13 @@ import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.user.api.UserStoreManager; import org.wso2.carbon.utils.CarbonUtils; import org.wso2.carbon.utils.multitenancy.MultitenantUtils; -import io.entgra.device.mgt.core.webapp.authenticator.framework.AuthenticationInfo; -import io.entgra.device.mgt.core.webapp.authenticator.framework.internal.AuthenticatorFrameworkDataHolder; import java.io.FileInputStream; import java.security.KeyStore; import java.security.PublicKey; import java.security.interfaces.RSAPublicKey; import java.text.ParseException; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Properties; -import java.util.StringTokenizer; +import java.util.*; /** * This authenticator authenticates HTTP requests using JWT header. diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/OAuthAuthenticator.java b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/OAuthAuthenticator.java index 4365d0d30e..f973ae7dae 100644 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/OAuthAuthenticator.java +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/OAuthAuthenticator.java @@ -17,11 +17,6 @@ */ package io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator; -import org.apache.catalina.connector.Response; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.tomcat.util.buf.ByteChunk; -import org.apache.tomcat.util.buf.MessageBytes; import io.entgra.device.mgt.core.webapp.authenticator.framework.AuthenticationException; import io.entgra.device.mgt.core.webapp.authenticator.framework.AuthenticationInfo; import io.entgra.device.mgt.core.webapp.authenticator.framework.Constants; @@ -29,6 +24,11 @@ import io.entgra.device.mgt.core.webapp.authenticator.framework.Utils.Utils; import io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.oauth.OAuth2TokenValidator; import io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.oauth.OAuthTokenValidationException; import io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.oauth.OAuthValidationResponse; +import org.apache.catalina.connector.Response; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.tomcat.util.buf.ByteChunk; +import org.apache.tomcat.util.buf.MessageBytes; import java.util.Properties; import java.util.StringTokenizer; diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/OneTimeTokenAuthenticator.java b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/OneTimeTokenAuthenticator.java index ca7684c651..82e592524b 100644 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/OneTimeTokenAuthenticator.java +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/OneTimeTokenAuthenticator.java @@ -17,15 +17,15 @@ */ package io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator; -import org.apache.catalina.connector.Response; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.otp.mgt.dto.OneTimePinDTO; import io.entgra.device.mgt.core.device.mgt.common.spi.OTPManagementService; import io.entgra.device.mgt.core.webapp.authenticator.framework.AuthenticationInfo; import io.entgra.device.mgt.core.webapp.authenticator.framework.Constants; import io.entgra.device.mgt.core.webapp.authenticator.framework.Utils.Utils; import io.entgra.device.mgt.core.webapp.authenticator.framework.internal.AuthenticatorFrameworkDataHolder; +import org.apache.catalina.connector.Response; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.util.Properties; diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/WebappAuthenticator.java b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/WebappAuthenticator.java index 49eea111d8..b21a643bb8 100644 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/WebappAuthenticator.java +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/WebappAuthenticator.java @@ -17,9 +17,9 @@ */ package io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator; +import io.entgra.device.mgt.core.webapp.authenticator.framework.AuthenticationInfo; import org.apache.catalina.connector.Request; import org.apache.catalina.connector.Response; -import io.entgra.device.mgt.core.webapp.authenticator.framework.AuthenticationInfo; import java.util.Properties; diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/oauth/impl/LocalOAuthValidator.java b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/oauth/impl/LocalOAuthValidator.java index d2d226aacc..0e155dc776 100755 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/oauth/impl/LocalOAuthValidator.java +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/oauth/impl/LocalOAuthValidator.java @@ -17,15 +17,15 @@ */ package io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.oauth.impl; -import org.wso2.carbon.identity.oauth2.dto.OAuth2TokenValidationRequestDTO; -import org.wso2.carbon.identity.oauth2.dto.OAuth2TokenValidationResponseDTO; -import org.wso2.carbon.utils.multitenancy.MultitenantConstants; -import org.wso2.carbon.utils.multitenancy.MultitenantUtils; -import io.entgra.device.mgt.core.webapp.authenticator.framework.internal.AuthenticatorFrameworkDataHolder; import io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.oauth.OAuth2TokenValidator; import io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.oauth.OAuthConstants; import io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.oauth.OAuthTokenValidationException; import io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.oauth.OAuthValidationResponse; +import io.entgra.device.mgt.core.webapp.authenticator.framework.internal.AuthenticatorFrameworkDataHolder; +import org.wso2.carbon.identity.oauth2.dto.OAuth2TokenValidationRequestDTO; +import org.wso2.carbon.identity.oauth2.dto.OAuth2TokenValidationResponseDTO; +import org.wso2.carbon.utils.multitenancy.MultitenantConstants; +import org.wso2.carbon.utils.multitenancy.MultitenantUtils; /** * Handles the OAuth2 token validation from the same server using OSGi services. diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/oauth/impl/RemoteOAuthValidator.java b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/oauth/impl/RemoteOAuthValidator.java index 9fc873b522..2df0ae88d2 100755 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/oauth/impl/RemoteOAuthValidator.java +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/oauth/impl/RemoteOAuthValidator.java @@ -17,6 +17,10 @@ */ package io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.oauth.impl; +import io.entgra.device.mgt.core.webapp.authenticator.framework.Utils.OAuthTokenValidationStubFactory; +import io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.oauth.OAuth2TokenValidator; +import io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.oauth.OAuthTokenValidationException; +import io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.oauth.OAuthValidationResponse; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.commons.pool.impl.GenericObjectPool; @@ -26,10 +30,6 @@ import org.wso2.carbon.identity.oauth2.stub.dto.OAuth2TokenValidationRequestDTO_ import org.wso2.carbon.identity.oauth2.stub.dto.OAuth2TokenValidationRequestDTO_TokenValidationContextParam; import org.wso2.carbon.identity.oauth2.stub.dto.OAuth2TokenValidationResponseDTO; import org.wso2.carbon.utils.multitenancy.MultitenantUtils; -import io.entgra.device.mgt.core.webapp.authenticator.framework.Utils.OAuthTokenValidationStubFactory; -import io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.oauth.OAuth2TokenValidator; -import io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.oauth.OAuthTokenValidationException; -import io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.oauth.OAuthValidationResponse; import java.rmi.RemoteException; import java.util.Properties; diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authorizer/PermissionAuthorizer.java b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authorizer/PermissionAuthorizer.java index 3cddf49e29..696bb788ae 100644 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authorizer/PermissionAuthorizer.java +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authorizer/PermissionAuthorizer.java @@ -17,9 +17,6 @@ */ package io.entgra.device.mgt.core.webapp.authenticator.framework.authorizer; -import org.apache.catalina.connector.Request; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import io.entgra.device.mgt.core.device.mgt.common.permission.mgt.Permission; import io.entgra.device.mgt.core.device.mgt.common.permission.mgt.PermissionManagementException; import io.entgra.device.mgt.core.device.mgt.common.permission.mgt.PermissionManagerService; @@ -28,6 +25,9 @@ import io.entgra.device.mgt.core.webapp.authenticator.framework.AuthenticationEx import io.entgra.device.mgt.core.webapp.authenticator.framework.AuthenticationFrameworkUtil; import io.entgra.device.mgt.core.webapp.authenticator.framework.AuthenticationInfo; import io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.WebappAuthenticator; +import org.apache.catalina.connector.Request; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import java.util.ArrayList; import java.util.List; diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authorizer/WebappTenantAuthorizer.java b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authorizer/WebappTenantAuthorizer.java index 513c5bb7e3..2091efb2fd 100644 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authorizer/WebappTenantAuthorizer.java +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authorizer/WebappTenantAuthorizer.java @@ -18,9 +18,9 @@ package io.entgra.device.mgt.core.webapp.authenticator.framework.authorizer; -import org.apache.catalina.connector.Request; import io.entgra.device.mgt.core.webapp.authenticator.framework.AuthenticationInfo; import io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.WebappAuthenticator; +import org.apache.catalina.connector.Request; /** * This class represents the methods that are used to authorize requests based on the tenant subscription. diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/config/WebappAuthenticatorConfig.java b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/config/WebappAuthenticatorConfig.java index d4d6b5229e..48cd0a2774 100644 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/config/WebappAuthenticatorConfig.java +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/config/WebappAuthenticatorConfig.java @@ -17,12 +17,12 @@ */ package io.entgra.device.mgt.core.webapp.authenticator.framework.config; +import io.entgra.device.mgt.core.webapp.authenticator.framework.AuthenticationFrameworkUtil; +import io.entgra.device.mgt.core.webapp.authenticator.framework.AuthenticatorFrameworkException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.w3c.dom.Document; import org.wso2.carbon.utils.CarbonUtils; -import io.entgra.device.mgt.core.webapp.authenticator.framework.AuthenticationFrameworkUtil; -import io.entgra.device.mgt.core.webapp.authenticator.framework.AuthenticatorFrameworkException; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/internal/AuthenticatorFrameworkDataHolder.java b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/internal/AuthenticatorFrameworkDataHolder.java index aa83cd5008..5ae093a6e4 100644 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/internal/AuthenticatorFrameworkDataHolder.java +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/internal/AuthenticatorFrameworkDataHolder.java @@ -20,11 +20,11 @@ package io.entgra.device.mgt.core.webapp.authenticator.framework.internal; import io.entgra.device.mgt.core.certificate.mgt.core.scep.SCEPManager; import io.entgra.device.mgt.core.certificate.mgt.core.service.CertificateManagementService; import io.entgra.device.mgt.core.device.mgt.common.spi.OTPManagementService; +import io.entgra.device.mgt.core.webapp.authenticator.framework.WebappAuthenticatorRepository; import org.wso2.carbon.identity.oauth2.OAuth2TokenValidationService; import org.wso2.carbon.registry.core.service.TenantRegistryLoader; import org.wso2.carbon.registry.indexing.service.TenantIndexingLoader; import org.wso2.carbon.user.core.service.RealmService; -import io.entgra.device.mgt.core.webapp.authenticator.framework.WebappAuthenticatorRepository; public class AuthenticatorFrameworkDataHolder { diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/internal/WebappAuthenticatorFrameworkServiceComponent.java b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/internal/WebappAuthenticatorFrameworkServiceComponent.java index 336de8fdbc..ab9a0988f4 100644 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/internal/WebappAuthenticatorFrameworkServiceComponent.java +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/main/java/io/entgra/device/mgt/core/webapp/authenticator/framework/internal/WebappAuthenticatorFrameworkServiceComponent.java @@ -18,19 +18,9 @@ package io.entgra.device.mgt.core.webapp.authenticator.framework.internal; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.osgi.framework.BundleContext; -import org.osgi.service.component.ComponentContext; import io.entgra.device.mgt.core.certificate.mgt.core.scep.SCEPManager; import io.entgra.device.mgt.core.certificate.mgt.core.service.CertificateManagementService; import io.entgra.device.mgt.core.device.mgt.common.spi.OTPManagementService; -import org.wso2.carbon.identity.oauth2.OAuth2TokenValidationService; -import org.wso2.carbon.registry.core.service.TenantRegistryLoader; -import org.wso2.carbon.registry.indexing.service.TenantIndexingLoader; -import org.wso2.carbon.tomcat.ext.valves.CarbonTomcatValve; -import org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer; -import org.wso2.carbon.user.core.service.RealmService; import io.entgra.device.mgt.core.webapp.authenticator.framework.WebappAuthenticationValve; import io.entgra.device.mgt.core.webapp.authenticator.framework.WebappAuthenticatorRepository; import io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.WebappAuthenticator; @@ -38,60 +28,30 @@ import io.entgra.device.mgt.core.webapp.authenticator.framework.config.Authentic import io.entgra.device.mgt.core.webapp.authenticator.framework.config.AuthenticatorConfigService; import io.entgra.device.mgt.core.webapp.authenticator.framework.config.WebappAuthenticatorConfig; import io.entgra.device.mgt.core.webapp.authenticator.framework.config.impl.AuthenticatorConfigServiceImpl; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.osgi.framework.BundleContext; +import org.osgi.service.component.ComponentContext; +import org.osgi.service.component.annotations.*; +import org.wso2.carbon.identity.oauth2.OAuth2TokenValidationService; +import org.wso2.carbon.registry.core.service.TenantRegistryLoader; +import org.wso2.carbon.registry.indexing.service.TenantIndexingLoader; +import org.wso2.carbon.tomcat.ext.valves.CarbonTomcatValve; +import org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer; +import org.wso2.carbon.user.core.service.RealmService; import java.util.ArrayList; import java.util.List; import java.util.Properties; -/** - * @scr.component name="org.wso2.carbon.webapp.authenticator" immediate="true" - * @scr.reference name="user.realmservice.default" - * interface="org.wso2.carbon.user.core.service.RealmService" - * cardinality="1..1" - * policy="dynamic" - * bind="setRealmService" - * unbind="unsetRealmService" - * @scr.reference name="org.wso2.carbon.certificate.mgt" - * interface="io.entgra.device.mgt.core.certificate.mgt.core.service.CertificateManagementService" - * policy="dynamic" - * cardinality="1..n" - * bind="setCertificateManagementService" - * unbind="unsetCertificateManagementService" - * @scr.reference name="io.entgra.device.mgt.core.certificate.mgt.core.scep" - * interface="io.entgra.device.mgt.core.certificate.mgt.core.scep.SCEPManager" - * policy="dynamic" - * cardinality="1..n" - * bind="setSCEPManagementService" - * unbind="unsetSCEPManagementService" - * @scr.reference name="identity.oauth2.validation.service" - * interface="org.wso2.carbon.identity.oauth2.OAuth2TokenValidationService" - * cardinality="1..1" - * policy="dynamic" - * bind="setOAuth2ValidationService" - * unbind="unsetOAuth2ValidationService" - * @scr.reference name="tenant.indexloader" - * interface="org.wso2.carbon.registry.indexing.service.TenantIndexingLoader" - * cardinality="1..1" - * policy="dynamic" - * bind="setTenantIndexLoader" - * unbind="unsetTenantIndexLoader" - * @scr.reference name="tenant.registryloader" - * interface="org.wso2.carbon.registry.core.service.TenantRegistryLoader" - * cardinality="1..1" policy="dynamic" - * bind="setTenantRegistryLoader" - * unbind="unsetTenantRegistryLoader" - * @scr.reference name="org.wso2.carbon.device.manager" - * interface="io.entgra.device.mgt.core.device.mgt.common.spi.OTPManagementService" - * cardinality="1..1" - * policy="dynamic" - * bind="setOTPManagementService" - * unbind="unsetOTPManagementService" - */ - +@Component( + name = "io.entgra.device.mgt.core.webapp.authenticator.framework.internal.WebappAuthenticatorFrameworkServiceComponent", + immediate = true) public class WebappAuthenticatorFrameworkServiceComponent { private static final Log log = LogFactory.getLog(WebappAuthenticatorFrameworkServiceComponent.class); @SuppressWarnings("unused") + @Activate protected void activate(ComponentContext componentContext) { if (log.isDebugEnabled()) { log.debug("Starting Web Application Authenticator Framework Bundle"); @@ -134,10 +94,17 @@ public class WebappAuthenticatorFrameworkServiceComponent { } @SuppressWarnings("unused") + @Deactivate protected void deactivate(ComponentContext componentContext) { //do nothing } + @Reference( + name = "realm.service", + service = org.wso2.carbon.user.core.service.RealmService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetRealmService") protected void setRealmService(RealmService realmService) { if (log.isDebugEnabled()) { log.debug("RealmService acquired"); @@ -149,6 +116,12 @@ public class WebappAuthenticatorFrameworkServiceComponent { AuthenticatorFrameworkDataHolder.getInstance().setRealmService(null); } + @Reference( + name = "certificate.mgt.service", + service = io.entgra.device.mgt.core.certificate.mgt.core.service.CertificateManagementService.class, + cardinality = ReferenceCardinality.MULTIPLE, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetCertificateManagementService") protected void setCertificateManagementService(CertificateManagementService certificateManagementService) { if (log.isDebugEnabled()) { log.debug("Setting certificate management service"); @@ -164,6 +137,12 @@ public class WebappAuthenticatorFrameworkServiceComponent { AuthenticatorFrameworkDataHolder.getInstance().setCertificateManagementService(null); } + @Reference( + name = "scep.mgr", + service = io.entgra.device.mgt.core.certificate.mgt.core.scep.SCEPManager.class, + cardinality = ReferenceCardinality.MULTIPLE, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetSCEPManagementService") protected void setSCEPManagementService(SCEPManager scepManager) { if (log.isDebugEnabled()) { log.debug("Setting SCEP management service"); @@ -184,6 +163,12 @@ public class WebappAuthenticatorFrameworkServiceComponent { * * @param tokenValidationService An instance of OAuth2TokenValidationService */ + @Reference( + name = "oauth2.token.validation.service", + service = org.wso2.carbon.identity.oauth2.OAuth2TokenValidationService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetOAuth2ValidationService") protected void setOAuth2ValidationService(OAuth2TokenValidationService tokenValidationService) { if (log.isDebugEnabled()) { log.debug("Setting OAuth2TokenValidationService Service"); @@ -203,6 +188,12 @@ public class WebappAuthenticatorFrameworkServiceComponent { AuthenticatorFrameworkDataHolder.getInstance().setOAuth2TokenValidationService(null); } + @Reference( + name = "tenant.index.loader", + service = org.wso2.carbon.registry.indexing.service.TenantIndexingLoader.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetTenantIndexLoader") protected void setTenantIndexLoader(TenantIndexingLoader tenantIndexLoader) { AuthenticatorFrameworkDataHolder.getInstance().setTenantIndexingLoader(tenantIndexLoader); } @@ -211,6 +202,12 @@ public class WebappAuthenticatorFrameworkServiceComponent { AuthenticatorFrameworkDataHolder.getInstance().setTenantIndexingLoader(null); } + @Reference( + name = "tenant.registry.loader", + service = org.wso2.carbon.registry.core.service.TenantRegistryLoader.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetTenantRegistryLoader") protected void setTenantRegistryLoader(TenantRegistryLoader tenantRegistryLoader) { AuthenticatorFrameworkDataHolder.getInstance().setTenantRegistryLoader(tenantRegistryLoader); } @@ -219,6 +216,12 @@ public class WebappAuthenticatorFrameworkServiceComponent { AuthenticatorFrameworkDataHolder.getInstance().setTenantRegistryLoader(null); } + @Reference( + name = "otp.mgt.service", + service = io.entgra.device.mgt.core.device.mgt.common.spi.OTPManagementService.class, + cardinality = ReferenceCardinality.MANDATORY, + policy = ReferencePolicy.DYNAMIC, + unbind = "unsetOTPManagementService") protected void setOTPManagementService(OTPManagementService otpManagementService) { if (log.isDebugEnabled()) { log.debug("Setting OTP Management OSGI Service"); diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/BaseWebAppAuthenticatorFrameworkTest.java b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/BaseWebAppAuthenticatorFrameworkTest.java index 08814c7446..5cbc878fb9 100644 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/BaseWebAppAuthenticatorFrameworkTest.java +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/BaseWebAppAuthenticatorFrameworkTest.java @@ -19,12 +19,15 @@ package io.entgra.device.mgt.core.webapp.authenticator.framework; +import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHolder; +import io.entgra.device.mgt.core.device.mgt.core.permission.mgt.PermissionUtils; +import io.entgra.device.mgt.core.webapp.authenticator.framework.internal.AuthenticatorFrameworkDataHolder; +import io.entgra.device.mgt.core.webapp.authenticator.framework.util.TestTenantIndexingLoader; +import io.entgra.device.mgt.core.webapp.authenticator.framework.util.TestTenantRegistryLoader; import org.testng.annotations.BeforeSuite; import org.wso2.carbon.CarbonConstants; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.core.internal.CarbonCoreDataHolder; -import io.entgra.device.mgt.core.device.mgt.core.internal.DeviceManagementDataHolder; -import io.entgra.device.mgt.core.device.mgt.core.permission.mgt.PermissionUtils; import org.wso2.carbon.registry.core.config.RegistryContext; import org.wso2.carbon.registry.core.exceptions.RegistryException; import org.wso2.carbon.registry.core.internal.RegistryDataHolder; @@ -35,9 +38,6 @@ import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.user.api.UserStoreManager; import org.wso2.carbon.user.core.service.RealmService; import org.wso2.carbon.utils.multitenancy.MultitenantConstants; -import io.entgra.device.mgt.core.webapp.authenticator.framework.internal.AuthenticatorFrameworkDataHolder; -import io.entgra.device.mgt.core.webapp.authenticator.framework.util.TestTenantIndexingLoader; -import io.entgra.device.mgt.core.webapp.authenticator.framework.util.TestTenantRegistryLoader; import java.io.File; import java.io.InputStream; diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/WebappAuthenticationValveTest.java b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/WebappAuthenticationValveTest.java index 0c89fe4ecb..7da4adc9ec 100644 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/WebappAuthenticationValveTest.java +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/WebappAuthenticationValveTest.java @@ -18,6 +18,7 @@ package io.entgra.device.mgt.core.webapp.authenticator.framework; +import io.entgra.device.mgt.core.webapp.authenticator.framework.util.TestRequest; import org.apache.catalina.Context; import org.apache.catalina.connector.Connector; import org.apache.catalina.connector.Request; @@ -30,7 +31,6 @@ import org.testng.Assert; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import org.wso2.carbon.tomcat.ext.valves.CompositeValve; -import io.entgra.device.mgt.core.webapp.authenticator.framework.util.TestRequest; import javax.servlet.http.HttpServletResponse; import java.lang.reflect.Field; diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/WebappAuthenticatorConfigTest.java b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/WebappAuthenticatorConfigTest.java index cba25ea90e..fc7f94c839 100644 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/WebappAuthenticatorConfigTest.java +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/WebappAuthenticatorConfigTest.java @@ -17,16 +17,15 @@ */ package io.entgra.device.mgt.core.webapp.authenticator.framework; -import io.entgra.device.mgt.core.webapp.authenticator.framework.AuthenticatorFrameworkException; +import io.entgra.device.mgt.core.webapp.authenticator.framework.config.AuthenticatorConfig; +import io.entgra.device.mgt.core.webapp.authenticator.framework.config.AuthenticatorConfigService; +import io.entgra.device.mgt.core.webapp.authenticator.framework.config.WebappAuthenticatorConfig; +import io.entgra.device.mgt.core.webapp.authenticator.framework.config.impl.AuthenticatorConfigServiceImpl; import org.testng.Assert; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import org.wso2.carbon.utils.ServerConstants; -import io.entgra.device.mgt.core.webapp.authenticator.framework.config.AuthenticatorConfig; -import io.entgra.device.mgt.core.webapp.authenticator.framework.config.AuthenticatorConfigService; -import io.entgra.device.mgt.core.webapp.authenticator.framework.config.WebappAuthenticatorConfig; -import io.entgra.device.mgt.core.webapp.authenticator.framework.config.impl.AuthenticatorConfigServiceImpl; import java.util.List; diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/WebappAuthenticatorFrameworkUtilTest.java b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/WebappAuthenticatorFrameworkUtilTest.java index 34319eeee7..47d7e59bab 100644 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/WebappAuthenticatorFrameworkUtilTest.java +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/WebappAuthenticatorFrameworkUtilTest.java @@ -17,6 +17,7 @@ */ package io.entgra.device.mgt.core.webapp.authenticator.framework; +import io.entgra.device.mgt.core.webapp.authenticator.framework.Utils.OAuthTokenValidationStubFactory; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.commons.pool.ObjectPool; @@ -24,7 +25,6 @@ import org.apache.commons.pool.impl.GenericObjectPool; import org.testng.Assert; import org.testng.annotations.Test; import org.wso2.carbon.identity.oauth2.stub.OAuth2TokenValidationServiceStub; -import io.entgra.device.mgt.core.webapp.authenticator.framework.Utils.OAuthTokenValidationStubFactory; import java.util.Properties; diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/WebappAuthenticatorRepositoryTest.java b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/WebappAuthenticatorRepositoryTest.java index 48cb70829d..ccd3c70c2a 100644 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/WebappAuthenticatorRepositoryTest.java +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/WebappAuthenticatorRepositoryTest.java @@ -17,12 +17,11 @@ */ package io.entgra.device.mgt.core.webapp.authenticator.framework; -import io.entgra.device.mgt.core.webapp.authenticator.framework.WebappAuthenticatorRepository; -import org.testng.Assert; -import org.testng.annotations.Test; import io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.WebappAuthenticator; import io.entgra.device.mgt.core.webapp.authenticator.framework.util.MalformedAuthenticator; import io.entgra.device.mgt.core.webapp.authenticator.framework.util.TestWebappAuthenticator; +import org.testng.Assert; +import org.testng.annotations.Test; public class WebappAuthenticatorRepositoryTest { diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/BSTAuthenticatorTest.java b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/BSTAuthenticatorTest.java index 667391d308..d22ad085be 100644 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/BSTAuthenticatorTest.java +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/BSTAuthenticatorTest.java @@ -18,6 +18,10 @@ package io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator; +import io.entgra.device.mgt.core.webapp.authenticator.framework.AuthenticationInfo; +import io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.oauth.OAuth2TokenValidator; +import io.entgra.device.mgt.core.webapp.authenticator.framework.internal.AuthenticatorFrameworkDataHolder; +import io.entgra.device.mgt.core.webapp.authenticator.framework.util.TestInputBuffer; import org.apache.catalina.Context; import org.apache.catalina.connector.Request; import org.apache.catalina.core.StandardContext; @@ -32,10 +36,6 @@ import org.wso2.carbon.base.MultitenantConstants; import org.wso2.carbon.identity.oauth2.OAuth2TokenValidationService; import org.wso2.carbon.identity.oauth2.dto.OAuth2ClientApplicationDTO; import org.wso2.carbon.identity.oauth2.dto.OAuth2TokenValidationResponseDTO; -import io.entgra.device.mgt.core.webapp.authenticator.framework.AuthenticationInfo; -import io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.oauth.OAuth2TokenValidator; -import io.entgra.device.mgt.core.webapp.authenticator.framework.internal.AuthenticatorFrameworkDataHolder; -import io.entgra.device.mgt.core.webapp.authenticator.framework.util.TestInputBuffer; import java.io.File; import java.io.IOException; diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/BasicAuthAuthenticatorTest.java b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/BasicAuthAuthenticatorTest.java index 94033b74e2..4254d83fc4 100644 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/BasicAuthAuthenticatorTest.java +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/BasicAuthAuthenticatorTest.java @@ -18,6 +18,8 @@ package io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator; +import io.entgra.device.mgt.core.webapp.authenticator.framework.AuthenticationInfo; +import io.entgra.device.mgt.core.webapp.authenticator.framework.BaseWebAppAuthenticatorFrameworkTest; import org.apache.catalina.Context; import org.apache.catalina.connector.Request; import org.apache.catalina.core.StandardContext; @@ -26,11 +28,8 @@ import org.apache.tomcat.util.buf.MessageBytes; import org.apache.tomcat.util.http.MimeHeaders; import org.testng.Assert; import org.testng.annotations.BeforeClass; -import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; import org.wso2.carbon.utils.multitenancy.MultitenantConstants; -import io.entgra.device.mgt.core.webapp.authenticator.framework.AuthenticationInfo; -import io.entgra.device.mgt.core.webapp.authenticator.framework.BaseWebAppAuthenticatorFrameworkTest; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/CertificateAuthenticatorTest.java b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/CertificateAuthenticatorTest.java index bcc88b8943..9784ba61d1 100644 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/CertificateAuthenticatorTest.java +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/CertificateAuthenticatorTest.java @@ -18,22 +18,6 @@ package io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator; -import org.apache.catalina.Context; -import org.apache.catalina.connector.Request; -import org.apache.catalina.core.StandardContext; -import org.apache.tomcat.util.buf.MessageBytes; -import org.apache.tomcat.util.http.MimeHeaders; -import org.bouncycastle.cert.jcajce.JcaCertStore; -import org.bouncycastle.cms.CMSAbsentContent; -import org.bouncycastle.cms.CMSException; -import org.bouncycastle.cms.CMSSignedData; -import org.bouncycastle.cms.CMSSignedDataGenerator; -import org.h2.jdbcx.JdbcDataSource; -import org.mockito.Mockito; -import org.testng.Assert; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; -import org.wso2.carbon.base.MultitenantConstants; import io.entgra.device.mgt.core.certificate.mgt.core.dao.CertificateManagementDAOFactory; import io.entgra.device.mgt.core.certificate.mgt.core.exception.KeystoreException; import io.entgra.device.mgt.core.certificate.mgt.core.impl.CertificateGenerator; @@ -45,12 +29,28 @@ import io.entgra.device.mgt.core.certificate.mgt.core.scep.TenantedDeviceWrapper import io.entgra.device.mgt.core.certificate.mgt.core.service.CertificateManagementService; import io.entgra.device.mgt.core.certificate.mgt.core.service.CertificateManagementServiceImpl; import io.entgra.device.mgt.core.device.mgt.common.Device; -import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.common.EnrolmentInfo; +import io.entgra.device.mgt.core.device.mgt.common.exceptions.DeviceManagementException; import io.entgra.device.mgt.core.device.mgt.core.config.DeviceConfigurationManager; import io.entgra.device.mgt.core.webapp.authenticator.framework.AuthenticationInfo; import io.entgra.device.mgt.core.webapp.authenticator.framework.internal.AuthenticatorFrameworkDataHolder; import io.entgra.device.mgt.core.webapp.authenticator.framework.util.TestCertificateGenerator; +import org.apache.catalina.Context; +import org.apache.catalina.connector.Request; +import org.apache.catalina.core.StandardContext; +import org.apache.tomcat.util.buf.MessageBytes; +import org.apache.tomcat.util.http.MimeHeaders; +import org.bouncycastle.cert.jcajce.JcaCertStore; +import org.bouncycastle.cms.CMSAbsentContent; +import org.bouncycastle.cms.CMSException; +import org.bouncycastle.cms.CMSSignedData; +import org.bouncycastle.cms.CMSSignedDataGenerator; +import org.h2.jdbcx.JdbcDataSource; +import org.mockito.Mockito; +import org.testng.Assert; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; +import org.wso2.carbon.base.MultitenantConstants; import javax.sql.DataSource; import java.io.File; diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/JWTAuthenticatorTest.java b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/JWTAuthenticatorTest.java index 4ce617659e..35d434bc57 100644 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/JWTAuthenticatorTest.java +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/JWTAuthenticatorTest.java @@ -18,6 +18,10 @@ package io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator; +import io.entgra.device.mgt.core.identity.jwt.client.extension.dto.JWTConfig; +import io.entgra.device.mgt.core.identity.jwt.client.extension.exception.JWTClientException; +import io.entgra.device.mgt.core.identity.jwt.client.extension.util.JWTClientUtil; +import io.entgra.device.mgt.core.webapp.authenticator.framework.AuthenticationInfo; import org.apache.catalina.connector.Request; import org.apache.tomcat.util.buf.MessageBytes; import org.apache.tomcat.util.http.MimeHeaders; @@ -25,10 +29,6 @@ import org.testng.Assert; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import org.wso2.carbon.base.MultitenantConstants; -import io.entgra.device.mgt.core.identity.jwt.client.extension.dto.JWTConfig; -import io.entgra.device.mgt.core.identity.jwt.client.extension.exception.JWTClientException; -import io.entgra.device.mgt.core.identity.jwt.client.extension.util.JWTClientUtil; -import io.entgra.device.mgt.core.webapp.authenticator.framework.AuthenticationInfo; import java.io.File; import java.io.FileInputStream; diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/OauthAuthenticatorTest.java b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/OauthAuthenticatorTest.java index af9fb47938..e2285145d0 100644 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/OauthAuthenticatorTest.java +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/authenticator/OauthAuthenticatorTest.java @@ -18,6 +18,9 @@ package io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator; +import io.entgra.device.mgt.core.webapp.authenticator.framework.AuthenticationInfo; +import io.entgra.device.mgt.core.webapp.authenticator.framework.BaseWebAppAuthenticatorFrameworkTest; +import io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.oauth.impl.RemoteOAuthValidator; import org.apache.catalina.connector.Request; import org.apache.commons.pool.impl.GenericObjectPool; import org.apache.tomcat.util.buf.MessageBytes; @@ -26,13 +29,9 @@ import org.mockito.Mockito; import org.testng.Assert; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; -import org.wso2.carbon.core.security.AuthenticatorsConfiguration; import org.wso2.carbon.identity.oauth2.stub.OAuth2TokenValidationServiceStub; import org.wso2.carbon.identity.oauth2.stub.dto.OAuth2ClientApplicationDTO; import org.wso2.carbon.identity.oauth2.stub.dto.OAuth2TokenValidationResponseDTO; -import io.entgra.device.mgt.core.webapp.authenticator.framework.AuthenticationInfo; -import io.entgra.device.mgt.core.webapp.authenticator.framework.BaseWebAppAuthenticatorFrameworkTest; -import io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.oauth.impl.RemoteOAuthValidator; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/util/MalformedAuthenticator.java b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/util/MalformedAuthenticator.java index 2bbe24e3b1..f287fa766e 100644 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/util/MalformedAuthenticator.java +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/util/MalformedAuthenticator.java @@ -17,10 +17,10 @@ */ package io.entgra.device.mgt.core.webapp.authenticator.framework.util; -import org.apache.catalina.connector.Request; -import org.apache.catalina.connector.Response; import io.entgra.device.mgt.core.webapp.authenticator.framework.AuthenticationInfo; import io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.WebappAuthenticator; +import org.apache.catalina.connector.Request; +import org.apache.catalina.connector.Response; import java.util.Properties; diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/util/TestCertificateGenerator.java b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/util/TestCertificateGenerator.java index 7363a4403f..f578580e8e 100644 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/util/TestCertificateGenerator.java +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/util/TestCertificateGenerator.java @@ -18,6 +18,11 @@ package io.entgra.device.mgt.core.webapp.authenticator.framework.util; +import io.entgra.device.mgt.core.certificate.mgt.core.bean.Certificate; +import io.entgra.device.mgt.core.certificate.mgt.core.exception.KeystoreException; +import io.entgra.device.mgt.core.certificate.mgt.core.impl.CertificateGenerator; +import io.entgra.device.mgt.core.certificate.mgt.core.util.CertificateManagementConstants; +import io.entgra.device.mgt.core.certificate.mgt.core.util.CommonUtil; import org.bouncycastle.cert.X509v3CertificateBuilder; import org.bouncycastle.cert.jcajce.JcaX509CertificateConverter; import org.bouncycastle.cert.jcajce.JcaX509v3CertificateBuilder; @@ -25,23 +30,11 @@ import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.bouncycastle.operator.ContentSigner; import org.bouncycastle.operator.OperatorCreationException; import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder; -import io.entgra.device.mgt.core.certificate.mgt.core.bean.Certificate; -import io.entgra.device.mgt.core.certificate.mgt.core.exception.KeystoreException; -import io.entgra.device.mgt.core.certificate.mgt.core.impl.CertificateGenerator; -import io.entgra.device.mgt.core.certificate.mgt.core.util.CertificateManagementConstants; -import io.entgra.device.mgt.core.certificate.mgt.core.util.CommonUtil; import org.wso2.carbon.context.PrivilegedCarbonContext; import javax.security.auth.x500.X500Principal; import java.math.BigInteger; -import java.security.InvalidKeyException; -import java.security.KeyPair; -import java.security.KeyPairGenerator; -import java.security.NoSuchAlgorithmException; -import java.security.NoSuchProviderException; -import java.security.SecureRandom; -import java.security.Security; -import java.security.SignatureException; +import java.security.*; import java.security.cert.CertificateException; import java.security.cert.CertificateExpiredException; import java.security.cert.CertificateNotYetValidException; diff --git a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/util/TestWebappAuthenticator.java b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/util/TestWebappAuthenticator.java index 6ef378b499..39315bb46d 100644 --- a/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/util/TestWebappAuthenticator.java +++ b/components/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework/src/test/java/io/entgra/device/mgt/core/webapp/authenticator/framework/util/TestWebappAuthenticator.java @@ -17,10 +17,10 @@ */ package io.entgra.device.mgt.core.webapp.authenticator.framework.util; -import org.apache.catalina.connector.Request; -import org.apache.catalina.connector.Response; import io.entgra.device.mgt.core.webapp.authenticator.framework.AuthenticationInfo; import io.entgra.device.mgt.core.webapp.authenticator.framework.authenticator.WebappAuthenticator; +import org.apache.catalina.connector.Request; +import org.apache.catalina.connector.Response; import java.util.Properties; diff --git a/components/webapp-authenticator-framework/pom.xml b/components/webapp-authenticator-framework/pom.xml index 19df2b4fa7..f5f2d2c1f3 100644 --- a/components/webapp-authenticator-framework/pom.xml +++ b/components/webapp-authenticator-framework/pom.xml @@ -31,29 +31,10 @@ webapp-authenticator-framework pom WSO2 Carbon - Webapp Authenticator Framework - http://wso2.org + https://entgra.io io.entgra.device.mgt.core.webapp.authenticator.framework - - - - - - - - - - - - - - - - - - - diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.feature/pom.xml index f2af32fd57..f13b9e3927 100644 --- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.feature/pom.xml +++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.application.extension.feature/pom.xml @@ -29,7 +29,7 @@ io.entgra.device.mgt.core.apimgt.application.extension.feature pom WSO2 Carbon - API Management Application Extension Feature - http://wso2.org + https://entgra.io This feature contains an implementation of a api application registration, which takes care of subscription and generating keys. diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.feature/pom.xml index 4241922ffa..636cc8c34e 100644 --- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.feature/pom.xml +++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.keymgt.extension.feature/pom.xml @@ -29,7 +29,7 @@ io.entgra.device.mgt.core.apimgt.keymgt.extension.feature pom WSO2 Carbon - Api Key Mgt Extensions Feature - http://wso2.org + https://entgra.io This feature contains apimgt related key management extensions diff --git a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher.feature/pom.xml b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher.feature/pom.xml index 242ed90d48..1a2cb3b77e 100644 --- a/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher.feature/pom.xml +++ b/features/apimgt-extensions/io.entgra.device.mgt.core.apimgt.webapp.publisher.feature/pom.xml @@ -29,7 +29,7 @@ io.entgra.device.mgt.core.apimgt.webapp.publisher.feature pom WSO2 Carbon - API Management Webapp Publisher Feature - http://wso2.org + https://entgra.io This feature contains an implementation of a Tomcat lifecycle listener, which takes care of publishing JAX-RS web applications as 'Managed APIs' @@ -44,7 +44,7 @@ io.entgra.device.mgt.core.apimgt.annotations - org.wso2.orbit.org.scannotation + io.entgra.org.scannotation scannotation @@ -137,7 +137,7 @@ io.entgra.device.mgt.core:io.entgra.device.mgt.core.apimgt.annotations:${io.entgra.device.mgt.core.version} - org.wso2.orbit.org.scannotation:scannotation:${scannotation.version} + io.entgra.org.scannotation:scannotation:${scannotation.version} io.swagger:swagger-annotations:${swagger.version} diff --git a/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/pom.xml b/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/pom.xml index 213810dcc7..d8f8e0e32f 100644 --- a/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/pom.xml +++ b/features/apimgt-extensions/org.wso2.carbon.apimgt.handler.server.feature/pom.xml @@ -30,7 +30,7 @@ org.wso2.carbon.apimgt.handler.server.feature pom WSO2 Carbon - Device Management - APIM handler Server Feature - http://wso2.org + https://entgra.io This feature contains the handler for the api authentications diff --git a/features/apimgt-extensions/org.wso2.carbon.apimgt.integration.client.feature/pom.xml b/features/apimgt-extensions/org.wso2.carbon.apimgt.integration.client.feature/pom.xml index ce3dc88224..37c5189f98 100644 --- a/features/apimgt-extensions/org.wso2.carbon.apimgt.integration.client.feature/pom.xml +++ b/features/apimgt-extensions/org.wso2.carbon.apimgt.integration.client.feature/pom.xml @@ -29,7 +29,7 @@ org.wso2.carbon.apimgt.integration.client.feature pom WSO2 Carbon - APIM Integration Client Feature - http://wso2.org + https://entgra.io This feature contains a http client implementation to communicate with WSO2-APIM server diff --git a/features/apimgt-extensions/pom.xml b/features/apimgt-extensions/pom.xml index 72acd8222b..9c37daadae 100644 --- a/features/apimgt-extensions/pom.xml +++ b/features/apimgt-extensions/pom.xml @@ -31,7 +31,7 @@ apimgt-extensions-feature pom WSO2 Carbon - API Management Extensions Feature - http://wso2.org + https://entgra.io io.entgra.device.mgt.core.apimgt.webapp.publisher.feature diff --git a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/conf/datasources/application-mgt-datasources.xml b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/conf/datasources/application-mgt-datasources.xml index dd3b6fc42f..f13ee588b6 100644 --- a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/conf/datasources/application-mgt-datasources.xml +++ b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/conf/datasources/application-mgt-datasources.xml @@ -16,7 +16,7 @@ ~ under the License. --> - + org.wso2.carbon.ndatasource.rdbms.RDBMSDataSourceReader diff --git a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/h2.sql b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/h2.sql index f9c5861831..961e855337 100644 --- a/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/h2.sql +++ b/features/application-mgt/io.entgra.device.mgt.core.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/h2.sql @@ -42,6 +42,7 @@ CREATE TABLE IF NOT EXISTS AP_APP_RELEASE( RATED_USERS INTEGER NULL, AP_APP_ID INTEGER NOT NULL, PRIMARY KEY (ID), + CONSTRAINT UUID_CONSTRAINT UNIQUE (UUID), CONSTRAINT fk_AP_APP_RELEASE_AP_APP1 FOREIGN KEY (AP_APP_ID) REFERENCES AP_APP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION @@ -267,7 +268,7 @@ CREATE INDEX fk_AP_APP_SUB_OP_MAPPING_AP_DEVICE_SUBSCRIPTION1_idx ON AP_APP_SUB_ CREATE TABLE IF NOT EXISTS AP_SCHEDULED_SUBSCRIPTION( ID INTEGER NOT NULL AUTO_INCREMENT, TASK_NAME VARCHAR(100) NOT NULL, - APPLICATION_UUID VARCHAR(36) NOT NULL, + APPLICATION_UUID VARCHAR(200) NOT NULL, SUBSCRIBER_LIST LONGVARCHAR NOT NULL, STATUS VARCHAR(15) NOT NULL, SCHEDULED_AT BIGINT NOT NULL, diff --git a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api.feature/pom.xml b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api.feature/pom.xml index ee58bc2216..5617820cf5 100644 --- a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api.feature/pom.xml +++ b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.api.feature/pom.xml @@ -30,7 +30,7 @@ io.entgra.device.mgt.core.certificate.mgt.api.feature pom WSO2 Carbon - Certificate Management API Feature - http://wso2.org + https://entgra.io This feature contains the APIs required for Certificate Management. diff --git a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.feature/pom.xml b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.feature/pom.xml index db7000769b..c21ff6fb19 100644 --- a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.feature/pom.xml +++ b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.feature/pom.xml @@ -30,7 +30,7 @@ io.entgra.device.mgt.core.certificate.mgt.cert.admin.api.feature pom WSO2 Carbon - Admin Certificate Management API Feature - http://wso2.org + https://entgra.io This feature contains the APIs required for Admin Certificate Management. diff --git a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml index d8a370bdca..3867d0806e 100644 --- a/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml +++ b/features/certificate-mgt/io.entgra.device.mgt.core.certificate.mgt.server.feature/pom.xml @@ -30,7 +30,7 @@ io.entgra.device.mgt.core.certificate.mgt.server.feature pom WSO2 Carbon - Certificate Management Server Feature - http://wso2.org + https://entgra.io This feature contains the core bundles required for back-end Certificate Management functionality @@ -48,7 +48,7 @@ bcpkix-jdk15on - org.wso2.orbit.com.google.code.jscep + io.entgra.com.google.code.jscep jscep @@ -123,7 +123,7 @@ org.wso2.orbit.org.bouncycastle:bcpkix-jdk15on:${bcpkix.wso2.version} - org.wso2.orbit.com.google.code.jscep:jscep:${jscep.version} + io.entgra.com.google.code.jscep:jscep:${jscep.version} commons-io.wso2:commons-io:${version.commons.io} diff --git a/features/certificate-mgt/pom.xml b/features/certificate-mgt/pom.xml index 8c37615ec3..3acaabfd9d 100644 --- a/features/certificate-mgt/pom.xml +++ b/features/certificate-mgt/pom.xml @@ -30,7 +30,7 @@ certificate-mgt-feature pom WSO2 Carbon - Certificate Management Feature - http://wso2.org + https://entgra.io io.entgra.device.mgt.core.certificate.mgt.server.feature diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature/pom.xml index 8d70721d62..5d58fe1956 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature/pom.xml @@ -30,7 +30,7 @@ io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature pom WSO2 Carbon - Device Type Deployer Feature - http://wso2.org + https://entgra.io WSO2 Carbon - Device Type Deployer Feature diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml index 571afedea1..89babbcd7a 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.feature/pom.xml @@ -30,7 +30,7 @@ io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.fcm.feature pom WSO2 Carbon - FCM Based Push Notification Provider Feature - http://wso2.org + https://entgra.io WSO2 Carbon - MQTT Based Push Notification Provider Feature diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.feature/pom.xml index 994954f7c8..9dacdae6ba 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.feature/pom.xml @@ -30,7 +30,7 @@ io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.http.feature pom WSO2 Carbon - MQTT Based Push Notification Provider Feature - http://wso2.org + https://entgra.io WSO2 Carbon - MQTT Based Push Notification Provider Feature diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml index 33367e1029..e37e6fbd26 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.feature/pom.xml @@ -30,7 +30,7 @@ io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.mqtt.feature pom WSO2 Carbon - MQTT Based Push Notification Provider Feature - http://wso2.org + https://entgra.io WSO2 Carbon - MQTT Based Push Notification Provider Feature diff --git a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml index d050b68e09..f74312e6a3 100644 --- a/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml +++ b/features/device-mgt-extensions/io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.feature/pom.xml @@ -30,7 +30,7 @@ io.entgra.device.mgt.core.device.mgt.extensions.push.notification.provider.xmpp.feature pom WSO2 Carbon - XMPP Based Push Notification Provider Feature - http://wso2.org + https://entgra.io WSO2 Carbon - XMPP Based Push Notification Provider Feature diff --git a/features/device-mgt-extensions/pom.xml b/features/device-mgt-extensions/pom.xml index cc1b9bbbb9..e02dcb8012 100644 --- a/features/device-mgt-extensions/pom.xml +++ b/features/device-mgt-extensions/pom.xml @@ -30,7 +30,7 @@ device-mgt-extensions-feature pom WSO2 Carbon - Device Management Extensions Feature - http://wso2.org + https://entgra.io io.entgra.device.mgt.core.device.mgt.extensions.device.type.deployer.feature diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.api.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.api.feature/pom.xml index 563d5062a2..845e0f69d7 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.api.feature/pom.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.api.feature/pom.xml @@ -30,7 +30,7 @@ io.entgra.device.mgt.core.device.mgt.api.feature pom WSO2 Carbon - Device Management API Feature - http://wso2.org + https://entgra.io This feature contains the APIs required for Device Management console UI diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/pom.xml index 11bcc403ce..2a2c6468b1 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/pom.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/pom.xml @@ -30,7 +30,7 @@ io.entgra.device.mgt.core.device.mgt.basics.feature pom WSO2 Carbon - Device Management Basics Feature - http://wso2.org + https://entgra.io This feature contains the core bundles required for Basic Device Management functionality diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/datasources/cdm-datasources.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/datasources/cdm-datasources.xml index 037512da4a..7923fef1bf 100755 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/datasources/cdm-datasources.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/datasources/cdm-datasources.xml @@ -16,7 +16,7 @@ ~ under the License. --> - + org.wso2.carbon.ndatasource.rdbms.RDBMSDataSourceReader diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/datasources/reporting-mgt-datasources.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/datasources/reporting-mgt-datasources.xml index 96b84711ba..7f675a6e5b 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/datasources/reporting-mgt-datasources.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/conf/datasources/reporting-mgt-datasources.xml @@ -16,7 +16,7 @@ ~ under the License. --> - + org.wso2.carbon.ndatasource.rdbms.RDBMSDataSourceReader diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql index f675cfb0f3..df3277920d 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql @@ -42,7 +42,7 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE ( ID INTEGER auto_increment NOT NULL, DESCRIPTION TEXT DEFAULT NULL, NAME VARCHAR(100) DEFAULT NULL, - DEVICE_TYPE_ID INT(11) DEFAULT NULL, + DEVICE_TYPE_ID INT DEFAULT NULL, DEVICE_IDENTIFICATION VARCHAR(300) DEFAULT NULL, LAST_UPDATED_TIMESTAMP TIMESTAMP NOT NULL, TENANT_ID INTEGER DEFAULT 0, @@ -188,17 +188,17 @@ CREATE TABLE IF NOT EXISTS DM_PROFILE ( ); CREATE TABLE IF NOT EXISTS DM_POLICY ( - ID INT(11) NOT NULL AUTO_INCREMENT , + ID INT NOT NULL AUTO_INCREMENT , NAME VARCHAR(45) DEFAULT NULL , DESCRIPTION VARCHAR(1000) NULL, PAYLOAD_VERSION VARCHAR (45) NULL, - TENANT_ID INT(11) NOT NULL , - PROFILE_ID INT(11) NOT NULL , + TENANT_ID INT NOT NULL , + PROFILE_ID INT NOT NULL , OWNERSHIP_TYPE VARCHAR(45) NULL, COMPLIANCE VARCHAR(100) NULL, PRIORITY INT NOT NULL, - ACTIVE INT(2) NOT NULL, - UPDATED INT(1) NULL, + ACTIVE INT NOT NULL, + UPDATED INT NULL, POLICY_TYPE VARCHAR(45) NULL, PRIMARY KEY (ID) , CONSTRAINT FK_DM_PROFILE_DM_POLICY @@ -209,11 +209,11 @@ CREATE TABLE IF NOT EXISTS DM_POLICY ( ); CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY ( - ID INT(11) NOT NULL AUTO_INCREMENT , - DEVICE_ID INT(11) NOT NULL , - ENROLMENT_ID INT(11) NOT NULL, + ID INT NOT NULL AUTO_INCREMENT , + DEVICE_ID INT NOT NULL , + ENROLMENT_ID INT NOT NULL, DEVICE BLOB NOT NULL, - POLICY_ID INT(11) NOT NULL , + POLICY_ID INT NOT NULL , PRIMARY KEY (ID) , CONSTRAINT FK_POLICY_DEVICE_POLICY FOREIGN KEY (POLICY_ID ) @@ -228,9 +228,9 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY ( ); CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE_POLICY ( - ID INT(11) NOT NULL , + ID INT NOT NULL , DEVICE_TYPE VARCHAR(300) NOT NULL , - POLICY_ID INT(11) NOT NULL , + POLICY_ID INT NOT NULL , PRIMARY KEY (ID) , CONSTRAINT FK_DEVICE_TYPE_POLICY FOREIGN KEY (POLICY_ID ) @@ -240,11 +240,11 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE_POLICY ( ); CREATE TABLE IF NOT EXISTS DM_PROFILE_FEATURES ( - ID INT(11) NOT NULL AUTO_INCREMENT, - PROFILE_ID INT(11) NOT NULL, + ID INT NOT NULL AUTO_INCREMENT, + PROFILE_ID INT NOT NULL, FEATURE_CODE VARCHAR(100) NOT NULL, DEVICE_TYPE VARCHAR(300) NOT NULL, - TENANT_ID INT(11) NOT NULL , + TENANT_ID INT NOT NULL , CONTENT BLOB NULL DEFAULT NULL, PRIMARY KEY (ID), CONSTRAINT FK_DM_PROFILE_DM_POLICY_FEATURES @@ -255,11 +255,11 @@ CREATE TABLE IF NOT EXISTS DM_PROFILE_FEATURES ( ); CREATE TABLE IF NOT EXISTS DM_POLICY_CORRECTIVE_ACTION ( - ID INT(11) NOT NULL AUTO_INCREMENT, + ID INT NOT NULL AUTO_INCREMENT, ACTION_TYPE VARCHAR(45) NOT NULL, - CORRECTIVE_POLICY_ID INT(11) DEFAULT NULL, - POLICY_ID INT(11) NOT NULL, - FEATURE_ID INT(11) DEFAULT NULL, + CORRECTIVE_POLICY_ID INT DEFAULT NULL, + POLICY_ID INT NOT NULL, + FEATURE_ID INT DEFAULT NULL, IS_REACTIVE BOOLEAN NOT NULL DEFAULT FALSE, PRIMARY KEY (ID), CONSTRAINT FK_DM_POLICY_DM_POLICY_CORRECTIVE_ACTION @@ -270,9 +270,9 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_CORRECTIVE_ACTION ( ); CREATE TABLE IF NOT EXISTS DM_ROLE_POLICY ( - ID INT(11) NOT NULL AUTO_INCREMENT , + ID INT NOT NULL AUTO_INCREMENT , ROLE_NAME VARCHAR(45) NOT NULL , - POLICY_ID INT(11) NOT NULL , + POLICY_ID INT NOT NULL , PRIMARY KEY (ID) , CONSTRAINT FK_ROLE_POLICY_POLICY FOREIGN KEY (POLICY_ID ) @@ -296,11 +296,11 @@ CREATE TABLE IF NOT EXISTS DM_USER_POLICY ( CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY_APPLIED ( ID INT NOT NULL AUTO_INCREMENT , DEVICE_ID INT NOT NULL , - ENROLMENT_ID INT(11) NOT NULL, + ENROLMENT_ID INT NOT NULL, POLICY_ID INT NOT NULL , POLICY_CONTENT BLOB NULL , TENANT_ID INT NOT NULL, - APPLIED TINYINT(1) NULL , + APPLIED TINYINT NULL , CREATED_TIME TIMESTAMP NULL , UPDATED_TIME TIMESTAMP NULL , APPLIED_TIME TIMESTAMP NULL , @@ -353,7 +353,7 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_CRITERIA_PROPERTIES ( CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_STATUS ( ID INT NOT NULL AUTO_INCREMENT, DEVICE_ID INT NOT NULL, - ENROLMENT_ID INT(11) NOT NULL, + ENROLMENT_ID INT NOT NULL, POLICY_ID INT NOT NULL, TENANT_ID INT NOT NULL, STATUS INT NULL, @@ -368,7 +368,7 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_CHANGE_MGT ( ID INT NOT NULL AUTO_INCREMENT, POLICY_ID INT NOT NULL, DEVICE_TYPE VARCHAR(300) NOT NULL , - TENANT_ID INT(11) NOT NULL, + TENANT_ID INT NOT NULL, PRIMARY KEY (ID) ); @@ -397,7 +397,7 @@ CREATE TABLE IF NOT EXISTS DM_APPLICATION ( LOCATION_URL VARCHAR(100) DEFAULT NULL, IMAGE_URL VARCHAR(100) DEFAULT NULL, APP_PROPERTIES BLOB NULL, - MEMORY_USAGE INTEGER(10) NULL, + MEMORY_USAGE INTEGER NULL, IS_ACTIVE BOOLEAN NOT NULL DEFAULT FALSE, DEVICE_ID INTEGER NOT NULL, ENROLMENT_ID INTEGER NOT NULL, @@ -417,6 +417,16 @@ CREATE TABLE IF NOT EXISTS DM_APPLICATION ( -- POLICY RELATED TABLES FINISHED -- +CREATE TABLE IF NOT EXISTS DM_APP_ICONS ( + ID INTEGER AUTO_INCREMENT NOT NULL, + ICON_PATH VARCHAR(150) DEFAULT NULL, + PACKAGE_NAME VARCHAR(150) NOT NULL, + VERSION VARCHAR(50) DEFAULT '1.1.0', + CREATED_TIMESTAMP TIMESTAMP NOT NULL, + TENANT_ID INTEGER NOT NULL, + PRIMARY KEY (ID) +); + -- NOTIFICATION TABLE -- CREATE TABLE IF NOT EXISTS DM_NOTIFICATION ( NOTIFICATION_ID INTEGER AUTO_INCREMENT NOT NULL, @@ -466,7 +476,7 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_LOCATION ( STATE VARCHAR(45) NULL, COUNTRY VARCHAR(45) NULL, GEO_HASH VARCHAR(45) NULL, - UPDATE_TIMESTAMP BIGINT(15) NOT NULL, + UPDATE_TIMESTAMP BIGINT NOT NULL, ALTITUDE DOUBLE NULL, SPEED FLOAT NULL, BEARING FLOAT NULL, @@ -503,8 +513,8 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_DETAIL ( CPU_USAGE DECIMAL(5) NULL, TOTAL_RAM_MEMORY DECIMAL(30,3) NULL, AVAILABLE_RAM_MEMORY DECIMAL(30,3) NULL, - PLUGGED_IN INT(1) NULL, - UPDATE_TIMESTAMP BIGINT(15) NOT NULL, + PLUGGED_IN INT NULL, + UPDATE_TIMESTAMP BIGINT NOT NULL, PRIMARY KEY (ID), CONSTRAINT FK_DM_DEVICE_DETAILS_DEVICE FOREIGN KEY (DEVICE_ID) @@ -531,7 +541,7 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_HISTORY_LAST_SEVEN_DAYS LONGITUDE DOUBLE NULL, SPEED FLOAT NULL, HEADING FLOAT NULL, - TIMESTAMP BIGINT(15) NOT NULL, + TIMESTAMP BIGINT NOT NULL, GEO_HASH VARCHAR(45) NULL, DEVICE_OWNER VARCHAR(45) NULL, DEVICE_ALTITUDE DOUBLE NULL, @@ -812,16 +822,17 @@ CREATE TABLE IF NOT EXISTS DM_TRACCAR_UNSYNCED_DEVICES ( -- END OF DM_TRACCAR_UNSYNCED_DEVICES TABLE -- -- SUB_OPERATION_TEMPLATE TABLE-- -CREATE TABLE SUB_OPERATION_TEMPLATE ( - SUB_OPERATION_TEMPLATE_ID int NOT NULL AUTO_INCREMENT, +CREATE TABLE IF NOT EXISTS SUB_OPERATION_TEMPLATE ( + SUB_OPERATION_TEMPLATE_ID INT NOT NULL AUTO_INCREMENT, OPERATION_DEFINITION TEXT NOT NULL, - OPERATION_CODE varchar(100) NOT NULL, - SUB_TYPE_ID int NOT NULL, + OPERATION_CODE VARCHAR(100) NOT NULL, + SUB_TYPE_ID INT NOT NULL, DEVICE_TYPE VARCHAR(25) NOT NULL, - CREATE_TIMESTAMP timestamp NULL DEFAULT NULL, - UPDATE_TIMESTAMP timestamp NULL DEFAULT NULL, + CREATE_TIMESTAMP TIMESTAMP NULL DEFAULT NULL, + UPDATE_TIMESTAMP TIMESTAMP NULL DEFAULT NULL, PRIMARY KEY (SUB_OPERATION_TEMPLATE_ID), - UNIQUE KEY SUB_OPERATION_TEMPLATE (SUB_TYPE_ID,OPERATION_CODE, DEVICE_TYPE), + CONSTRAINT uk_sub_operation_template UNIQUE (SUB_TYPE_ID, OPERATION_CODE, DEVICE_TYPE), +-- UNIQUE KEY SUB_OPERATION_TEMPLATE (SUB_TYPE_ID, OPERATION_CODE, DEVICE_TYPE), CONSTRAINT fk_SUB_OPERATION_TEMPLATE_DM_DEVICE_SUB_TYPE FOREIGN KEY (SUB_TYPE_ID, DEVICE_TYPE) REFERENCES DM_DEVICE_SUB_TYPE (SUB_TYPE_ID, DEVICE_TYPE) ); diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql index 028c24829f..c162d41e06 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql @@ -462,6 +462,17 @@ CREATE INDEX IDX_DM_APPLICATION ON DM_APPLICATION(DEVICE_ID, ENROLMENT_ID, TENAN -- POLICY RELATED TABLES FINISHED -- +IF NOT EXISTS (SELECT * SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[DM_APP_ICONS]') AND TYPE IN (N'U')) +CREATE TABLE DM_APP_ICONS ( + ID INTEGER IDENTITY(1,1) NOT NULL, + ICON_PATH VARCHAR(150) DEFAULT NULL, + PACKAGE_NAME VARCHAR(150) NOT NULL, + VERSION VARCHAR(50) DEFAULT '1.1.0', + CREATED_TIMESTAMP DATETIME2 NOT NULL, + TENANT_ID INTEGER NOT NULL, + PRIMARY KEY (ID) +); + -- POLICY AND DEVICE GROUP MAPPING -- IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[DM_DEVICE_GROUP_POLICY]') AND TYPE IN (N'U')) CREATE TABLE DM_DEVICE_GROUP_POLICY ( diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql index 0c5a8fb090..6dcc7bec44 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mysql.sql @@ -458,6 +458,16 @@ CREATE INDEX IDX_DM_APPLICATION ON DM_APPLICATION(DEVICE_ID, ENROLMENT_ID, TENAN -- END OF POLICY RELATED TABLES -- +CREATE TABLE IF NOT EXISTS DM_APP_ICONS ( + ID INTEGER AUTO_INCREMENT NOT NULL, + ICON_PATH VARCHAR(150) DEFAULT NULL, + PACKAGE_NAME VARCHAR(150) NOT NULL, + VERSION VARCHAR(50) DEFAULT '1.1.0', + CREATED_TIMESTAMP TIMESTAMP NOT NULL, + TENANT_ID INTEGER NOT NULL, + PRIMARY KEY (ID) +)ENGINE = InnoDB; + -- POLICY AND DEVICE GROUP MAPPING -- CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_POLICY ( diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql index 1a0ddb3064..a6f87c9cb6 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql @@ -748,6 +748,28 @@ WHEN (NEW.ID IS NULL) -- POLICY RELATED TABLES FINISHED -- +CREATE TABLE DM_APP_ICONS ( + ID NUMBER(10) NOT NULL, + ICON_PATH VARCHAR2(150) DEFAULT NULL, + PACKAGE_NAME VARCHAR2(150) NOT NULL, + VERSION VARCHAR2(50) DEFAULT '1.1.0', + CREATED_TIMESTAMP TIMESTAMP(0) NOT NULL, + TENANT_ID NUMBER(10) NOT NULL, + PRIMARY KEY (ID) +) +/ + +-- Generate ID using sequence and trigger +CREATE SEQUENCE DM_APP_ICONS_seq START WITH 1 INCREMENT BY 1 NOCACHE +/ +CREATE OR REPLACE TRIGGER DM_APP_ICONS_seq_tr +BEFORE INSERT ON DM_APP_ICONS FOR EACH ROW +WHEN (NEW.ID IS NULL) + BEGIN + SELECT DM_APP_ICONS_seq.NEXTVAL INTO :NEW.ID FROM DUAL; + END; +/ + -- NOTIFICATION TABLE -- CREATE TABLE DM_NOTIFICATION ( NOTIFICATION_ID NUMBER(10) NOT NULL, diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql index 7df9dcc065..8c601111b7 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql @@ -490,6 +490,19 @@ CREATE TABLE IF NOT EXISTS DM_APPLICATION ( -- END OF POLICY RELATED TABLES -- +CREATE SEQUENCE DM_APP_ICONS_seq; + +CREATE TABLE IF NOT EXISTS DM_APP_ICONS ( + ID INTEGER DEFAULT NEXTVAL ('DM_APP_ICONS_seq') NOT NULL, + ICON_PATH VARCHAR(150) DEFAULT NULL, + PACKAGE_NAME VARCHAR(150) NOT NULL, + VERSION VARCHAR(50) DEFAULT '1.1.0', + CREATED_TIMESTAMP TIMESTAMP(0) NOT NULL, + TENANT_ID INTEGER NOT NULL, + PRIMARY KEY (ID) +) +; + -- POLICY AND DEVICE GROUP MAPPING -- CREATE SEQUENCE DM_DEVICE_GROUP_POLICY_seq; diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions.feature/pom.xml index eadab36e01..904012948e 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions.feature/pom.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.extensions.feature/pom.xml @@ -30,7 +30,7 @@ io.entgra.device.mgt.core.device.mgt.extensions.feature pom WSO2 Carbon - Device Management Extensions Feature - http://wso2.org + https://entgra.io This feature contains common extensions used by key device management functionalities diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.feature/pom.xml index c94186ed7a..6455ab6f05 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.feature/pom.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.feature/pom.xml @@ -30,7 +30,7 @@ io.entgra.device.mgt.core.device.mgt.feature pom WSO2 Carbon - Device Management Aggregate Feature - http://wso2.org + https://entgra.io This feature contains all the bundles required for device management related functionalities @@ -44,11 +44,7 @@ javax.servlet.jsp-api - org.wso2.carbon.store - org.wso2.store.sso.common - - - org.wso2.orbit.org.scannotation + io.entgra.org.scannotation scannotation @@ -78,8 +74,7 @@ javax.servlet.jsp:javax.servlet.jsp-api - org.wso2.carbon.store:org.wso2.store.sso.common:${carbon.store.sso.common.version} - org.wso2.orbit.org.scannotation:scannotation:${scannotation.version} + io.entgra.org.scannotation:scannotation:${scannotation.version} diff --git a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.server.feature/pom.xml b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.server.feature/pom.xml index 4bd372c2fe..cb5841a715 100644 --- a/features/device-mgt/io.entgra.device.mgt.core.device.mgt.server.feature/pom.xml +++ b/features/device-mgt/io.entgra.device.mgt.core.device.mgt.server.feature/pom.xml @@ -30,7 +30,7 @@ io.entgra.device.mgt.core.device.mgt.server.feature pom WSO2 Carbon - Device Management Server Feature - http://wso2.org + https://entgra.io This feature contains the core bundles required for Back-end Device Management functionality diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.analytics.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.analytics.feature/pom.xml index 3e927ddf96..cbb89240a5 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.analytics.feature/pom.xml +++ b/features/device-mgt/org.wso2.carbon.device.mgt.analytics.feature/pom.xml @@ -30,7 +30,7 @@ org.wso2.carbon.device.mgt.analytics.feature pom WSO2 Carbon - Device Management Server Feature - http://wso2.org + https://entgra.io This feature contains bundles related to device analytics data publisher and ws proxy 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 7b10f52ff3..829952e408 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 @@ -30,7 +30,7 @@ org.wso2.carbon.device.mgt.ui.feature pom WSO2 Carbon - Device Management Base UI Feature - http://wso2.org + https://entgra.io This feature contains the base UI required for Device Management diff --git a/features/device-mgt/pom.xml b/features/device-mgt/pom.xml index 63317d4ab8..230fa3700f 100644 --- a/features/device-mgt/pom.xml +++ b/features/device-mgt/pom.xml @@ -30,7 +30,7 @@ device-mgt-feature pom WSO2 Carbon - Device Management Feature - http://wso2.org + https://entgra.io io.entgra.device.mgt.core.device.mgt.basics.feature diff --git a/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/src/main/resources/datasources/heart-beat-datasources.xml b/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/src/main/resources/datasources/heart-beat-datasources.xml index 84136c25e1..5982b3e054 100644 --- a/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/src/main/resources/datasources/heart-beat-datasources.xml +++ b/features/heartbeat-management/io.entgra.device.mgt.core.server.heart.beat.feature/src/main/resources/datasources/heart-beat-datasources.xml @@ -15,7 +15,7 @@ ~ specific language governing permissions and limitations ~ under the License. --> - + org.wso2.carbon.ndatasource.rdbms.RDBMSDataSourceReader diff --git a/features/jwt-client/io.entgra.device.mgt.core.identity.jwt.client.extension.feature/pom.xml b/features/jwt-client/io.entgra.device.mgt.core.identity.jwt.client.extension.feature/pom.xml index 2ee4004505..57b1438027 100644 --- a/features/jwt-client/io.entgra.device.mgt.core.identity.jwt.client.extension.feature/pom.xml +++ b/features/jwt-client/io.entgra.device.mgt.core.identity.jwt.client.extension.feature/pom.xml @@ -31,7 +31,7 @@ io.entgra.device.mgt.core.identity.jwt.client.extension.feature pom WSO2 Carbon - JWT Client Feature - http://wso2.org + https://entgra.io This feature contains jwt client implementation from which we can get a access token using the jwt grant type handler diff --git a/features/jwt-client/pom.xml b/features/jwt-client/pom.xml index 4c37769faa..3220ebb7da 100644 --- a/features/jwt-client/pom.xml +++ b/features/jwt-client/pom.xml @@ -31,7 +31,7 @@ jwt-client-feature pom WSO2 Carbon - JWT Client Extension Feature - http://wso2.org + https://entgra.io io.entgra.device.mgt.core.identity.jwt.client.extension.feature diff --git a/features/logger/io.entgra.device.mgt.core.notification.logger.feature/pom.xml b/features/logger/io.entgra.device.mgt.core.notification.logger.feature/pom.xml index 489a81a1e2..1bfe57fa69 100644 --- a/features/logger/io.entgra.device.mgt.core.notification.logger.feature/pom.xml +++ b/features/logger/io.entgra.device.mgt.core.notification.logger.feature/pom.xml @@ -41,7 +41,6 @@ org.ops4j.pax.logging pax-logging-api provided - org.testng diff --git a/features/oauth-extensions/org.wso2.carbon.device.mgt.oauth.extensions.feature/pom.xml b/features/oauth-extensions/org.wso2.carbon.device.mgt.oauth.extensions.feature/pom.xml index ed92a080a1..29e96f43cd 100644 --- a/features/oauth-extensions/org.wso2.carbon.device.mgt.oauth.extensions.feature/pom.xml +++ b/features/oauth-extensions/org.wso2.carbon.device.mgt.oauth.extensions.feature/pom.xml @@ -31,7 +31,7 @@ io.entgra.device.mgt.core.device.mgt.oauth.extensions.feature pom WSO2 Carbon - Device Mgt OAuth Extensions Feature - http://wso2.org + https://entgra.io This feature contains devicemgt related OAuth extensions diff --git a/features/oauth-extensions/pom.xml b/features/oauth-extensions/pom.xml index 16063e957b..d40fd22467 100644 --- a/features/oauth-extensions/pom.xml +++ b/features/oauth-extensions/pom.xml @@ -30,7 +30,7 @@ oauth-extensions-feature pom WSO2 Carbon - Device Management OAuth Extensions Feature - http://wso2.org + https://entgra.io io.entgra.device.mgt.core.device.mgt.oauth.extensions.feature diff --git a/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml b/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml index a060cfb4cb..7f96d0da93 100644 --- a/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml +++ b/features/policy-mgt/io.entgra.device.mgt.core.policy.mgt.server.feature/pom.xml @@ -31,7 +31,7 @@ io.entgra.device.mgt.core.policy.mgt.server.feature pom WSO2 Carbon - Policy Management Server Feature - http://wso2.org + https://entgra.io This feature contains the core bundles required for Back-end Device Management functionality diff --git a/features/policy-mgt/pom.xml b/features/policy-mgt/pom.xml index d8f251bcc3..97a7746320 100644 --- a/features/policy-mgt/pom.xml +++ b/features/policy-mgt/pom.xml @@ -32,7 +32,7 @@ policy-mgt-feature pom WSO2 Carbon - Policy Management Feature - http://wso2.org + https://entgra.io io.entgra.device.mgt.core.policy.mgt.server.feature diff --git a/features/task-mgt/io.entgra.device.mgt.core.task.mgt.feature/pom.xml b/features/task-mgt/io.entgra.device.mgt.core.task.mgt.feature/pom.xml index f906007e37..7984cd5521 100755 --- a/features/task-mgt/io.entgra.device.mgt.core.task.mgt.feature/pom.xml +++ b/features/task-mgt/io.entgra.device.mgt.core.task.mgt.feature/pom.xml @@ -29,7 +29,7 @@ io.entgra.device.mgt.core.task.mgt.feature pom Entgra IoT - Task Manager Feature - http://wso2.org + https://entgra.io diff --git a/features/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.server.feature/pom.xml b/features/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.server.feature/pom.xml index 952ca5d915..001cc0dd34 100644 --- a/features/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.server.feature/pom.xml +++ b/features/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.server.feature/pom.xml @@ -90,7 +90,6 @@ - io.entgra.device.mgt.core:io.entgra.device.mgt.core.tenant.mgt.core:${io.entgra.device.mgt.core.version} diff --git a/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/pom.xml b/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/pom.xml index 761a0603f4..73986be63f 100644 --- a/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/pom.xml +++ b/features/transport-mgt/email-sender/io.entgra.device.mgt.core.email.sender.feature/pom.xml @@ -30,7 +30,7 @@ io.entgra.device.mgt.core.email.sender.feature pom WSO2 Carbon - Email Sender Feature - http://wso2.org + https://entgra.io This feature contains the core bundles required for email sender related functionality @@ -39,10 +39,6 @@ io.entgra.device.mgt.core io.entgra.device.mgt.core.transport.mgt.email.sender.core - - org.wso2.orbit.org.apache.velocity - velocity - @@ -96,9 +92,6 @@ io.entgra.device.mgt.core:io.entgra.device.mgt.core.transport.mgt.email.sender.core:${io.entgra.device.mgt.core.version} - - org.wso2.orbit.org.apache.velocity:velocity:${velocity.version} - org.wso2.carbon.core.server:${carbon.kernel.version} diff --git a/features/transport-mgt/email-sender/pom.xml b/features/transport-mgt/email-sender/pom.xml index 41485338e8..a75c167bfa 100644 --- a/features/transport-mgt/email-sender/pom.xml +++ b/features/transport-mgt/email-sender/pom.xml @@ -31,7 +31,7 @@ email-sender-feature pom WSO2 Carbon - Email Sender Feature - http://wso2.org + https://entgra.io io.entgra.device.mgt.core.email.sender.feature diff --git a/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/pom.xml b/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/pom.xml index 19dc0b0f0d..ce0141f915 100644 --- a/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/pom.xml +++ b/features/webapp-authenticator-framework/io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature/pom.xml @@ -30,7 +30,7 @@ io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature pom WSO2 Carbon - Webapp Authenticator Framework Server Feature - http://wso2.org + https://entgra.io This feature contains the core bundles required for Back-end Device Management functionality diff --git a/features/webapp-authenticator-framework/pom.xml b/features/webapp-authenticator-framework/pom.xml index dac2640428..5aaec7c6b5 100644 --- a/features/webapp-authenticator-framework/pom.xml +++ b/features/webapp-authenticator-framework/pom.xml @@ -31,7 +31,7 @@ webapp-authenticator-framework-feature pom WSO2 Carbon - Webapp Authenticator Framework Feature - http://wso2.org + https://entgra.io io.entgra.device.mgt.core.webapp.authenticator.framework.server.feature diff --git a/pom.xml b/pom.xml index b22fcc22a0..2c025ae108 100644 --- a/pom.xml +++ b/pom.xml @@ -25,7 +25,7 @@ pom 5.0.26-SNAPSHOT WSO2 Carbon - Device Management - Parent - http://wso2.org + https://entgra.io WSO2 Connected Device Manager Components org.wso2 @@ -609,28 +609,6 @@ - - - org.eclipse.osgi - org.eclipse.osgi - ${eclipse.osgi.version} - - - org.eclipse.equinox - org.eclipse.equinox.common - ${eclipse.equinox.common.version} - - - org.eclipse.osgi - org.eclipse.osgi.services - ${eclipse.equinox.services.version} - - - - - - - org.testng @@ -732,10 +710,6 @@ org.eclipse.equinox org.eclipse.equinox.http.helper - org.wso2.carbon org.wso2.carbon.registry.core @@ -838,12 +812,6 @@ - - - - - - org.wso2.orbit.com.h2database h2 @@ -933,12 +901,6 @@ axiom ${axiom.wso2.version} - - - - - - org.wso2.carbon.apimgt org.wso2.carbon.apimgt.api @@ -1180,42 +1142,6 @@ cxf-rt-transports-http ${cxf.version} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.wso2.carbon.identity.framework @@ -1284,11 +1210,6 @@ - - - - - com.googlecode.json-simple.wso2 json-simple @@ -1339,7 +1260,7 @@ ${bcpkix.wso2.version} - org.wso2.orbit.com.google.code.jscep + io.entgra.com.google.code.jscep jscep ${jscep.version} @@ -1389,11 +1310,6 @@ okhttp ${squareup.okhttp3.version} - - - - - io.github.openfeign feign-okhttp @@ -1433,12 +1349,7 @@ org.apache.velocity - velocity - 1.7 - - - org.wso2.orbit.org.apache.velocity - velocity + velocity-engine-core ${velocity.version} @@ -1451,12 +1362,6 @@ commons-collections ${commons-collections.version} - - - - - - @@ -1467,11 +1372,6 @@ - - - - - org.wso2.carbon.analytics-common org.wso2.carbon.event.stream.core @@ -1497,16 +1397,6 @@ org.wso2.carbon.event.output.adapter.rdbms ${carbon.analytics.common.version} - - - - - - - - - - org.wso2.carbon.analytics-common org.wso2.carbon.databridge.commons @@ -1556,7 +1446,7 @@ - org.wso2.orbit.org.scannotation + io.entgra.org.scannotation scannotation ${scannotation.version} @@ -1595,11 +1485,6 @@ ${eclipse.paho.version} - - - - - io.swagger swagger-annotations @@ -1625,16 +1510,6 @@ org.wso2.carbon.event.output.adapter.core ${carbon.analytics.common.version} - - - - - - - - - - org.wso2.carbon.analytics-common org.wso2.carbon.event.publisher.stub @@ -1747,11 +1622,6 @@ wss4j ${org.apache.ws.security.wso2.version} - - org.wso2.carbon.store - org.wso2.store.sso.common - ${carbon.store.sso.common.version} - io.github.openfeign feign-core @@ -1777,16 +1647,6 @@ feign-slf4j ${io.github.openfeign.version} - - org.apache.oltu.oauth2 - org.apache.oltu.oauth2.client - ${oltu.client.version} - - - com.fasterxml.jackson.datatype - jackson-datatype-joda - ${jackson.datatype.joda.version} - org.javassist javassist @@ -1922,6 +1782,11 @@ javax.cache.wso2 4.6.3-m5 + + org.apache.felix + org.apache.felix.scr.ds-annotations + ${apache.felix.scr.ds.annotations.version} + @@ -1960,8 +1825,8 @@ 3.8.1 UTF-8 - 17 - 17 + 11 + 11 @@ -1994,23 +1859,10 @@ 17 - - - - - - - - - - - - - org.apache.felix maven-bundle-plugin - 5.1.1 + 3.2.0 true NONE @@ -2104,28 +1956,13 @@ 4.8.1 [4.5.0, 5.0.0) 5.1.2 - - - [1.6.1, 1.7.0) 1.6.1-wso2v85 1.1.0-wso2v10 - - - - - - - - - - - - 4.13.1 @@ -2133,27 +1970,20 @@ 3.3.100.v20120522-1822 3.8.1.v20120830-144521 - - 7.0.93.wso2v1 7.0.93.wso2v1 7.0.34.wso2v2 - - - 5.24.8 [5.14.0, 6.0.0) 6.9.6 - 2.1.1 [2.1.1, 3.0.0) [5.14.0, 6.0.0) [6.0.0, 7.0.0) - 4.9.20 @@ -2185,7 +2015,6 @@ 5.3.5 [5.3.0,6.0.0) 1.3.25 - 2.3.5 @@ -2195,22 +2024,16 @@ 3.5.5 - 1.1.wso2v1 1.9.13 - - - - - - 1.60.0.wso2v1 - 1.60.0.wso2v1 - [1.52.0,1.70.0) + 1.70.0.wso2v1 + 1.70.0.wso2v1 + [1.52.0,1.80.0) - 2.3.0.wso2v2 + 2.3.0.entgrav2 3.0.0.wso2v1 1.3 @@ -2231,11 +2054,8 @@ 3.1.1 2.0.4.wso2v4 - - - - 1.0.3.wso2v1 + 1.0.3.entgrav1 [1.0.3, 2.0.0) 1.5.6.wso2v1 @@ -2245,12 +2065,11 @@ 3.1.0.wso2v2 4.2.5.wso2v1 - 1.7.0.wso2v1 + 2.3 2.4.0.wso2v1 3.2.0.wso2v1 (3.2.0, 3.3.0] - 5.1.34 @@ -2267,7 +2086,7 @@ 2.0.1 1.6.9 - + 1.6.9 4.0.1 @@ -2283,8 +2102,6 @@ 1.8.10.wso2v2 - - 1.7.0 @@ -2299,18 +2116,12 @@ 2.1.7-wso2v227 1.5.11-wso2v18 - - 1.5.1 - 11.0 [9.3.1,10.0.0) - - 1.0.1 - 2.1.5 1.9 (1.9,2.0] - 3.26.0-GA + 3.18.1-GA true @@ -2332,7 +2143,6 @@ 9.0.24 1.1 - 5.3.23 2.7.18 @@ -2342,7 +2152,6 @@ [1.2.0,1.3.0) 4.2.0 - 2.8.1.wso2v2 4.3.1.wso2v1 2.1.210.wso2v1 @@ -2352,6 +2161,11 @@ 2.3.1.wso2v1 2.4 1.2.2.wso2v1 + [9.0,10) + 1.2.4 + [4.7.0, 4.9.0) + [1.0.1, 2.0.0) + [4.7.0, 5.0.0)