diff --git a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/pom.xml b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/pom.xml index 76c6139f6b3..ec7db0c36fa 100644 --- a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/pom.xml +++ b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/pom.xml @@ -31,7 +31,7 @@ war Entgra - Factory Management API Entgra - Factory Management API - http://entgra.io + https://entgra.io @@ -132,6 +132,10 @@ + + org.apache.cxf + cxf-rt-frontend-jaxrs + io.swagger swagger-annotations @@ -214,5 +218,27 @@ 5.0.27-SNAPSHOT compile + + org.ops4j.pax.logging + pax-logging-api + 1.11.2 + compile + + + org.hibernate + hibernate-validator + + + jakarta.validation + jakarta.validation-api + 2.0.2 + compile + + + + javax.servlet + javax.servlet-api + provided + \ No newline at end of file diff --git a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/src/main/java/io.entgra.device.mgt.core.factory.mgt.api/common/GsonMessageBodyHandler.java b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/src/main/java/io.entgra.device.mgt.core.factory.mgt.api/addons/GsonMessageBodyHandler.java similarity index 98% rename from components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/src/main/java/io.entgra.device.mgt.core.factory.mgt.api/common/GsonMessageBodyHandler.java rename to components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/src/main/java/io.entgra.device.mgt.core.factory.mgt.api/addons/GsonMessageBodyHandler.java index 6c0318dac9c..8144f01df67 100644 --- a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/src/main/java/io.entgra.device.mgt.core.factory.mgt.api/common/GsonMessageBodyHandler.java +++ b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/src/main/java/io.entgra.device.mgt.core.factory.mgt.api/addons/GsonMessageBodyHandler.java @@ -16,7 +16,7 @@ * under the License. */ -package io.entgra.device.mgt.core.factory.mgt.api.common; +package io.entgra.device.mgt.core.factory.mgt.api.addons; import com.google.gson.Gson; import com.google.gson.GsonBuilder; diff --git a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/src/main/java/io.entgra.device.mgt.core.factory.mgt.api/exception/ValidationInterceptor.java b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/src/main/java/io.entgra.device.mgt.core.factory.mgt.api/addons/ValidationInterceptor.java similarity index 97% rename from components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/src/main/java/io.entgra.device.mgt.core.factory.mgt.api/exception/ValidationInterceptor.java rename to components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/src/main/java/io.entgra.device.mgt.core.factory.mgt.api/addons/ValidationInterceptor.java index 632a1554edf..66c12c846c5 100644 --- a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/src/main/java/io.entgra.device.mgt.core.factory.mgt.api/exception/ValidationInterceptor.java +++ b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/src/main/java/io.entgra.device.mgt.core.factory.mgt.api/addons/ValidationInterceptor.java @@ -16,7 +16,7 @@ * under the License. */ -package io.entgra.device.mgt.core.factory.mgt.api.exception; +package io.entgra.device.mgt.core.factory.mgt.api.addons; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -28,7 +28,9 @@ import org.apache.cxf.message.Message; import org.apache.cxf.message.MessageContentsList; import org.apache.cxf.phase.AbstractPhaseInterceptor; import org.apache.cxf.phase.Phase; + import javax.validation.ConstraintViolation; +import javax.validation.ConstraintViolationException; import javax.validation.Validation; import javax.validation.Validator; import javax.validation.ValidatorFactory; diff --git a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/src/main/java/io.entgra.device.mgt.core.factory.mgt.api/exception/ConstraintViolationException.java b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/src/main/java/io.entgra.device.mgt.core.factory.mgt.api/exception/ConstraintViolationException.java deleted file mode 100644 index c642f9cad9e..00000000000 --- a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/src/main/java/io.entgra.device.mgt.core.factory.mgt.api/exception/ConstraintViolationException.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package io.entgra.device.mgt.core.factory.mgt.api.exception; - -import io.entgra.device.mgt.core.factory.mgt.api.util.Constants; -import io.entgra.device.mgt.core.factory.mgt.api.util.DeviceMgtUtil; - -import javax.validation.ConstraintViolation; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.Response; -import java.util.Set; - -public class ConstraintViolationException extends WebApplicationException { - private String message; - - public ConstraintViolationException(Set> violations) { - super(Response.status(Response.Status.BAD_REQUEST) - .entity(DeviceMgtUtil.getConstraintViolationErrorDTO(violations)) - .header(Constants.DeviceConstants.HEADER_CONTENT_TYPE, Constants.DeviceConstants.APPLICATION_JSON) - .build()); - - //Set the error message - StringBuilder stringBuilder = new StringBuilder(); - for (ConstraintViolation violation : violations) { - stringBuilder.append(violation.getRootBeanClass().getSimpleName()); - stringBuilder.append("."); - stringBuilder.append(violation.getPropertyPath()); - stringBuilder.append(": "); - stringBuilder.append(violation.getMessage()); - stringBuilder.append(", "); - } - message = stringBuilder.toString(); - } - - @Override - public String getMessage() { - return message; - } -} diff --git a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/src/main/java/io.entgra.device.mgt.core.factory.mgt.api/service/ProductionPlanAPIService.java b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/src/main/java/io.entgra.device.mgt.core.factory.mgt.api/service/ProductionPlanAPIService.java index 7d23e2d5e97..f3ba87cfba4 100644 --- a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/src/main/java/io.entgra.device.mgt.core.factory.mgt.api/service/ProductionPlanAPIService.java +++ b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/src/main/java/io.entgra.device.mgt.core.factory.mgt.api/service/ProductionPlanAPIService.java @@ -17,7 +17,7 @@ */ package io.entgra.device.mgt.core.factory.mgt.api.service; -import io.entgra.device.mgt.core.factory.mgt.api.util.FactoryManagementAPIConstants; +import io.entgra.device.mgt.core.factory.mgt.api.util.Constants; import io.entgra.device.mgt.core.factory.mgt.common.wrapper.ProductionPlanWrapper; import io.entgra.device.mgt.core.factory.mgt.api.beans.ErrorResponse; import io.swagger.annotations.Api; @@ -107,7 +107,7 @@ public interface ProductionPlanAPIService { extensions = { @Extension(properties = { @ExtensionProperty( - name = FactoryManagementAPIConstants.SCOPE, + name = Constants.SCOPE, value = "perm:factory:production-plan:view" ) }) @@ -172,7 +172,7 @@ public interface ProductionPlanAPIService { extensions = { @Extension(properties = { @ExtensionProperty( - name = FactoryManagementAPIConstants.SCOPE, + name = Constants.SCOPE, value = "perm:factory:production-plan:add" ) }) @@ -228,7 +228,7 @@ public interface ProductionPlanAPIService { extensions = { @Extension(properties = { @ExtensionProperty( - name = FactoryManagementAPIConstants.SCOPE, + name = Constants.SCOPE, value = "perm:factory:production-plan:update" ) }) @@ -288,7 +288,7 @@ public interface ProductionPlanAPIService { extensions = { @Extension(properties = { @ExtensionProperty( - name = FactoryManagementAPIConstants.SCOPE, + name = Constants.SCOPE, value = "perm:factory:production-plan:delete" ) }) diff --git a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/src/main/java/io.entgra.device.mgt.core.factory.mgt.api/util/Constants.java b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/src/main/java/io.entgra.device.mgt.core.factory.mgt.api/util/Constants.java index 0478c6d9863..9db946c55f0 100644 --- a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/src/main/java/io.entgra.device.mgt.core.factory.mgt.api/util/Constants.java +++ b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/src/main/java/io.entgra.device.mgt.core.factory.mgt.api/util/Constants.java @@ -1,39 +1,26 @@ -/* - * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - package io.entgra.device.mgt.core.factory.mgt.api.util; /** - * Holds the constants used by DeviceImpl Management Admin web application. + * Defines constants used in Factory management REST API bundle. */ public class Constants { + public static final String HEADER_CONTENT_TYPE = "Content-Type"; + public static final String APPLICATION_JSON = "application/json"; + public static final String SCOPE = "scope"; - public final class ErrorMessages { - private ErrorMessages () { throw new AssertionError(); } - - public static final String STATUS_BAD_REQUEST_MESSAGE_DEFAULT = "Bad Request"; - } - - public final class DeviceConstants { - private DeviceConstants () { throw new AssertionError(); } + public static final class CSVConstants { + public static final String CSV_HEADER_DATE = "date"; + public static final String CSV_HEADER_TIME = "time"; + public static final String CSV_HEADER_MACHINE_ID = "machineId"; + public static final String CSV_HEADER_TARGET = "target"; + public static final String CSV_HEADER_PRODUCT_ID = "productId"; + public static final String CSV_FILE_SEPARATOR = ","; + } - public static final String APPLICATION_JSON = "application/json"; - public static final String HEADER_CONTENT_TYPE = "Content-Type"; - } + public final class DeviceConstants { + private DeviceConstants () { throw new AssertionError(); } + public static final String APPLICATION_JSON = "application/json"; + public static final String HEADER_CONTENT_TYPE = "Content-Type"; + } } diff --git a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/src/main/java/io.entgra.device.mgt.core.factory.mgt.api/util/FactoryManagementAPIConstants.java b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/src/main/java/io.entgra.device.mgt.core.factory.mgt.api/util/FactoryManagementAPIConstants.java deleted file mode 100644 index 85c216c3fd2..00000000000 --- a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/src/main/java/io.entgra.device.mgt.core.factory.mgt.api/util/FactoryManagementAPIConstants.java +++ /dev/null @@ -1,19 +0,0 @@ -package io.entgra.device.mgt.core.factory.mgt.api.util; - -/** - * Defines constants used in Factory management REST API bundle. - */ -public class FactoryManagementAPIConstants { - public static final String HEADER_CONTENT_TYPE = "Content-Type"; - public static final String APPLICATION_JSON = "application/json"; - public static final String SCOPE = "scope"; - - public static final class CSVConstants { - public static final String CSV_HEADER_DATE = "date"; - public static final String CSV_HEADER_TIME = "time"; - public static final String CSV_HEADER_MACHINE_ID = "machineId"; - public static final String CSV_HEADER_TARGET = "target"; - public static final String CSV_HEADER_PRODUCT_ID = "productId"; - public static final String CSV_FILE_SEPARATOR = ","; - } -} diff --git a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/src/main/webapp/META-INF/webapp-classloading.xml b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/src/main/webapp/META-INF/webapp-classloading.xml deleted file mode 100644 index 705c89edc90..00000000000 --- a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/src/main/webapp/META-INF/webapp-classloading.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - false - - - CXF3,Carbon - diff --git a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/src/main/webapp/WEB-INF/cxf-servlet.xml b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/src/main/webapp/WEB-INF/cxf-servlet.xml index d5f7bed3a08..0774ac3167b 100644 --- a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/src/main/webapp/WEB-INF/cxf-servlet.xml +++ b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/src/main/webapp/WEB-INF/cxf-servlet.xml @@ -34,12 +34,8 @@ - - - - - + @@ -52,7 +48,10 @@ - + + + + diff --git a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/src/main/webapp/WEB-INF/web.xml b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/src/main/webapp/WEB-INF/web.xml index 6cbc6de7cd2..9ad3a35969f 100644 --- a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/src/main/webapp/WEB-INF/web.xml +++ b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/src/main/webapp/WEB-INF/web.xml @@ -16,9 +16,8 @@ ~ specific language governing permissions and limitations ~ under the License. --> - - Factory-API-Webapp + Factory-Management-API-Webapp JAX-WS/JAX-RS Factory API Management Endpoint JAX-WS/JAX-RS Servlet diff --git a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.common/pom.xml b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.common/pom.xml index 31d65c17d8d..53738f5f176 100644 --- a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.common/pom.xml +++ b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.common/pom.xml @@ -1,4 +1,5 @@ + - + io.entgra.device.mgt.core @@ -29,9 +30,9 @@ 4.0.0 io.entgra.device.mgt.core.factory.mgt.common bundle - Entgra - Factory Management Commons - Entgra - Factory Management Commons - http://entgra.io + Entgra - Factory Management Common + Entgra - Factory Management Common + https://entgra.io diff --git a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/pom.xml b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/pom.xml index 389ac8c4a62..bf412bb1692 100644 --- a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/pom.xml +++ b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/pom.xml @@ -1,4 +1,5 @@ + + + io.entgra.device.mgt.core + io.entgra.device.mgt.core.factory.mgt.common + 5.0.27-SNAPSHOT + compile + + diff --git a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io.entgra.device.mgt.core.factory.mgt.core/config/datasource/DataSourceConfig.java b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io.entgra.device.mgt.core.factory.mgt.core/config/datasource/DataSourceConfig.java deleted file mode 100644 index 8cdb4be332d..00000000000 --- a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io.entgra.device.mgt.core.factory.mgt.core/config/datasource/DataSourceConfig.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2018 - 2021 Entgra (Pvt) Ltd, Inc - All Rights Reserved. - * - * Unauthorised copying/redistribution of this file, via any medium is strictly prohibited. - * - * Licensed under the Entgra Commercial License, Version 1.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://entgra.io/licenses/entgra-commercial/1.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package io.entgra.device.mgt.core.factory.mgt.core.config.datasource; - -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -/** - * Class for holding data source configuration in factory-mgt-config.xml at parsing with JAXB. - */ -@XmlRootElement(name = "DataSourceConfiguration") -public class DataSourceConfig { - - private JNDILookupDefinition jndiLookupDefinition; - - @XmlElement(name = "JndiLookupDefinition", required = true) - public JNDILookupDefinition getJndiLookupDefinition() { - return jndiLookupDefinition; - } - - public void setJndiLookupDefinition(JNDILookupDefinition jndiLookupDefinition) { - this.jndiLookupDefinition = jndiLookupDefinition; - } -} diff --git a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io.entgra.device.mgt.core.factory.mgt.core/config/datasource/JNDILookupDefinition.java b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io.entgra.device.mgt.core.factory.mgt.core/config/datasource/JNDILookupDefinition.java deleted file mode 100644 index 58266000e16..00000000000 --- a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io.entgra.device.mgt.core.factory.mgt.core/config/datasource/JNDILookupDefinition.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (C) 2018 - 2023 Entgra (Pvt) Ltd, Inc - All Rights Reserved. - * - * Unauthorised copying/redistribution of this file, via any medium is strictly prohibited. - * - * Licensed under the Entgra Commercial License, Version 1.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://entgra.io/licenses/entgra-commercial/1.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package io.entgra.device.mgt.core.factory.mgt.core.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 java.util.List; - -@XmlRootElement(name = "JndiLookupDefinition") -public class JNDILookupDefinition { - - private String jndiName; - private List jndiProperties; - - @XmlElement(name = "Name", nillable = false) - public String getJndiName() { - return jndiName; - } - - public void setJndiName(String jndiName) { - this.jndiName = jndiName; - } - - @XmlElementWrapper(name = "Environment", nillable = false) - @XmlElement(name = "Property", nillable = false) - public List getJndiProperties() { - return jndiProperties; - } - - public void setJndiProperties(List jndiProperties) { - this.jndiProperties = jndiProperties; - } - - @XmlRootElement(name = "Property") - public static class JNDIProperty { - - private String name; - - private String value; - - @XmlAttribute(name = "Name") - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - @XmlValue - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - } -} diff --git a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io.entgra.device.mgt.core.factory.mgt.core/config/FactoryConfigurationManager.java b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/config/FactoryConfigurationManager.java old mode 100755 new mode 100644 similarity index 78% rename from components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io.entgra.device.mgt.core.factory.mgt.core/config/FactoryConfigurationManager.java rename to components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/config/FactoryConfigurationManager.java index d0f992b17c6..29706882b6d --- a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io.entgra.device.mgt.core.factory.mgt.core/config/FactoryConfigurationManager.java +++ b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/config/FactoryConfigurationManager.java @@ -21,6 +21,7 @@ package io.entgra.device.mgt.core.factory.mgt.core.config; import io.entgra.device.mgt.core.factory.mgt.common.exception.FactoryMgtException; import io.entgra.device.mgt.core.factory.mgt.common.util.FactoryMgtConstants; import io.entgra.device.mgt.core.factory.mgt.core.util.FactoryMgtUtil; +import io.entgra.device.mgt.core.factory.mgt.core.config.datasource.DataSourceConfig; import org.w3c.dom.Document; import org.wso2.carbon.utils.CarbonUtils; @@ -30,12 +31,12 @@ import javax.xml.bind.Unmarshaller; import java.io.File; /** - * Class responsible for the factory mgt configuration initialization. + * Class responsible for the rss manager configuration initialization */ public class FactoryConfigurationManager { - private FactoryMgtConfig factoryMgtConfig; - private static volatile FactoryConfigurationManager factoryConfigurationManager; + private FactoryMgtConfig currentFactoryConfig; + private static FactoryConfigurationManager factoryConfigurationManager; private static final String FACTORY_MGT_CONFIG_PATH = CarbonUtils.getCarbonConfigDirPath() + File.separator + @@ -58,20 +59,17 @@ public class FactoryConfigurationManager { Document doc = FactoryMgtUtil.convertToDocument(factoryMgtConfig); JAXBContext cdmContext = JAXBContext.newInstance(FactoryMgtConfig.class); Unmarshaller unmarshaller = cdmContext.createUnmarshaller(); - this.factoryMgtConfig = (FactoryMgtConfig) unmarshaller.unmarshal(doc); + this.currentFactoryConfig = (FactoryMgtConfig) unmarshaller.unmarshal(doc); } catch (JAXBException e) { - throw new FactoryMgtException("Error occurred while initializing Data Source config", e); + throw new FactoryMgtException("Error occurred while initializing factory mgt config", e); } } - public FactoryMgtConfig getFactoryMgtConfig() throws FactoryMgtException { - if (factoryMgtConfig == null) { - initConfig(); - } - return factoryMgtConfig; + public FactoryMgtConfig getFactoryManagementConfig() { + return currentFactoryConfig; } - public void setFactoryMgtConfig(FactoryMgtConfig factoryMgtConfig) { - this.factoryMgtConfig = factoryMgtConfig; + public DataSourceConfig getDataSourceConfig() { + return currentFactoryConfig.getFactoryManagementRepository().getDataSourceConfig(); } } diff --git a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io.entgra.device.mgt.core.factory.mgt.core/config/FactoryMgtConfig.java b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/config/FactoryMgtConfig.java old mode 100755 new mode 100644 similarity index 70% rename from components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io.entgra.device.mgt.core.factory.mgt.core/config/FactoryMgtConfig.java rename to components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/config/FactoryMgtConfig.java index c4451e9f96b..880b6e437f0 --- a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io.entgra.device.mgt.core.factory.mgt.core/config/FactoryMgtConfig.java +++ b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/config/FactoryMgtConfig.java @@ -22,21 +22,20 @@ import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; /** - * Represents Factory Mgt configuration. + * Represents Device Mgt configuration. */ @XmlRootElement(name = "FactoryMgtConfiguration") -@SuppressWarnings("unused") public final class FactoryMgtConfig { - private FactoryMgtConfigRepository factoryMgtConfigRepository; + public void setFactoryManagementRepository(FactoryMgtRepository factoryMgtRepository) { + this.factoryMgtRepository = factoryMgtRepository; + } + + private FactoryMgtRepository factoryMgtRepository; @XmlElement(name = "ManagementRepository", required = true) - public FactoryMgtConfigRepository getFactoryMgtConfigRepository() { - return factoryMgtConfigRepository; + public FactoryMgtRepository getFactoryManagementRepository() { + return factoryMgtRepository; } - public void setFactoryMgtConfigRepository(FactoryMgtConfigRepository factoryMgtConfigRepository) { - this.factoryMgtConfigRepository = factoryMgtConfigRepository; - } } - diff --git a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io.entgra.device.mgt.core.factory.mgt.core/config/FactoryMgtConfigRepository.java b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/config/FactoryMgtRepository.java old mode 100755 new mode 100644 similarity index 97% rename from components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io.entgra.device.mgt.core.factory.mgt.core/config/FactoryMgtConfigRepository.java rename to components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/config/FactoryMgtRepository.java index 9b168eac15e..93da6ca5d3f --- a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io.entgra.device.mgt.core.factory.mgt.core/config/FactoryMgtConfigRepository.java +++ b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/config/FactoryMgtRepository.java @@ -27,7 +27,7 @@ import javax.xml.bind.annotation.XmlRootElement; * Class for holding management repository data. */ @XmlRootElement(name = "ManagementRepository") -public class FactoryMgtConfigRepository { +public class FactoryMgtRepository { private DataSourceConfig dataSourceConfig; diff --git a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/config/datasource/DataSourceConfig.java b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/config/datasource/DataSourceConfig.java new file mode 100644 index 00000000000..c8a2ce1bd41 --- /dev/null +++ b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/config/datasource/DataSourceConfig.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package io.entgra.device.mgt.core.factory.mgt.core.config.datasource; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * Holding data source configuration in factory-mgt-config.xml at parsing with JAXB + */ +@XmlRootElement(name = "DataSourceConfiguration") +public class DataSourceConfig { + + private JNDILookupDefinition jndiLookupDefinition; + + @XmlElement(name = "JndiLookupDefinition", nillable = true) + public JNDILookupDefinition getJndiLookupDefinition() { + return jndiLookupDefinition; + } + + public void setJndiLookupDefinition(JNDILookupDefinition jndiLookupDefinition) { + this.jndiLookupDefinition = jndiLookupDefinition; + } +} diff --git a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/config/datasource/JNDILookupDefinition.java b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/config/datasource/JNDILookupDefinition.java new file mode 100644 index 00000000000..f95932587ed --- /dev/null +++ b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/config/datasource/JNDILookupDefinition.java @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package io.entgra.device.mgt.core.factory.mgt.core.config.datasource; + +import javax.xml.bind.annotation.*; +import java.util.List; + +/** + * Class for hold JndiLookupDefinition of rss-manager.xml at parsing with JAXB + */ +@XmlRootElement(name = "JndiLookupDefinition") +public class JNDILookupDefinition { + + private String jndiName; + private List jndiProperties; + + @XmlElement(name = "Name", nillable = false) + public String getJndiName() { + return jndiName; + } + + public void setJndiName(String jndiName) { + this.jndiName = jndiName; + } + + @XmlElementWrapper(name = "Environment", nillable = false) + @XmlElement(name = "Property", nillable = false) + public List getJndiProperties() { + return jndiProperties; + } + + public void setJndiProperties(List jndiProperties) { + this.jndiProperties = jndiProperties; + } + + @XmlRootElement(name = "Property") + public static class JNDIProperty { + + private String name; + + private String value; + + @XmlAttribute(name = "Name") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @XmlValue + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + } + +} + diff --git a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io.entgra.device.mgt.core.factory.mgt.core/dao/BaseRequestDAO.java b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/dao/BaseRequestDAO.java similarity index 100% rename from components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io.entgra.device.mgt.core.factory.mgt.core/dao/BaseRequestDAO.java rename to components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/dao/BaseRequestDAO.java diff --git a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io.entgra.device.mgt.core.factory.mgt.core/dao/FactoryMgtDAO.java b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/dao/FactoryMgtDAO.java similarity index 100% rename from components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io.entgra.device.mgt.core.factory.mgt.core/dao/FactoryMgtDAO.java rename to components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/dao/FactoryMgtDAO.java diff --git a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io.entgra.device.mgt.core.factory.mgt.core/dao/common/FactoryMgtDAOFactory.java b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/dao/common/FactoryMgtDAOFactory.java similarity index 100% rename from components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io.entgra.device.mgt.core.factory.mgt.core/dao/common/FactoryMgtDAOFactory.java rename to components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/dao/common/FactoryMgtDAOFactory.java diff --git a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io.entgra.device.mgt.core.factory.mgt.core/dao/impl/FactoryMgtDAOImpl.java b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/dao/impl/FactoryMgtDAOImpl.java similarity index 100% rename from components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io.entgra.device.mgt.core.factory.mgt.core/dao/impl/FactoryMgtDAOImpl.java rename to components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/dao/impl/FactoryMgtDAOImpl.java diff --git a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io.entgra.device.mgt.core.factory.mgt.core/dto/ProductionPlan.java b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/dto/ProductionPlan.java similarity index 100% rename from components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io.entgra.device.mgt.core.factory.mgt.core/dto/ProductionPlan.java rename to components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/dto/ProductionPlan.java diff --git a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io.entgra.device.mgt.core.factory.mgt.core/exception/IllegalTransactionStateException.java b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/exception/IllegalTransactionStateException.java similarity index 100% rename from components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io.entgra.device.mgt.core.factory.mgt.core/exception/IllegalTransactionStateException.java rename to components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/exception/IllegalTransactionStateException.java diff --git a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io.entgra.device.mgt.core.factory.mgt.core/exception/TransactionManagementException.java b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/exception/TransactionManagementException.java similarity index 100% rename from components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io.entgra.device.mgt.core.factory.mgt.core/exception/TransactionManagementException.java rename to components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/exception/TransactionManagementException.java diff --git a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io.entgra.device.mgt.core.factory.mgt.core/exception/UnsupportedDatabaseEngineException.java b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/exception/UnsupportedDatabaseEngineException.java similarity index 100% rename from components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io.entgra.device.mgt.core.factory.mgt.core/exception/UnsupportedDatabaseEngineException.java rename to components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/exception/UnsupportedDatabaseEngineException.java diff --git a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io.entgra.device.mgt.core.factory.mgt.core/internal/FactoryMgtDataHolder.java b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/internal/FactoryMgtDataHolder.java similarity index 93% rename from components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io.entgra.device.mgt.core.factory.mgt.core/internal/FactoryMgtDataHolder.java rename to components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/internal/FactoryMgtDataHolder.java index ab0620ff58a..1a74fdb505a 100644 --- a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io.entgra.device.mgt.core.factory.mgt.core/internal/FactoryMgtDataHolder.java +++ b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/internal/FactoryMgtDataHolder.java @@ -22,7 +22,7 @@ import io.entgra.device.mgt.core.factory.mgt.common.spi.ProductionPlanService; public class FactoryMgtDataHolder { - public static final FactoryMgtDataHolder thisInstance = new FactoryMgtDataHolder(); + private static final FactoryMgtDataHolder thisInstance = new FactoryMgtDataHolder(); private ProductionPlanService productionPlanService; private FactoryMgtDataHolder() { @@ -35,5 +35,4 @@ public class FactoryMgtDataHolder { public void setProductionPlanService(ProductionPlanService productionPlanService) { this.productionPlanService = productionPlanService; } - } diff --git a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io.entgra.device.mgt.core.factory.mgt.core/internal/FactoryMgtServiceComponent.java b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/internal/FactoryMgtServiceComponent.java similarity index 65% rename from components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io.entgra.device.mgt.core.factory.mgt.core/internal/FactoryMgtServiceComponent.java rename to components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/internal/FactoryMgtServiceComponent.java index 398afe3c776..27e4b7a1dd0 100644 --- a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io.entgra.device.mgt.core.factory.mgt.core/internal/FactoryMgtServiceComponent.java +++ b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/internal/FactoryMgtServiceComponent.java @@ -1,18 +1,17 @@ /* - * Copyright (C) 2018 - 2023 Entgra (Pvt) Ltd, Inc - All Rights Reserved. + * Copyright (c) 2018 - 2023, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. * - * Unauthorised copying/redistribution of this file, via any medium is strictly prohibited. - * - * Licensed under the Entgra Commercial License, Version 1.0 (the "License"); - * you may not use this file except in compliance with the License. + * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. * You may obtain a copy of the License at * - * https://entgra.io/licenses/entgra-commercial/1.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the + * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ @@ -22,12 +21,11 @@ package io.entgra.device.mgt.core.factory.mgt.core.internal; import io.entgra.device.mgt.core.factory.mgt.common.spi.ProductionPlanService; import io.entgra.device.mgt.core.factory.mgt.core.config.FactoryConfigurationManager; import io.entgra.device.mgt.core.factory.mgt.core.config.FactoryMgtConfig; -import io.entgra.device.mgt.core.factory.mgt.core.config.datasource.DataSourceConfig; import io.entgra.device.mgt.core.factory.mgt.core.dao.common.FactoryMgtDAOFactory; import io.entgra.device.mgt.core.factory.mgt.core.service.impl.ProductionPlanServiceImpl; +import io.entgra.device.mgt.core.factory.mgt.core.config.datasource.DataSourceConfig; 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.ndatasource.core.DataSourceService; @@ -41,33 +39,30 @@ import org.wso2.carbon.ndatasource.core.DataSourceService; * unbind="unsetDataSourceService" */ +@SuppressWarnings("unused") public class FactoryMgtServiceComponent { private static final Log log = LogFactory.getLog(FactoryMgtServiceComponent.class); - protected void activate(ComponentContext ctx) { - - if (log.isDebugEnabled()) { - log.debug("Activating Factory Service Component"); - } + protected void activate(ComponentContext componentContext) { try { - FactoryMgtConfig factoryMgtConfig = FactoryConfigurationManager.getInstance().getFactoryMgtConfig(); - DataSourceConfig dataSourceConfig = factoryMgtConfig.getFactoryMgtConfigRepository().getDataSourceConfig(); - FactoryMgtDAOFactory.init(dataSourceConfig); - BundleContext bundleContext = ctx.getBundleContext(); + FactoryConfigurationManager.getInstance().initConfig(); + FactoryMgtConfig config = FactoryConfigurationManager.getInstance().getFactoryManagementConfig(); + DataSourceConfig dsConfig = config.getFactoryManagementRepository().getDataSourceConfig(); + FactoryMgtDAOFactory.init(dsConfig); + ProductionPlanService productionPlanService = new ProductionPlanServiceImpl(); + componentContext.getBundleContext().registerService( + ProductionPlanService.class.getName(), productionPlanService, null); FactoryMgtDataHolder.getInstance().setProductionPlanService(productionPlanService); - bundleContext.registerService(ProductionPlanService.class.getName(), productionPlanService, null); - if (log.isDebugEnabled()) { - log.debug("Factory Manager Service Component has been successfully activated"); - } - } catch (Throwable e) { - log.error("Error occurred while activating Factory Manager Service Component", e); + } catch (Throwable t) { + log.error("Error occurred while initializing the Policy management core.", t); } } + @SuppressWarnings("unused") protected void deactivate(ComponentContext componentContext) { if (log.isDebugEnabled()) { log.debug("De-activating Meter Request Service Component"); @@ -83,7 +78,7 @@ public class FactoryMgtServiceComponent { } protected void setDataSourceService(DataSourceService dataSourceService) { - /* This is to avoid Task Manager Service Component getting initialized before the underlying datasources + /* This is to avoid Task Manager Service Component getting initialized before the underlying datasource's are registered */ if (log.isDebugEnabled()) { log.debug("Data source service set to Task Manager Service Component "); diff --git a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io.entgra.device.mgt.core.factory.mgt.core/service/impl/ProductionPlanServiceImpl.java b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/service/impl/ProductionPlanServiceImpl.java similarity index 100% rename from components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io.entgra.device.mgt.core.factory.mgt.core/service/impl/ProductionPlanServiceImpl.java rename to components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/service/impl/ProductionPlanServiceImpl.java diff --git a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io.entgra.device.mgt.core.factory.mgt.core/util/FactoryMgtDAOUtil.java b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/util/FactoryMgtDAOUtil.java similarity index 100% rename from components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io.entgra.device.mgt.core.factory.mgt.core/util/FactoryMgtDAOUtil.java rename to components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/util/FactoryMgtDAOUtil.java diff --git a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io.entgra.device.mgt.core.factory.mgt.core/util/FactoryMgtUtil.java b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/util/FactoryMgtUtil.java similarity index 98% rename from components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io.entgra.device.mgt.core.factory.mgt.core/util/FactoryMgtUtil.java rename to components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/util/FactoryMgtUtil.java index 4386b790d01..d5193b11d47 100644 --- a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io.entgra.device.mgt.core.factory.mgt.core/util/FactoryMgtUtil.java +++ b/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/main/java/io/entgra/device/mgt/core/factory/mgt/core/util/FactoryMgtUtil.java @@ -22,7 +22,6 @@ 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; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; diff --git a/features/factory-mgt-feature/io.entgra.device.mgt.core.factory.mgt.api.feature/pom.xml b/features/factory-mgt-feature/io.entgra.device.mgt.core.factory.mgt.api.feature/pom.xml new file mode 100644 index 00000000000..85885e6a23a --- /dev/null +++ b/features/factory-mgt-feature/io.entgra.device.mgt.core.factory.mgt.api.feature/pom.xml @@ -0,0 +1,119 @@ + + + + + + + io.entgra.device.mgt.core + factory-mgt-feature + 5.0.27-SNAPSHOT + + + 4.0.0 + io.entgra.device.mgt.core.factory.mgt.api.feature + pom + Entgra - Factory Management API Feature + https://entgra.io + This feature contains the APIs required for Factory + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + factory-mgt-copy + package + + copy + + + + + io.entgra.device.mgt.core + io.entgra.device.mgt.core.factory.mgt.api + ${project.version} + war + true + + ${project.build.directory}/maven-shared-archive-resources/webapps + + api#factory-mgt#v1.0.war + + + + + + + + org.apache.maven.plugins + maven-resources-plugin + + + copy-resources + generate-resources + + copy-resources + + + src/main/resources + + + resources + + build.properties + p2.inf + + + + + + + + + org.wso2.maven + carbon-p2-plugin + + + p2-feature-generation + package + + p2-feature-gen + + + io.entgra.device.mgt.core.factory.mgt.api + ../../etc/feature.properties + + + + org.wso2.carbon.p2.category.type:server + + org.eclipse.equinox.p2.type.group:false + + + + + + + + + + + \ No newline at end of file diff --git a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/src/test/resources/log4j.properties b/features/factory-mgt-feature/io.entgra.device.mgt.core.factory.mgt.api.feature/src/main/resources/build.properties similarity index 51% rename from components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/src/test/resources/log4j.properties rename to features/factory-mgt-feature/io.entgra.device.mgt.core.factory.mgt.api.feature/src/main/resources/build.properties index 3b5407cfd52..89aee3ff762 100644 --- a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.api/src/test/resources/log4j.properties +++ b/features/factory-mgt-feature/io.entgra.device.mgt.core.factory.mgt.api.feature/src/main/resources/build.properties @@ -16,19 +16,4 @@ # under the License. # -# -# This is the log4j configuration file used by WSO2 Carbon -# -# IMPORTANT : Please do not remove or change the names of any -# of the Appender defined here. The layout pattern & log file -# can be changed using the WSO2 Carbon Management Console, and those -# settings will override the settings in this file. -# - -log4j.rootLogger=DEBUG, STD_OUT - -# Redirect log messages to console -log4j.appender.STD_OUT=org.apache.log4j.ConsoleAppender -log4j.appender.STD_OUT.Target=System.out -log4j.appender.STD_OUT.layout=org.apache.log4j.PatternLayout -log4j.appender.STD_OUT.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n +custom = true diff --git a/features/factory-mgt-feature/io.entgra.device.mgt.core.factory.mgt.api.feature/src/main/resources/p2.inf b/features/factory-mgt-feature/io.entgra.device.mgt.core.factory.mgt.api.feature/src/main/resources/p2.inf new file mode 100644 index 00000000000..e58551b69cb --- /dev/null +++ b/features/factory-mgt-feature/io.entgra.device.mgt.core.factory.mgt.api.feature/src/main/resources/p2.inf @@ -0,0 +1,3 @@ +instructions.configure = \ +org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/webapps/);\ +org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/io.entgra.device.mgt.core.factory.mgt.api_${feature.version}/webapps/api#factory-mgt#v1.0.war,target:${installFolder}/../../deployment/server/webapps/api#factory-mgt#v1.0.war,overwrite:true);\ diff --git a/features/factory-mgt-feature/io.entgra.device.mgt.core.factory.mgt.server.feature/pom.xml b/features/factory-mgt-feature/io.entgra.device.mgt.core.factory.mgt.server.feature/pom.xml new file mode 100644 index 00000000000..47ef92b7d8f --- /dev/null +++ b/features/factory-mgt-feature/io.entgra.device.mgt.core.factory.mgt.server.feature/pom.xml @@ -0,0 +1,138 @@ + + + + + + + io.entgra.device.mgt.core + factory-mgt-feature + 5.0.27-SNAPSHOT + + + 4.0.0 + io.entgra.device.mgt.core.factory.mgt.server.feature + pom + Entgra - Factory Management Server Feature + https://entgra.io + This feature contains the core bundles required for Back-end Factory Management functionality + + + + + + + + + io.entgra.device.mgt.core + io.entgra.device.mgt.core.factory.mgt.core + + + com.googlecode.plist + dd-plist + ${googlecode.plist.version} + + + commons-validator + commons-validator + ${commons-validator.version} + + + org.apache.cxf + cxf-rt-frontend-jaxrs + ${cxf.version} + + + com.h2database.wso2 + h2-database-engine + + + + + + + maven-resources-plugin + 2.6 + + + copy-resources + generate-resources + + copy-resources + + + src/main/resources + + + resources + + build.properties + p2.inf + + + + + + + + + org.wso2.maven + carbon-p2-plugin + ${carbon.p2.plugin.version} + + + p2-feature-generation + package + + p2-feature-gen + + + io.entgra.device.mgt.core.factory.mgt.server + ../../etc/feature.properties + + + org.wso2.carbon.p2.category.type:server + org.eclipse.equinox.p2.type.group:false + + + + + + + + io.entgra.device.mgt.core:io.entgra.device.mgt.core.factory.mgt.core:${io.entgra.device.mgt.core.version} + + + com.googlecode.plist:dd-plist:${googlecode.plist.version} + + + commons-validator:commons-validator:${commons-validator.version} + + + + + + + + + + + + 1.6 + + \ No newline at end of file diff --git a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/test/resources/log4j.properties b/features/factory-mgt-feature/io.entgra.device.mgt.core.factory.mgt.server.feature/src/main/resources/build.properties similarity index 51% rename from components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/test/resources/log4j.properties rename to features/factory-mgt-feature/io.entgra.device.mgt.core.factory.mgt.server.feature/src/main/resources/build.properties index fdd35987e89..89aee3ff762 100644 --- a/components/factory-mgt/io.entgra.device.mgt.core.factory.mgt.core/src/test/resources/log4j.properties +++ b/features/factory-mgt-feature/io.entgra.device.mgt.core.factory.mgt.server.feature/src/main/resources/build.properties @@ -16,19 +16,4 @@ # under the License. # -# -# This is the log4j configuration file used by Entgra Pvt. Ltd. -# -# IMPORTANT : Please do not remove or change the names of any -# of the Appenders defined here. The layout pattern & log file -# can be changed using the WSO2 Carbon Management Console, and those -# settings will override the settings in this file. -# - -log4j.rootLogger=DEBUG, STD_OUT - -# Redirect log messages to console -log4j.appender.STD_OUT=org.apache.log4j.ConsoleAppender -log4j.appender.STD_OUT.Target=System.out -log4j.appender.STD_OUT.layout=org.apache.log4j.PatternLayout -log4j.appender.STD_OUT.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n +custom = true diff --git a/features/factory-mgt-feature/io.entgra.device.mgt.core.factory.mgt.server.feature/src/main/resources/conf/factory-mgt-config.xml b/features/factory-mgt-feature/io.entgra.device.mgt.core.factory.mgt.server.feature/src/main/resources/conf/factory-mgt-config.xml new file mode 100644 index 00000000000..7506305b90a --- /dev/null +++ b/features/factory-mgt-feature/io.entgra.device.mgt.core.factory.mgt.server.feature/src/main/resources/conf/factory-mgt-config.xml @@ -0,0 +1,28 @@ + + + + + + + jdbc/DM_DS + + + + diff --git a/features/factory-mgt-feature/io.entgra.device.mgt.core.factory.mgt.server.feature/src/main/resources/p2.inf b/features/factory-mgt-feature/io.entgra.device.mgt.core.factory.mgt.server.feature/src/main/resources/p2.inf new file mode 100644 index 00000000000..784771eaab6 --- /dev/null +++ b/features/factory-mgt-feature/io.entgra.device.mgt.core.factory.mgt.server.feature/src/main/resources/p2.inf @@ -0,0 +1,4 @@ +instructions.configure = \ +org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/io.entgra.device.mgt.core.factory.mgt.server_${feature.version}/conf/factory-mgt-config.xml,target:${installFolder}/../../conf/factory-mgt-config.xml,overwrite:true);\ + +instructions.unconfigure = \ \ No newline at end of file diff --git a/features/factory-mgt-feature/pom.xml b/features/factory-mgt-feature/pom.xml new file mode 100644 index 00000000000..d6301b358fa --- /dev/null +++ b/features/factory-mgt-feature/pom.xml @@ -0,0 +1,41 @@ + + + + + + + io.entgra.device.mgt.core + io.entgra.device.mgt.core.parent + 5.0.27-SNAPSHOT + ../../pom.xml + + + 4.0.0 + factory-mgt-feature + pom + Entgra - Factory Management Feature + http://entgra.io + + + io.entgra.device.mgt.core.factory.mgt.server.feature + io.entgra.device.mgt.core.factory.mgt.api.feature + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 73dd30e07d9..a4a1190536e 100644 --- a/pom.xml +++ b/pom.xml @@ -69,7 +69,7 @@ features/subtype-mgt features/tenant-mgt features/operation-template-mgt-plugin-feature - + features/factory-mgt-feature @@ -338,6 +338,24 @@ + + + io.entgra.device.mgt.core + io.entgra.device.mgt.core.factory.mgt.api + ${io.entgra.device.mgt.core.version} + + + io.entgra.device.mgt.core + io.entgra.device.mgt.core.factory.mgt.core + ${io.entgra.device.mgt.core.version} + + + io.entgra.device.mgt.core + io.entgra.device.mgt.core.factory.mgt.common + ${io.entgra.device.mgt.core.version} + + + io.entgra.device.mgt.core @@ -376,14 +394,6 @@ - - - io.entgra.device.mgt.core - io.entgra.device.mgt.core.factory.mgt - ${io.entgra.device.mgt.core.version} - - - io.entgra.device.mgt.core