forked from community/device-mgt-core
Merge branch 'master' of ssh://repository.entgra.net:222/community/device-mgt-core into entgra-logger
# Conflicts: # components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml # pom.xmlissue-9736
commit
950f67da5f
@ -0,0 +1,116 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 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 org.wso2.carbon.device.mgt.jaxrs.beans;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@ApiModel(value = "DeviceConfig", description = "Device config")
|
||||||
|
public class DeviceConfig {
|
||||||
|
private String clientId;
|
||||||
|
private String clientSecret;
|
||||||
|
private String deviceId;
|
||||||
|
private String type;
|
||||||
|
private String accessToken;
|
||||||
|
private String refreshToken;
|
||||||
|
private String mqttGateway;
|
||||||
|
private String httpsGateway;
|
||||||
|
private String httpGateway;
|
||||||
|
private PlatformConfiguration platformConfiguration;
|
||||||
|
public String getClientId() {
|
||||||
|
return clientId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClientId(String clientId) {
|
||||||
|
this.clientId = clientId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getClientSecret() {
|
||||||
|
return clientSecret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClientSecret(String clientSecret) {
|
||||||
|
this.clientSecret = clientSecret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDeviceId() {
|
||||||
|
return deviceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeviceId(String deviceId) {
|
||||||
|
this.deviceId = deviceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAccessToken() {
|
||||||
|
return accessToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAccessToken(String accessToken) {
|
||||||
|
this.accessToken = accessToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRefreshToken() {
|
||||||
|
return refreshToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRefreshToken(String refreshToken) {
|
||||||
|
this.refreshToken = refreshToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMqttGateway() {
|
||||||
|
return mqttGateway;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMqttGateway(String mqttGateway) {
|
||||||
|
this.mqttGateway = mqttGateway;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHttpsGateway() {
|
||||||
|
return httpsGateway;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHttpsGateway(String httpsGateway) {
|
||||||
|
this.httpsGateway = httpsGateway;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHttpGateway() {
|
||||||
|
return httpGateway;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHttpGateway(String httpGateway) {
|
||||||
|
this.httpGateway = httpGateway;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PlatformConfiguration getPlatformConfiguration() {
|
||||||
|
return platformConfiguration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlatformConfiguration(PlatformConfiguration platformConfiguration) {
|
||||||
|
this.platformConfiguration = platformConfiguration;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,60 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2022, Entgra (pvt) Ltd. (https://entgra.io) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
|
||||||
|
* Version 2.0 (the "License"); you may not use this file except
|
||||||
|
* in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.wso2.carbon.device.mgt.common.group.mgt;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@ApiModel(value = "DeviceTypesOfGroups", description = "This class carries whether the groups has device type or not.")
|
||||||
|
public class DeviceTypesOfGroups implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 5562356373277828099L;
|
||||||
|
@ApiModelProperty(name = "hasAndroid", value = "groups has Android devices.")
|
||||||
|
private boolean hasAndroid;
|
||||||
|
@ApiModelProperty(name = "id", value = "groups has iOS devices.")
|
||||||
|
private boolean hasIos;
|
||||||
|
@ApiModelProperty(name = "hasAndroid", value = "groups has Windows devices.")
|
||||||
|
private boolean hasWindows;
|
||||||
|
|
||||||
|
public boolean isHasAndroid() {
|
||||||
|
return hasAndroid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHasAndroid(boolean hasAndroid) {
|
||||||
|
this.hasAndroid = hasAndroid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isHasIos() {
|
||||||
|
return hasIos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHasIos(boolean hasIos) {
|
||||||
|
this.hasIos = hasIos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isHasWindows() {
|
||||||
|
return hasWindows;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHasWindows(boolean hasWindows) {
|
||||||
|
this.hasWindows = hasWindows;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
~ Copyright (c) 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
|
<artifactId>carbon-devicemgt</artifactId>
|
||||||
|
<version>5.0.21-SNAPSHOT</version>
|
||||||
|
<relativePath>../../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>task-mgt</artifactId>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
<name>Entgra IoT - Task Management Component</name>
|
||||||
|
<url>http://entgra.io</url>
|
||||||
|
|
||||||
|
<modules>
|
||||||
|
<module>task-manager</module>
|
||||||
|
<module>task-watcher</module>
|
||||||
|
</modules>
|
||||||
|
|
||||||
|
</project>
|
@ -0,0 +1,54 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
~ Copyright (c) 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.
|
||||||
|
-->
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>task-manager</artifactId>
|
||||||
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
|
<version>5.0.21-SNAPSHOT</version>
|
||||||
|
<relativePath>../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>io.entgra.task.mgt.common</artifactId>
|
||||||
|
<packaging>bundle</packaging>
|
||||||
|
<name>Entgra IoT - Task Management Common</name>
|
||||||
|
<description>Entgra IoT - Task Management Common</description>
|
||||||
|
<url>https://entgra.io</url>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.felix</groupId>
|
||||||
|
<artifactId>maven-bundle-plugin</artifactId>
|
||||||
|
<extensions>true</extensions>
|
||||||
|
<configuration>
|
||||||
|
<instructions>
|
||||||
|
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
|
||||||
|
<Bundle-Name>${project.artifactId}</Bundle-Name>
|
||||||
|
<Bundle-Version>${carbon.device.mgt.version}</Bundle-Version>
|
||||||
|
<Bundle-Description>Task Management Common Bundle</Bundle-Description>
|
||||||
|
<Export-Package>
|
||||||
|
io.entgra.task.mgt.common.*
|
||||||
|
</Export-Package>
|
||||||
|
</instructions>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
@ -0,0 +1,88 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.task.mgt.common.bean;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class DynamicTask {
|
||||||
|
|
||||||
|
private int dynamicTaskId;
|
||||||
|
private String name;
|
||||||
|
private String cronExpression;
|
||||||
|
private boolean isEnabled;
|
||||||
|
private int tenantId;
|
||||||
|
private String taskClassName;
|
||||||
|
private Map<String, String> properties;
|
||||||
|
|
||||||
|
public int getDynamicTaskId() {
|
||||||
|
return dynamicTaskId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDynamicTaskId(int dynamicTaskId) {
|
||||||
|
this.dynamicTaskId = dynamicTaskId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCronExpression() {
|
||||||
|
return cronExpression;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCronExpression(String cronExpression) {
|
||||||
|
this.cronExpression = cronExpression;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isEnabled() {
|
||||||
|
return isEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnabled(boolean enable) {
|
||||||
|
isEnabled = enable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTenantId() {
|
||||||
|
return tenantId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTenantId(int tenantId) {
|
||||||
|
this.tenantId = tenantId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTaskClassName() {
|
||||||
|
return taskClassName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTaskClassName(String taskClassName) {
|
||||||
|
this.taskClassName = taskClassName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, String> getProperties() {
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProperties(Map<String, String> properties) {
|
||||||
|
this.properties = properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.task.mgt.common.constant;
|
||||||
|
|
||||||
|
public class TaskMgtConstants {
|
||||||
|
public static final class DataSourceProperties {
|
||||||
|
private DataSourceProperties() {
|
||||||
|
throw new AssertionError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final String DB_CHECK_QUERY = "SELECT * FROM DM_DEVICE";
|
||||||
|
public static final String TASK_CONFIG_XML_NAME = "task-mgt-config.xml";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final class DataBaseTypes {
|
||||||
|
private DataBaseTypes() {
|
||||||
|
throw new AssertionError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final String DB_TYPE_MYSQL = "MySQL";
|
||||||
|
public static final String DB_TYPE_ORACLE = "Oracle";
|
||||||
|
public static final String DB_TYPE_MSSQL = "Microsoft SQL Server";
|
||||||
|
public static final String DB_TYPE_DB2 = "DB2";
|
||||||
|
public static final String DB_TYPE_H2 = "H2";
|
||||||
|
public static final String DB_TYPE_POSTGRESQL = "PostgreSQL";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final class Task {
|
||||||
|
|
||||||
|
public static final String DYNAMIC_TASK_TYPE = "DYNAMIC_TASK";
|
||||||
|
public static final String NAME_SEPARATOR = "_";
|
||||||
|
public static final String PROPERTY_KEY_COLUMN_NAME = "PROPERTY_NAME";
|
||||||
|
public static final String PROPERTY_VALUE_COLUMN_NAME = "PROPERTY_VALUE";
|
||||||
|
public static final String TENANT_ID_PROP = "__TENANT_ID_PROP__";
|
||||||
|
public static final String LOCAL_HASH_INDEX = "__LOCAL_HASH_INDEX__";
|
||||||
|
public static final String LOCAL_TASK_NAME = "__LOCAL_TASK_NAME__";
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.task.mgt.common.exception;
|
||||||
|
|
||||||
|
public class IllegalTransactionStateException extends RuntimeException {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -3151279331929070297L;
|
||||||
|
|
||||||
|
public IllegalTransactionStateException(String msg, Exception nestedEx) {
|
||||||
|
super(msg, nestedEx);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IllegalTransactionStateException(String message, Throwable cause) {
|
||||||
|
super(message, cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IllegalTransactionStateException(String msg) {
|
||||||
|
super(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IllegalTransactionStateException() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IllegalTransactionStateException(Throwable cause) {
|
||||||
|
super(cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.task.mgt.common.exception;
|
||||||
|
|
||||||
|
public class TaskManagementDAOException extends Exception {
|
||||||
|
|
||||||
|
public TaskManagementDAOException(String msg) {
|
||||||
|
super(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TaskManagementDAOException(String msg, Exception e) {
|
||||||
|
super(msg, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.task.mgt.common.exception;
|
||||||
|
|
||||||
|
public class TaskManagementException extends Exception {
|
||||||
|
|
||||||
|
public TaskManagementException(String msg) {
|
||||||
|
super(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TaskManagementException(String msg, Exception e) {
|
||||||
|
super(msg, e);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.task.mgt.common.exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents the exception thrown during validating the request.
|
||||||
|
*/
|
||||||
|
public class TaskNotFoundException extends Exception {
|
||||||
|
|
||||||
|
public TaskNotFoundException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TaskNotFoundException(String message, Exception ex) {
|
||||||
|
super(message, ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.task.mgt.common.exception;
|
||||||
|
|
||||||
|
public class TransactionManagementException extends Exception {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -3151279321929070297L;
|
||||||
|
|
||||||
|
public TransactionManagementException(String msg, Exception nestedEx) {
|
||||||
|
super(msg, nestedEx);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TransactionManagementException(String message, Throwable cause) {
|
||||||
|
super(message, cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TransactionManagementException(String msg) {
|
||||||
|
super(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TransactionManagementException() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public TransactionManagementException(Throwable cause) {
|
||||||
|
super(cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.task.mgt.common.exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This runtime exception will be thrown if the server has configured with unsupported DB engine.
|
||||||
|
*/
|
||||||
|
public class UnsupportedDatabaseEngineException extends RuntimeException {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -3151279311929070297L;
|
||||||
|
|
||||||
|
public UnsupportedDatabaseEngineException(String msg, Exception nestedEx) {
|
||||||
|
super(msg, nestedEx);
|
||||||
|
}
|
||||||
|
|
||||||
|
public UnsupportedDatabaseEngineException(String message, Throwable cause) {
|
||||||
|
super(message, cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
public UnsupportedDatabaseEngineException(String msg) {
|
||||||
|
super(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public UnsupportedDatabaseEngineException() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public UnsupportedDatabaseEngineException(Throwable cause) {
|
||||||
|
super(cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.task.mgt.common.spi;
|
||||||
|
|
||||||
|
import io.entgra.task.mgt.common.exception.TaskNotFoundException;
|
||||||
|
import io.entgra.task.mgt.common.exception.TaskManagementException;
|
||||||
|
import io.entgra.task.mgt.common.bean.DynamicTask;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface TaskManagementService {
|
||||||
|
|
||||||
|
void init() throws TaskManagementException;
|
||||||
|
|
||||||
|
void createTask(DynamicTask dynamicTask) throws TaskManagementException;
|
||||||
|
|
||||||
|
void updateTask(int dynamicTaskId, DynamicTask dynamicTask) throws TaskManagementException, TaskNotFoundException;
|
||||||
|
|
||||||
|
void toggleTask(int dynamicTaskId, boolean isEnabled) throws TaskManagementException, TaskNotFoundException;
|
||||||
|
|
||||||
|
void deleteTask(int dynamicTaskId) throws TaskManagementException, TaskNotFoundException;
|
||||||
|
|
||||||
|
List<DynamicTask> getAllDynamicTasks() throws TaskManagementException;
|
||||||
|
|
||||||
|
DynamicTask getDynamicTaskById(int dynamicTaskId) throws TaskManagementException;
|
||||||
|
|
||||||
|
List<DynamicTask> getActiveDynamicTasks() throws TaskManagementException;
|
||||||
|
}
|
@ -0,0 +1,139 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
~ Copyright (c) 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.
|
||||||
|
-->
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
|
<artifactId>task-manager</artifactId>
|
||||||
|
<version>5.0.21-SNAPSHOT</version>
|
||||||
|
<relativePath>../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>io.entgra.task.mgt.core</artifactId>
|
||||||
|
<packaging>bundle</packaging>
|
||||||
|
<name>Entgra IoT - Task manager Core</name>
|
||||||
|
<description>Entgra IoT - Task manager Core</description>
|
||||||
|
<url>http://entgra.io</url>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.felix</groupId>
|
||||||
|
<artifactId>maven-scr-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.felix</groupId>
|
||||||
|
<artifactId>maven-bundle-plugin</artifactId>
|
||||||
|
<extensions>true</extensions>
|
||||||
|
<configuration>
|
||||||
|
<instructions>
|
||||||
|
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
|
||||||
|
<Bundle-Name>${project.artifactId}</Bundle-Name>
|
||||||
|
<Bundle-Version>${carbon.device.mgt.version}</Bundle-Version>
|
||||||
|
<Bundle-Description>Task Management Core Bundle</Bundle-Description>
|
||||||
|
<Private-Package>io.entgra.task.mgt.core.internal</Private-Package>
|
||||||
|
<Import-Package>
|
||||||
|
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.task.mgt.common.*,
|
||||||
|
org.wso2.carbon.utils.*,
|
||||||
|
org.wso2.carbon.ntask.core.*,
|
||||||
|
org.wso2.carbon.ntask.common,
|
||||||
|
org.wso2.carbon.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.server.bootup.heartbeat.beacon.dto,
|
||||||
|
io.entgra.server.bootup.heartbeat.beacon.exception,
|
||||||
|
io.entgra.server.bootup.heartbeat.beacon.service,
|
||||||
|
</Import-Package>
|
||||||
|
<Export-Package>
|
||||||
|
!io.entgra.task.mgt.core.internal,
|
||||||
|
io.entgra.task.mgt.core.*
|
||||||
|
</Export-Package>
|
||||||
|
</instructions>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.osgi</groupId>
|
||||||
|
<artifactId>org.eclipse.osgi</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.osgi</groupId>
|
||||||
|
<artifactId>org.eclipse.osgi.services</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.wso2.carbon</groupId>
|
||||||
|
<artifactId>org.wso2.carbon.ndatasource.core</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
|
<artifactId>io.entgra.task.mgt.common</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.wso2.carbon</groupId>
|
||||||
|
<artifactId>org.wso2.carbon.logging</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.wso2.carbon</groupId>
|
||||||
|
<artifactId>org.wso2.carbon.utils</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-codec.wso2</groupId>
|
||||||
|
<artifactId>commons-codec</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
|
<artifactId>org.wso2.carbon.device.mgt.common</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
|
<artifactId>io.entgra.server.bootup.heartbeat.beacon</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!--nTask dependencies-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.wso2.carbon.commons</groupId>
|
||||||
|
<artifactId>org.wso2.carbon.ntask.core</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
@ -0,0 +1,79 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.task.mgt.core.config;
|
||||||
|
|
||||||
|
import io.entgra.task.mgt.common.constant.TaskMgtConstants;
|
||||||
|
import io.entgra.task.mgt.common.exception.TaskManagementException;
|
||||||
|
import io.entgra.task.mgt.core.util.TaskManagementUtil;
|
||||||
|
import org.w3c.dom.Document;
|
||||||
|
import org.wso2.carbon.utils.CarbonUtils;
|
||||||
|
|
||||||
|
import javax.xml.bind.JAXBContext;
|
||||||
|
import javax.xml.bind.JAXBException;
|
||||||
|
import javax.xml.bind.Unmarshaller;
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class responsible for the task mgt configuration initialization.
|
||||||
|
*/
|
||||||
|
public class TaskConfigurationManager {
|
||||||
|
|
||||||
|
private TaskManagementConfig taskManagementConfig;
|
||||||
|
private static volatile TaskConfigurationManager taskConfigurationManager;
|
||||||
|
|
||||||
|
private static final String TASK_MGT_CONFIG_PATH =
|
||||||
|
CarbonUtils.getCarbonConfigDirPath() + File.separator +
|
||||||
|
TaskMgtConstants.DataSourceProperties.TASK_CONFIG_XML_NAME;
|
||||||
|
|
||||||
|
public static TaskConfigurationManager getInstance() {
|
||||||
|
if (taskConfigurationManager == null) {
|
||||||
|
synchronized (TaskConfigurationManager.class) {
|
||||||
|
if (taskConfigurationManager == null) {
|
||||||
|
taskConfigurationManager = new TaskConfigurationManager();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return taskConfigurationManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void initConfig() throws TaskManagementException {
|
||||||
|
try {
|
||||||
|
File taskMgtConfig = new File(TASK_MGT_CONFIG_PATH);
|
||||||
|
Document doc = TaskManagementUtil.convertToDocument(taskMgtConfig);
|
||||||
|
|
||||||
|
/* Un-marshaling Device Management configuration */
|
||||||
|
JAXBContext cdmContext = JAXBContext.newInstance(TaskManagementConfig.class);
|
||||||
|
Unmarshaller unmarshaller = cdmContext.createUnmarshaller();
|
||||||
|
//unmarshaller.setSchema(getSchema());
|
||||||
|
this.taskManagementConfig = (TaskManagementConfig) unmarshaller.unmarshal(doc);
|
||||||
|
} catch (JAXBException e) {
|
||||||
|
throw new TaskManagementException("Error occurred while initializing Data Source config", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public TaskManagementConfig getTaskManagementConfig() throws TaskManagementException {
|
||||||
|
if (taskManagementConfig == null) {
|
||||||
|
initConfig();
|
||||||
|
}
|
||||||
|
return taskManagementConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTaskManagementConfig(TaskManagementConfig taskManagementConfig) {
|
||||||
|
this.taskManagementConfig = taskManagementConfig;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.task.mgt.core.config;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents Task Mgt configuration.
|
||||||
|
*/
|
||||||
|
@XmlRootElement(name = "TaskMgtConfiguration")
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
public final class TaskManagementConfig {
|
||||||
|
|
||||||
|
private TaskManagementConfigRepository taskMgtConfigRepository;
|
||||||
|
private boolean isTaskWatcherEnabled;
|
||||||
|
|
||||||
|
@XmlElement(name = "ManagementRepository", required = true)
|
||||||
|
public TaskManagementConfigRepository getTaskMgtConfigRepository() {
|
||||||
|
return taskMgtConfigRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTaskMgtConfigRepository(TaskManagementConfigRepository taskMgtConfigRepository) {
|
||||||
|
this.taskMgtConfigRepository = taskMgtConfigRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "TaskWatcherEnable", required = true)
|
||||||
|
public boolean isTaskWatcherEnabled() {
|
||||||
|
return isTaskWatcherEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTaskWatcherEnabled(boolean enabled) {
|
||||||
|
this.isTaskWatcherEnabled = enabled;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.task.mgt.core.config;
|
||||||
|
|
||||||
|
import io.entgra.task.mgt.core.config.datasource.DataSourceConfig;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class for holding management repository data.
|
||||||
|
*/
|
||||||
|
@XmlRootElement(name = "ManagementRepository")
|
||||||
|
public class TaskManagementConfigRepository {
|
||||||
|
|
||||||
|
private DataSourceConfig dataSourceConfig;
|
||||||
|
|
||||||
|
@XmlElement(name = "DataSourceConfiguration", required = true)
|
||||||
|
public DataSourceConfig getDataSourceConfig() {
|
||||||
|
return dataSourceConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataSourceConfig(DataSourceConfig dataSourceConfig) {
|
||||||
|
this.dataSourceConfig = dataSourceConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.task.mgt.core.config.datasource;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class for holding data source configuration in task-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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,79 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.task.mgt.core.config.datasource;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.*;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class for hold JndiLookupDefinition of task-mgt-config.xml at parsing with JAXB.
|
||||||
|
*/
|
||||||
|
@XmlRootElement(name = "JndiLookupDefinition")
|
||||||
|
public class JNDILookupDefinition {
|
||||||
|
|
||||||
|
private String jndiName;
|
||||||
|
private List<JNDIProperty> jndiProperties;
|
||||||
|
|
||||||
|
@XmlElement(name = "Name", required = false)
|
||||||
|
public String getJndiName() {
|
||||||
|
return jndiName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setJndiName(String jndiName) {
|
||||||
|
this.jndiName = jndiName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElementWrapper(name = "Environment", required = false)
|
||||||
|
@XmlElement(name = "Property", nillable = false)
|
||||||
|
public List<JNDIProperty> getJndiProperties() {
|
||||||
|
return jndiProperties;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setJndiProperties(List<JNDIProperty> 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.task.mgt.core.dao;
|
||||||
|
|
||||||
|
import io.entgra.task.mgt.common.bean.DynamicTask;
|
||||||
|
import io.entgra.task.mgt.common.exception.TaskManagementDAOException;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class represents the key operations associated with dynamic tasks.
|
||||||
|
*/
|
||||||
|
public interface DynamicTaskDAO {
|
||||||
|
|
||||||
|
int addTask(DynamicTask dynamicTask) throws TaskManagementDAOException;
|
||||||
|
|
||||||
|
boolean updateDynamicTask(DynamicTask dynamicTask) throws TaskManagementDAOException;
|
||||||
|
|
||||||
|
void deleteDynamicTask(int dynamicTaskId) throws TaskManagementDAOException;
|
||||||
|
|
||||||
|
DynamicTask getDynamicTaskById(int dynamicTaskId) throws TaskManagementDAOException;
|
||||||
|
|
||||||
|
List<DynamicTask> getAllDynamicTasks() throws TaskManagementDAOException;
|
||||||
|
|
||||||
|
List<DynamicTask> getActiveDynamicTasks() throws TaskManagementDAOException;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) 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.task.mgt.core.dao;
|
||||||
|
|
||||||
|
import io.entgra.task.mgt.common.exception.TaskManagementDAOException;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class represents the key operations associated with dynamic task properties.
|
||||||
|
*/
|
||||||
|
public interface DynamicTaskPropDAO {
|
||||||
|
|
||||||
|
void addTaskProperties(int dynamicTaskId, Map<String, String> properties) throws TaskManagementDAOException;
|
||||||
|
|
||||||
|
Map<String, String> getDynamicTaskProps(int dynamicTaskId) throws TaskManagementDAOException;
|
||||||
|
|
||||||
|
void updateDynamicTaskProps(int dynamicTaskId, Map<String, String> properties)
|
||||||
|
throws TaskManagementDAOException;
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue