Search in sources :

Example 36 with DetailVO

use of com.cloud.host.DetailVO in project cloudstack by apache.

the class HostDetailsDaoImpl method findDetail.

@Override
public DetailVO findDetail(long hostId, String name) {
    SearchCriteria<DetailVO> sc = DetailSearch.create();
    sc.setParameters("hostId", hostId);
    sc.setParameters("name", name);
    DetailVO detail = findOneIncludingRemovedBy(sc);
    if ("password".equals(name) && detail != null) {
        detail.setValue(DBEncryptionUtil.decrypt(detail.getValue()));
    }
    return detail;
}
Also used : DetailVO(com.cloud.host.DetailVO)

Example 37 with DetailVO

use of com.cloud.host.DetailVO in project cloudstack by apache.

the class HostDetailsDaoImpl method deleteDetails.

@Override
public void deleteDetails(long hostId) {
    SearchCriteria sc = HostSearch.create();
    sc.setParameters("hostId", hostId);
    List<DetailVO> results = search(sc, null);
    for (DetailVO result : results) {
        remove(result.getId());
    }
}
Also used : DetailVO(com.cloud.host.DetailVO) SearchCriteria(com.cloud.utils.db.SearchCriteria)

Example 38 with DetailVO

use of com.cloud.host.DetailVO in project cloudstack by apache.

the class HostDetailsDaoImpl method findDetails.

@Override
public Map<String, String> findDetails(long hostId) {
    SearchCriteria<DetailVO> sc = HostSearch.create();
    sc.setParameters("hostId", hostId);
    List<DetailVO> results = search(sc, null);
    Map<String, String> details = new HashMap<String, String>(results.size());
    for (DetailVO result : results) {
        if ("password".equals(result.getName())) {
            details.put(result.getName(), DBEncryptionUtil.decrypt(result.getValue()));
        } else {
            details.put(result.getName(), result.getValue());
        }
    }
    return details;
}
Also used : DetailVO(com.cloud.host.DetailVO) HashMap(java.util.HashMap)

Aggregations

DetailVO (com.cloud.host.DetailVO)38 HostVO (com.cloud.host.HostVO)15 InvalidParameterValueException (com.cloud.exception.InvalidParameterValueException)13 TransactionStatus (com.cloud.utils.db.TransactionStatus)13 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)13 ConfigurationException (javax.naming.ConfigurationException)13 HashMap (java.util.HashMap)12 Host (com.cloud.host.Host)9 DB (com.cloud.utils.db.DB)9 PhysicalNetworkServiceProviderVO (com.cloud.network.dao.PhysicalNetworkServiceProviderVO)8 PhysicalNetworkVO (com.cloud.network.dao.PhysicalNetworkVO)8 StoragePoolHostVO (com.cloud.storage.StoragePoolHostVO)7 NetworkDevice (org.apache.cloudstack.network.ExternalNetworkDeviceManager.NetworkDevice)6 InsufficientCapacityException (com.cloud.exception.InsufficientCapacityException)5 InsufficientNetworkCapacityException (com.cloud.exception.InsufficientNetworkCapacityException)5 ResourceUnavailableException (com.cloud.exception.ResourceUnavailableException)5 ServerResource (com.cloud.resource.ServerResource)5 UnableDeleteHostException (com.cloud.resource.UnableDeleteHostException)5 GuestOSCategoryVO (com.cloud.storage.GuestOSCategoryVO)4 TransactionCallbackNoReturn (com.cloud.utils.db.TransactionCallbackNoReturn)4