// First add all the standard policies to the device.
String standardDeviceFileName = getXMLFilePath(
DeviceRepositoryConstants.STANDARD_DEVICE_DIRECTORY,
deviceName);
PolicySet standardPolicySet =
(PolicySet) loadZipObject(standardDeviceFileName, PolicySet.class);
if (standardPolicySet == null) {
// No standard device. This is bad since this is mandatory.
throw new RepositoryException(EXCEPTION_LOCALIZER.format(
"device-definition-missing", deviceName));
}
addPolicySetToDevice(standardPolicySet, device);
// Then add any custom policies to the device.
String customDeviceFileName = getXMLFilePath(
DeviceRepositoryConstants.CUSTOM_DEVICE_DIRECTORY,
deviceName);
PolicySet customPolicySet =
(PolicySet) loadZipObject(customDeviceFileName, PolicySet.class);
if (customPolicySet != null) {
// we had some custom polices, add them too.
addPolicySetToDevice(customPolicySet, device);
}