public class DeviceHelper extends Object
Constructor and Description |
---|
DeviceHelper() |
Modifier and Type | Method and Description |
---|---|
static void |
addEndpointsToDevice(co.ecg.alpaca.toolkit.generated.AccessDevice device,
List<AccessDeviceUser> accessDeviceUsers)
Method to add a list of endpoints to a device.
|
static void |
backupDevice(AccessDeviceInformation<co.ecg.alpaca.toolkit.generated.GroupAccessDevice> gadInformation,
PrintStream out)
Helper Method to backup a GroupAccessDevice.
|
static List<DeviceFile> |
downloadFTPFiles(co.ecg.alpaca.toolkit.generated.AccessDevice device)
Helper Method to download device files that are stored on an FTP server.
|
static co.ecg.alpaca.toolkit.generated.AccessDevice |
getAccessDeviceFromUser(co.ecg.alpaca.toolkit.generated.User user)
Utility Method to retrieve the specific subclass AccessDevice from a User
|
static com.github.zafarkhaja.semver.Version |
getDeviceVersion(co.ecg.alpaca.toolkit.generated.AccessDevice accessDevice)
Retrieves the semantic version of the Access Device.
|
static AccessDeviceUser |
getPrimaryAccessDeviceUser(co.ecg.alpaca.toolkit.generated.GroupAccessDevice gad)
Helper Method to find the Primary Access Device User from a Group Access Device.
|
static String |
getRepositoryURL(co.ecg.alpaca.toolkit.generated.AccessDevice accessDevice,
String deviceType,
String macAddress,
String fileFormat,
String method)
Retrieves Repository URL for an access device file.
|
static boolean |
isCompatibleDeviceType(co.ecg.alpaca.toolkit.generated.AccessDevice accessDevice,
AccessDeviceInformation<?> information,
String deviceType)
Checks if the given AccessDevice and AccessDeviceInformation are
compatible with the given device type.
|
static void |
rebuildAccessDeviceConfigurationFiles(co.ecg.alpaca.toolkit.generated.AccessDevice accessDevice)
Utility Method to rebuild an AccessDevice configuration files.
|
static void |
removeEndpointsFromDevice(co.ecg.alpaca.toolkit.generated.AccessDevice device,
List<AccessDeviceUser> accessDeviceUsers)
Method to remove endpoints from an AccessDevice.
|
static void |
replaceUserDevice(co.ecg.alpaca.toolkit.generated.User user,
co.ecg.alpaca.toolkit.generated.AccessDevice newDevice)
Method to replace an AccessDevice on a User with another.
|
static void |
resetAccessDevice(co.ecg.alpaca.toolkit.generated.AccessDevice accessDevice)
Method to reset an AccessDevice on a User.
|
static co.ecg.alpaca.toolkit.generated.AccessDevice |
retrieveUserAccessDeviceSubtype(co.ecg.alpaca.toolkit.generated.AccessDevice device,
co.ecg.alpaca.toolkit.generated.User user)
Helper Method to convert an AccessDevice to its more specific subtype.
|
public static void addEndpointsToDevice(co.ecg.alpaca.toolkit.generated.AccessDevice device, List<AccessDeviceUser> accessDeviceUsers) throws HelperException
device
- The device to add the endpointsaccessDeviceUsers
- The list of access device users to addHelperException
- Thrown if an error occurs during the processpublic static co.ecg.alpaca.toolkit.generated.AccessDevice getAccessDeviceFromUser(co.ecg.alpaca.toolkit.generated.User user) throws HelperException
user
- The User of the AccessDeviceHelperException
- Thrown if an error occurs while retrieving the AccessDevicepublic static String getRepositoryURL(co.ecg.alpaca.toolkit.generated.AccessDevice accessDevice, String deviceType, String macAddress, String fileFormat, String method) throws HelperException, MalformedURLException
accessDevice
- The access device to retrieve the URL fordeviceType
- The device type of the access devicemacAddress
- The MAC address of the access devicefileFormat
- The file format to retrievemethod
- GET or PUTHelperException
- Thrown if an error occurs during retrieval.MalformedURLException
public static boolean isCompatibleDeviceType(co.ecg.alpaca.toolkit.generated.AccessDevice accessDevice, AccessDeviceInformation<?> information, String deviceType) throws HelperException
accessDevice
- The AccessDeviceinformation
- The AccessDeviceInformation for the AccessDevicedeviceType
- The device type to check for compatibilityHelperException
- Thrown if an error occurs while retrieving device type.public static void rebuildAccessDeviceConfigurationFiles(co.ecg.alpaca.toolkit.generated.AccessDevice accessDevice) throws HelperException
accessDevice
- The access device to rebuildHelperException
- Thrown if an error occurs while rebuilding AccessDevice configuration files.public static void removeEndpointsFromDevice(co.ecg.alpaca.toolkit.generated.AccessDevice device, List<AccessDeviceUser> accessDeviceUsers) throws HelperException
device
- The device to remove endpointsaccessDeviceUsers
- The list of AccessDeviceUsers to removeHelperException
- Thrown if an error occurs while removing devices.public static void replaceUserDevice(co.ecg.alpaca.toolkit.generated.User user, co.ecg.alpaca.toolkit.generated.AccessDevice newDevice) throws HelperException
user
- The User to modifynewDevice
- The device to assignHelperException
- Thrown if an issue is encountered during migrationpublic static void resetAccessDevice(co.ecg.alpaca.toolkit.generated.AccessDevice accessDevice) throws HelperException
accessDevice
- The device to resetHelperException
- Thrown if an issue is encountered during migrationpublic static com.github.zafarkhaja.semver.Version getDeviceVersion(co.ecg.alpaca.toolkit.generated.AccessDevice accessDevice) throws HelperException
accessDevice
- The access device subclass to retrieve the version.Version
object or NULL if not found.HelperException
- Thrown if unable to retrieve the access device version.public static co.ecg.alpaca.toolkit.generated.AccessDevice retrieveUserAccessDeviceSubtype(co.ecg.alpaca.toolkit.generated.AccessDevice device, co.ecg.alpaca.toolkit.generated.User user) throws HelperException
device
- The AccessDevice to determineuser
- A User that is assigned to the AccessDeviceHelperException
- Thrown for all issues while retrieving the subtypepublic static AccessDeviceUser getPrimaryAccessDeviceUser(co.ecg.alpaca.toolkit.generated.GroupAccessDevice gad) throws HelperException
gad
- The GroupAccessDevice to determineHelperException
- Thrown if there is any issue with retrieving the access device userpublic static void backupDevice(AccessDeviceInformation<co.ecg.alpaca.toolkit.generated.GroupAccessDevice> gadInformation, PrintStream out) throws HelperException, IOException
gadInformation
- The AccessDeviceInformation for the AccessDeviceout
- The Print Stream where device storage information is printedHelperException
- Thrown if there is an error with the FileManagerIOException
- Thrown if there is an IO error while writing the backuppublic static List<DeviceFile> downloadFTPFiles(co.ecg.alpaca.toolkit.generated.AccessDevice device) throws HelperException, co.ecg.utilities.exception.AlpacaUtilityException, IOException
device
- The access device that owns the files that are being retrieved.HelperException
- Thrown if there is an error within HelperCodeco.ecg.utilities.exception.AlpacaUtilityException
- Thrown if there is an error with the FTP serverIOException
- Thrown if there is a download or IO errorCopyright © 2016. All rights reserved.