use of com.emc.storageos.db.client.model.storagedriver.DriverRegistryRecord in project coprhd-controller by CoprHD.
the class RegistryImpl method clearDriverAttributes.
@Override
public void clearDriverAttributes(String driverName) {
URIQueryResultList registryEntriesUris = new URIQueryResultList();
dbClient.queryByConstraint(AlternateIdConstraint.Factory.getDriverRegistryEntriesByDriverName(driverName), registryEntriesUris);
while (registryEntriesUris.iterator().hasNext()) {
URI registryEntryUri = registryEntriesUris.iterator().next();
DriverRegistryRecord registryEntry = dbClient.queryObject(DriverRegistryRecord.class, registryEntryUri);
dbClient.markForDeletion(registryEntry);
}
}
use of com.emc.storageos.db.client.model.storagedriver.DriverRegistryRecord in project coprhd-controller by CoprHD.
the class RegistryImpl method clearDriverAttributeForKey.
@Override
public void clearDriverAttributeForKey(String driverName, String key, String attribute) {
validateRegistryRequest(driverName, key);
URIQueryResultList registryEntriesUris = new URIQueryResultList();
dbClient.queryByConstraint(AlternateIdConstraint.Factory.getDriverRegistryEntriesByDriverName(driverName), registryEntriesUris);
while (registryEntriesUris.iterator().hasNext()) {
URI registryEntryUri = registryEntriesUris.iterator().next();
DriverRegistryRecord registryEntry = dbClient.queryObject(DriverRegistryRecord.class, registryEntryUri);
if (registryEntry.getRegistryKey().equals(key)) {
// remove attribute from registry entry attribute map
registryEntry.getAttributes().remove(attribute);
if (registryEntry.getAttributes().isEmpty()) {
dbClient.markForDeletion(registryEntry);
} else {
dbClient.updateObject(registryEntry);
}
break;
}
}
}
use of com.emc.storageos.db.client.model.storagedriver.DriverRegistryRecord in project coprhd-controller by CoprHD.
the class RegistryImpl method getDriverAttributesForKey.
@Override
public Map<String, List<String>> getDriverAttributesForKey(String driverName, String key) {
validateRegistryRequest(driverName, key);
Map<String, List<String>> attributesMap = new HashMap<>();
// find existing entry for driver name and a given key
URIQueryResultList registryEntriesUris = new URIQueryResultList();
dbClient.queryByConstraint(AlternateIdConstraint.Factory.getDriverRegistryEntriesByDriverName(driverName), registryEntriesUris);
while (registryEntriesUris.iterator().hasNext()) {
URI registryEntryUri = registryEntriesUris.iterator().next();
DriverRegistryRecord registryEntry = dbClient.queryObject(DriverRegistryRecord.class, registryEntryUri);
if (registryEntry.getRegistryKey().equals(key)) {
StringSetMap attributes = registryEntry.getAttributes();
for (Map.Entry<String, AbstractChangeTrackingSet<String>> entry : attributes.entrySet()) {
attributesMap.put(entry.getKey(), new ArrayList<>(entry.getValue()));
}
break;
}
}
return attributesMap;
}
use of com.emc.storageos.db.client.model.storagedriver.DriverRegistryRecord in project coprhd-controller by CoprHD.
the class RegistryImpl method getDriverAttributes.
@Override
public Map<String, Map<String, List<String>>> getDriverAttributes(String driverName) {
Map<String, Map<String, List<String>>> keyMap = new HashMap<>();
// find existing entries for driver name
URIQueryResultList registryEntriesUris = new URIQueryResultList();
dbClient.queryByConstraint(AlternateIdConstraint.Factory.getDriverRegistryEntriesByDriverName(driverName), registryEntriesUris);
while (registryEntriesUris.iterator().hasNext()) {
Map<String, List<String>> attributesMap = new HashMap<>();
URI registryEntryUri = registryEntriesUris.iterator().next();
DriverRegistryRecord registryEntry = dbClient.queryObject(DriverRegistryRecord.class, registryEntryUri);
StringSetMap attributes = registryEntry.getAttributes();
for (Map.Entry<String, AbstractChangeTrackingSet<String>> entry : attributes.entrySet()) {
attributesMap.put(entry.getKey(), new ArrayList<>(entry.getValue()));
}
keyMap.put(registryEntry.getRegistryKey(), attributesMap);
}
return keyMap;
}
use of com.emc.storageos.db.client.model.storagedriver.DriverRegistryRecord in project coprhd-controller by CoprHD.
the class RegistryImpl method clearDriverAttributesForKey.
@Override
public void clearDriverAttributesForKey(String driverName, String key) {
validateRegistryRequest(driverName, key);
URIQueryResultList registryEntriesUris = new URIQueryResultList();
dbClient.queryByConstraint(AlternateIdConstraint.Factory.getDriverRegistryEntriesByDriverName(driverName), registryEntriesUris);
while (registryEntriesUris.iterator().hasNext()) {
URI registryEntryUri = registryEntriesUris.iterator().next();
DriverRegistryRecord registryEntry = dbClient.queryObject(DriverRegistryRecord.class, registryEntryUri);
if (registryEntry.getRegistryKey().equals(key)) {
// remove this entry from db
dbClient.markForDeletion(registryEntry);
break;
}
}
}
Aggregations