Introducing DeviceIdentifier bean wrapping id and the type of a particular device. This includes other formatting related improvments too brought up during the code reviews

4.x.x
prabathabey 10 years ago
parent 6336024353
commit 983ca1562f

@ -0,0 +1,40 @@
/**
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.carbon.device.mgt.common;
public class DeviceIdentifier {
private String type;
private String id;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
}

@ -16,6 +16,7 @@
package org.wso2.carbon.device.mgt.common.spi; package org.wso2.carbon.device.mgt.common.spi;
import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import java.util.List; import java.util.List;
@ -31,6 +32,7 @@ public interface DeviceManagerService {
* @return Returns provider type * @return Returns provider type
*/ */
String getProviderType(); String getProviderType();
/** /**
* Method to enrolling a particular device of type mobile, IoT, etc within CDM. * Method to enrolling a particular device of type mobile, IoT, etc within CDM.
* *
@ -51,31 +53,28 @@ public interface DeviceManagerService {
/** /**
* Method to disenroll a particular device from CDM. * Method to disenroll a particular device from CDM.
* *
* @param type Device Type * @param deviceId Fully qualified device identifier
* @param deviceId Device Identifier * @throws DeviceManagementException If some unusual behaviour is observed while disenrolling a device
* @throws DeviceManagementException
*/ */
void disEnrollDevice(String type, String deviceId) throws DeviceManagementException; void disenrollDevice(DeviceIdentifier deviceId) throws DeviceManagementException;
/** /**
* Method to retrieve the status of the registration process of a particular device. * Method to retrieve the status of the registration process of a particular device.
* *
* @param type Device Type * @param deviceId Fully qualified device identifier
* @param deviceId Device Identifier
* @return Status of enrollment * @return Status of enrollment
* @throws DeviceManagementException If some unusual behaviour is observed while enrolling a device * @throws DeviceManagementException If some unusual behaviour is observed while enrolling a device
*/ */
boolean isRegistered(String type, String deviceId) throws DeviceManagementException; boolean isRegistered(DeviceIdentifier deviceId) throws DeviceManagementException;
/** /**
* Method to retrieve the status of a particular device. * Method to retrieve the status of a particular device.
* *
* @param type Device Type * @param deviceId Fully qualified device identifier
* @param deviceId Device Identifier
* @return Returns if the device is active * @return Returns if the device is active
* @throws DeviceManagementException If some unusual behaviour is observed while enrolling a device * @throws DeviceManagementException If some unusual behaviour is observed while enrolling a device
*/ */
boolean isActive(String type, String deviceId) throws DeviceManagementException; boolean isActive(DeviceIdentifier deviceId) throws DeviceManagementException;
/** /**
* Method to set the status indicating whether a particular device registered within CDM is enabled at a given * Method to set the status indicating whether a particular device registered within CDM is enabled at a given
@ -92,24 +91,24 @@ public interface DeviceManagerService {
* @param type Device Type * @param type Device Type
* @return List of metadata corresponding to all devices registered within CDM * @return List of metadata corresponding to all devices registered within CDM
*/ */
List<Device> getAllDeviceInfo(String type) throws DeviceManagementException; List<Device> getAllDevices(String type) throws DeviceManagementException;
/** /**
* Method to retrieve metadata of a device corresponding to a particular type that carries a specific identifier. * Method to retrieve metadata of a device corresponding to a particular type that carries a specific identifier.
* *
* @param type Device Type * @param deviceId Fully qualified device identifier
* @param deviceId Device Identifier
* @return Metadata corresponding to a particular device * @return Metadata corresponding to a particular device
* @throws DeviceManagementException If some unusual behaviour is observed while enrolling a device * @throws DeviceManagementException If some unusual behaviour is observed while enrolling a device
*/ */
Device getDeviceInfo(String type, String deviceId) throws DeviceManagementException; Device getDevice(DeviceIdentifier deviceId) throws DeviceManagementException;
/** /**
* Method to set the ownership type of a particular device. i.e. BYOD, COPE * Method to set the ownership type of a particular device. i.e. BYOD, COPE
* *
* @param deviceId Fully qualified device identifier
* @param ownershipType Type of ownership * @param ownershipType Type of ownership
* @throws DeviceManagementException If some unusual behaviour is observed while enrolling a device * @throws DeviceManagementException If some unusual behaviour is observed while enrolling a device
*/ */
void setOwnership(String ownershipType) throws DeviceManagementException; void setOwnership(DeviceIdentifier deviceId, String ownershipType) throws DeviceManagementException;
} }

@ -0,0 +1,22 @@
/**
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.carbon.device.mgt.core;
public class DeviceManagementRepository {
}
Loading…
Cancel
Save