diff --git a/api/src/com/cloud/api/commands/CreateNetworkCmd.java b/api/src/com/cloud/api/commands/CreateNetworkCmd.java index da982d49f82..799ea7c4beb 100644 --- a/api/src/com/cloud/api/commands/CreateNetworkCmd.java +++ b/api/src/com/cloud/api/commands/CreateNetworkCmd.java @@ -52,6 +52,7 @@ public class CreateNetworkCmd extends BaseCmd { @Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, required=true, description="the display text of the network") private String displayText; + @IdentityMapper(entityTableName="network_offerings") @Parameter(name=ApiConstants.NETWORK_OFFERING_ID, type=CommandType.LONG, required=true, description="the network offering id") private Long networkOfferingId; diff --git a/server/src/com/cloud/Identity/dao/IdentityDao.java b/server/src/com/cloud/Identity/dao/IdentityDao.java new file mode 100644 index 00000000000..e40c7087cf3 --- /dev/null +++ b/server/src/com/cloud/Identity/dao/IdentityDao.java @@ -0,0 +1,27 @@ +/** + * Copyright (C) 2011 Citrix Systems, Inc. All rights reserved. + * + * This software is licensed under the GNU General Public License v3 or later. + * + * It is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +package com.cloud.Identity.dao; + +import com.cloud.api.IdentityMapper; +import com.cloud.utils.db.GenericDao; + +public interface IdentityDao extends GenericDao { + Long getIdentityId(IdentityMapper mapper, String identityString); + String getIdentityUuid(String tableName, String identityString); +} diff --git a/server/src/com/cloud/Identity/dao/IdentityVO.java b/server/src/com/cloud/Identity/dao/IdentityVO.java new file mode 100644 index 00000000000..0d6cb4175f8 --- /dev/null +++ b/server/src/com/cloud/Identity/dao/IdentityVO.java @@ -0,0 +1,27 @@ +/** + * Copyright (C) 2011 Citrix Systems, Inc. All rights reserved. + * + * This software is licensed under the GNU General Public License v3 or later. + * + * It is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +package com.cloud.Identity.dao; + +import javax.persistence.Entity; + +/** + * This is a dummy class to fit for CloudStack Dao framework + */ +@Entity +public class IdentityVO { +} diff --git a/server/src/com/cloud/api/ApiDispatcher.java b/server/src/com/cloud/api/ApiDispatcher.java index 3658adefc87..37d74169027 100755 --- a/server/src/com/cloud/api/ApiDispatcher.java +++ b/server/src/com/cloud/api/ApiDispatcher.java @@ -40,8 +40,8 @@ import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.PermissionDeniedException; import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; -import com.cloud.identity.dao.IdentityDao; -import com.cloud.identity.dao.IdentityDaoImpl; +import com.cloud.Identity.dao.IdentityDao; +import com.cloud.Identity.dao.IdentityDaoImpl; import com.cloud.server.ManagementServer; import com.cloud.user.Account; import com.cloud.user.UserContext; diff --git a/server/src/com/cloud/api/ApiGsonHelper.java b/server/src/com/cloud/api/ApiGsonHelper.java index a52dcfcbe39..9fa41851a73 100644 --- a/server/src/com/cloud/api/ApiGsonHelper.java +++ b/server/src/com/cloud/api/ApiGsonHelper.java @@ -26,7 +26,6 @@ public class ApiGsonHelper { s_gBuilder = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); s_gBuilder.setVersion(1.3); s_gBuilder.registerTypeAdapter(ResponseObject.class, new ResponseObjectTypeAdapter()); - s_gBuilder.registerTypeAdapter(IdentityProxy.class, new IdentityTypeAdapter()); } public static GsonBuilder getBuilder() { diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java index c2a1779dd01..f23ce2d963f 100755 --- a/server/src/com/cloud/api/ApiResponseHelper.java +++ b/server/src/com/cloud/api/ApiResponseHelper.java @@ -1189,11 +1189,6 @@ public class ApiResponseHelper implements ResponseGenerator { return vmResponses; } - userVmResponse.setId(userVm.getId()); - userVmResponse.setName(userVm.getInstanceName()); - userVmResponse.setDisplayName(userVm.getDisplayName()); - userVmResponse.setIpAddress(userVm.getPrivateIpAddress()); - userVmResponse.setHaEnable(userVm.isHaEnabled()); @Override public DomainRouterResponse createDomainRouterResponse(VirtualRouter router) { diff --git a/server/src/com/cloud/api/IdentityTypeAdapter.java b/server/src/com/cloud/api/IdentityTypeAdapter.java index 49541a48c0f..471dd94ec64 100644 --- a/server/src/com/cloud/api/IdentityTypeAdapter.java +++ b/server/src/com/cloud/api/IdentityTypeAdapter.java @@ -19,8 +19,8 @@ package com.cloud.api; import java.lang.reflect.Type; -import com.cloud.identity.dao.IdentityDao; -import com.cloud.identity.dao.IdentityDaoImpl; +import com.cloud.Identity.dao.IdentityDao; +import com.cloud.Identity.dao.IdentityDaoImpl; import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; diff --git a/server/src/com/cloud/configuration/DefaultComponentLibrary.java b/server/src/com/cloud/configuration/DefaultComponentLibrary.java index b8ff604d1c5..b19e0995476 100755 --- a/server/src/com/cloud/configuration/DefaultComponentLibrary.java +++ b/server/src/com/cloud/configuration/DefaultComponentLibrary.java @@ -65,8 +65,7 @@ import com.cloud.host.dao.HostDetailsDaoImpl; import com.cloud.host.dao.HostTagsDaoImpl; import com.cloud.hypervisor.HypervisorGuruManagerImpl; import com.cloud.hypervisor.dao.HypervisorCapabilitiesDaoImpl; -import com.cloud.identity.IdentityServiceImpl; -import com.cloud.identity.dao.IdentityDaoImpl; +import com.cloud.Identity.dao.IdentityDaoImpl; import com.cloud.keystore.KeystoreDaoImpl; import com.cloud.keystore.KeystoreManagerImpl; import com.cloud.maint.UpgradeManagerImpl; @@ -158,6 +157,7 @@ import com.cloud.utils.component.ComponentLibraryBase; import com.cloud.utils.component.ComponentLocator.ComponentInfo; import com.cloud.utils.component.Manager; import com.cloud.utils.db.GenericDao; +import com.cloud.uuididentity.IdentityServiceImpl; import com.cloud.vm.ClusteredVirtualMachineManagerImpl; import com.cloud.vm.ItWorkDaoImpl; import com.cloud.vm.UserVmManagerImpl; diff --git a/server/src/com/cloud/identity/dao/IdentityDaoImpl.java b/server/src/com/cloud/identity/dao/IdentityDaoImpl.java index db9cda80cfa..e3835366c61 100644 --- a/server/src/com/cloud/identity/dao/IdentityDaoImpl.java +++ b/server/src/com/cloud/identity/dao/IdentityDaoImpl.java @@ -15,7 +15,7 @@ * along with this program. If not, see . * */ -package com.cloud.identity.dao; +package com.cloud.Identity.dao; import java.sql.PreparedStatement; import java.sql.ResultSet; diff --git a/server/src/com/cloud/identity/IdentityServiceImpl.java b/server/src/com/cloud/uuididentity/IdentityServiceImpl.java similarity index 92% rename from server/src/com/cloud/identity/IdentityServiceImpl.java rename to server/src/com/cloud/uuididentity/IdentityServiceImpl.java index 87c56dbe804..d6a5ec04f36 100644 --- a/server/src/com/cloud/identity/IdentityServiceImpl.java +++ b/server/src/com/cloud/uuididentity/IdentityServiceImpl.java @@ -15,7 +15,7 @@ * along with this program. If not, see . * */ -package com.cloud.identity; +package com.cloud.uuididentity; import java.util.Map; @@ -24,7 +24,7 @@ import javax.naming.ConfigurationException; import com.cloud.api.IdentityMapper; import com.cloud.api.IdentityService; -import com.cloud.identity.dao.IdentityDao; +import com.cloud.Identity.dao.IdentityDao; import com.cloud.utils.component.Inject; import com.cloud.utils.component.Manager; diff --git a/server/src/com/cloud/vm/dao/UserVmDaoImpl.java b/server/src/com/cloud/vm/dao/UserVmDaoImpl.java index 77edb2a0d41..98479ecb4c6 100755 --- a/server/src/com/cloud/vm/dao/UserVmDaoImpl.java +++ b/server/src/com/cloud/vm/dao/UserVmDaoImpl.java @@ -75,32 +75,6 @@ public class UserVmDaoImpl extends GenericDaoBase implements Use "GROUP BY pod_id HAVING count(id) > 0 ORDER BY count(id) DESC"; private static final int VM_DETAILS_BATCH_SIZE=100; - private static final String VM_DETAILS = "select vm_instance.id, vm_instance.uuid, " + - "account.id, account.account_name, account.type, domain.name, instance_group.id, instance_group.name," + - "data_center.id, data_center.name, data_center.is_security_group_enabled, host.id, host.name, " + - "vm_template.id, vm_template.name, vm_template.display_text, iso.id, iso.name, " + - "vm_template.enable_password, service_offering.id, disk_offering.name, storage_pool.id, storage_pool.pool_type, " + - "service_offering.cpu, service_offering.speed, service_offering.ram_size, volumes.id, volumes.device_id, volumes.volume_type, security_group.id, security_group.name, " + - "security_group.description, nics.id, nics.ip4_address, nics.gateway, nics.network_id, nics.netmask, nics.mac_address, nics.broadcast_uri, nics.isolation_uri, " + - "networks.traffic_type, networks.guest_type, networks.is_default from vm_instance " + - "left join account on vm_instance.account_id=account.id " + - "left join domain on vm_instance.domain_id=domain.id " + - "left join instance_group_vm_map on vm_instance.id=instance_group_vm_map.instance_id " + - "left join instance_group on instance_group_vm_map.group_id=instance_group.id " + - "left join data_center on vm_instance.data_center_id=data_center.id " + - "left join host on vm_instance.host_id=host.id " + - "left join vm_template on vm_instance.vm_template_id=vm_template.id " + - "left join user_vm on vm_instance.id=user_vm.id " + - "left join vm_template iso on iso.id=user_vm.iso_id " + - "left join service_offering on vm_instance.service_offering_id=service_offering.id " + - "left join disk_offering on vm_instance.service_offering_id=disk_offering.id " + - "left join volumes on vm_instance.id=volumes.instance_id " + - "left join storage_pool on volumes.pool_id=storage_pool.id " + - "left join security_group_vm_map on vm_instance.id=security_group_vm_map.instance_id " + - "left join security_group on security_group_vm_map.security_group_id=security_group.id " + - "left join nics on vm_instance.id=nics.instance_id " + - "left join networks on nics.network_id=networks.id " + - "where vm_instance.id in ("; protected final UserVmDetailsDaoImpl _detailsDao = ComponentLocator.inject(UserVmDetailsDaoImpl.class); protected final NicDaoImpl _nicDao = ComponentLocator.inject(NicDaoImpl.class);