Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
173 changes: 173 additions & 0 deletions components/device-mgt/org.wso2.carbon.identity.device.mgt/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2026, WSO2 LLC. (http://www.wso2.com).
~
~ WSO2 LLC. 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.identity.framework</groupId>
<artifactId>device-mgt</artifactId>
<version>7.11.153-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.identity.device.mgt</artifactId>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Device Management Component</name>
<description>Generic device registration management backend component</description>
<url>http://wso2.org</url>

<dependencies>

<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.osgi</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.osgi.services</artifactId>
</dependency>

<dependency>
<groupId>org.wso2.carbon.utils</groupId>
<artifactId>org.wso2.carbon.database.utils</artifactId>
</dependency>

<dependency>
<groupId>org.wso2.carbon.identity.framework</groupId>
<artifactId>org.wso2.carbon.identity.core</artifactId>
</dependency>

<dependency>
<groupId>org.wso2.carbon.identity.framework</groupId>
<artifactId>org.wso2.carbon.identity.central.log.mgt</artifactId>
</dependency>

<dependency>
<groupId>org.json.wso2</groupId>
<artifactId>json</artifactId>
</dependency>

<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</dependency>

<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-testng</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.framework</groupId>
<artifactId>org.wso2.carbon.identity.testutil</artifactId>
<scope>test</scope>
</dependency>

</dependencies>

<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>
<Private-Package>
org.wso2.carbon.identity.device.mgt.internal.*
</Private-Package>
<Export-Package>
!org.wso2.carbon.identity.device.mgt.internal.*,
org.wso2.carbon.identity.device.mgt.api.*;
version="${carbon.identity.package.export.version}"
</Export-Package>
<Import-Package>
org.apache.commons.logging;
version="${import.package.version.commons.logging}",
org.osgi.framework;
version="${osgi.framework.imp.pkg.version.range}",
org.osgi.service.component;
version="${osgi.service.component.imp.pkg.version.range}",
org.osgi.service.component.annotations;
version="${osgi.service.component.imp.pkg.version.range}",
org.wso2.carbon.database.utils.jdbc;
version="${org.wso2.carbon.database.utils.version.range}",
org.wso2.carbon.database.utils.jdbc.exceptions;
version="${org.wso2.carbon.database.utils.version.range}",
org.wso2.carbon.identity.core.cache;
version="${carbon.identity.package.import.version.range}",
org.wso2.carbon.identity.core.util;
version="${carbon.identity.package.import.version.range}",
org.wso2.carbon.identity.central.log.mgt.utils;
version="${carbon.identity.package.import.version.range}",
org.json.*; version="${json.wso2.version.range}",
org.wso2.carbon.context;
version="${carbon.kernel.package.import.version.range}",
org.wso2.carbon.utils;
version="${carbon.kernel.package.import.version.range}"
</Import-Package>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.surefire.plugin.version}</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<configuration>
<excludeFilterFile>../../../spotbugs-exclude.xml</excludeFilterFile>
<effort>Max</effort>
<threshold>High</threshold>
<xmlOutput>true</xmlOutput>
</configuration>
</plugin>
</plugins>
</build>

</project>

Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/*
* Copyright (c) 2026, WSO2 LLC. (http://www.wso2.com).
*
* WSO2 LLC. 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.identity.device.mgt.api.constant;

/**
* Device management error messages.
*/
public enum ErrorMessage {

ERROR_DEVICE_NOT_FOUND("DM-60001", "Device not found.",
"No registered device found for the given device id: %s."),
ERROR_INVALID_DEVICE_FIELD("DM-60002", "Invalid request.",
"%s is empty or invalid."),

ERROR_WHILE_REGISTERING_DEVICE("DM-65001", "Error while registering device.",
"Error while persisting device registration in the system."),
ERROR_WHILE_RETRIEVING_DEVICE("DM-65002", "Error while retrieving device.",
"Error while retrieving device from the system."),
ERROR_WHILE_UPDATING_DEVICE("DM-65003", "Error while updating device.",
"Error while updating device in the system."),
ERROR_WHILE_DELETING_DEVICE("DM-65004", "Error while deleting device.",
"Error while deleting device from the system."),
ERROR_USER_ID_REQUIRED("DM-65007", "User identifier required.",
"Cannot persist device: a valid user identifier (userId) was not set before persistence."),
ERROR_DEVICE_FIELD_REQUIRED("DM-65008", "Required device field missing.",
"Cannot persist device: the required field '%s' was not set before persistence.");

private final String code;
private final String message;
private final String description;

ErrorMessage(String code, String message, String description) {

this.code = code;
this.message = message;
this.description = description;
}

/**
* Returns the error code.
*
* @return Error code.
*/
public String getCode() {

return code;
}

/**
* Returns the high-level error message.
*
* @return Error message.
*/
public String getMessage() {

return message;
}

/**
* Returns the detailed error description.
*
* @return Error description.
*/
public String getDescription() {

return description;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com) All Rights Reserved.
*
* WSO2 LLC. 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.identity.device.mgt.api.exception;

/**
* Client-side validation exception for device management.
*/
public class DeviceMgtClientException extends DeviceMgtException {

/**
* Creates a new client exception.
*
* @param message Error message.
* @param description Error description.
* @param errorCode Error code.
*/
public DeviceMgtClientException(String message, String description, String errorCode) {

super(message, description, errorCode);
}

/**
* Creates a new client exception with the cause.
*
* @param message Error message.
* @param description Error description.
* @param errorCode Error code.
* @param cause Root cause.
*/
public DeviceMgtClientException(String message, String description, String errorCode, Throwable cause) {

super(message, description, errorCode, cause);
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*
* Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com) All Rights Reserved.
*
* WSO2 LLC. 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.identity.device.mgt.api.exception;

/**
* Base checked exception for device management.
*/
public class DeviceMgtException extends Exception {

private final String errorCode;
private final String description;

/**
* Creates a new device management exception.
*
* @param message Error message.
* @param description Error description.
* @param errorCode Error code.
*/
public DeviceMgtException(String message, String description, String errorCode) {

super(message);
this.errorCode = errorCode;
this.description = description;
}

/**
* Creates a new device management exception with the cause.
*
* @param message Error message.
* @param description Error description.
* @param errorCode Error code.
* @param cause Root cause.
*/
public DeviceMgtException(String message, String description, String errorCode, Throwable cause) {

super(message, cause);
this.errorCode = errorCode;
this.description = description;
}

/**
* Returns the error code.
*
* @return Error code.
*/
public String getErrorCode() {

return errorCode;
}

/**
* Returns the error description.
*
* @return Error description.
*/
public String getDescription() {

return description;
}
}

Loading
Loading