From 2d52813ff25d0d2983e6d8b0688adb040e78cfcd Mon Sep 17 00:00:00 2001 From: anthony Date: Thu, 5 May 2011 16:11:44 -0700 Subject: [PATCH] fixed build /start management server --- core/src/com/cloud/storage/SwiftVO.java | 8 ++--- .../DefaultComponentLibrary.java | 4 ++- .../src/com/cloud/storage/dao/SwiftDao.java | 4 ++- .../com/cloud/storage/dao/SwiftDaoImpl.java | 29 +++++++++++++++++++ setup/db/create-schema.sql | 5 ++-- 5 files changed, 42 insertions(+), 8 deletions(-) create mode 100644 server/src/com/cloud/storage/dao/SwiftDaoImpl.java diff --git a/core/src/com/cloud/storage/SwiftVO.java b/core/src/com/cloud/storage/SwiftVO.java index a1a1adaf4a4..cd81aa1ae0d 100644 --- a/core/src/com/cloud/storage/SwiftVO.java +++ b/core/src/com/cloud/storage/SwiftVO.java @@ -62,19 +62,19 @@ public class SwiftVO implements Swift { this.userName = userName; this.token = token; } - + @Override public String getHostName() { return hostName; } - + @Override public String getAccount() { return account; } - + @Override public String getUserName() { return userName; } - + @Override public String getToken() { return token; } diff --git a/server/src/com/cloud/configuration/DefaultComponentLibrary.java b/server/src/com/cloud/configuration/DefaultComponentLibrary.java index 59989d90381..0db84288c62 100644 --- a/server/src/com/cloud/configuration/DefaultComponentLibrary.java +++ b/server/src/com/cloud/configuration/DefaultComponentLibrary.java @@ -127,6 +127,7 @@ import com.cloud.storage.secondary.SecondaryStorageManagerImpl; import com.cloud.storage.snapshot.SnapshotManagerImpl; import com.cloud.storage.snapshot.SnapshotSchedulerImpl; import com.cloud.storage.upload.UploadMonitorImpl; +import com.cloud.storage.dao.SwiftDaoImpl; import com.cloud.template.HyervisorTemplateAdapter; import com.cloud.template.TemplateAdapter; import com.cloud.template.TemplateManagerImpl; @@ -270,7 +271,8 @@ public class DefaultComponentLibrary extends ComponentLibraryBase implements Com addDao("HostTagsDao", HostTagsDaoImpl.class); addDao("NetworkDomainDao", NetworkDomainDaoImpl.class); addDao("KeystoreDao", KeystoreDaoImpl.class); - addDao("DcDetailsDao", DcDetailsDaoImpl.class); + addDao("DcDetailsDao", DcDetailsDaoImpl.class); + addDao("SwiftDao", SwiftDaoImpl.class); } @Override diff --git a/server/src/com/cloud/storage/dao/SwiftDao.java b/server/src/com/cloud/storage/dao/SwiftDao.java index 62d13766bd3..f2a82fcfb2a 100644 --- a/server/src/com/cloud/storage/dao/SwiftDao.java +++ b/server/src/com/cloud/storage/dao/SwiftDao.java @@ -18,8 +18,10 @@ package com.cloud.storage.dao; +import java.util.List; + import com.cloud.storage.SwiftVO; import com.cloud.utils.db.GenericDao; -public interface SwiftDao extends GenericDao { +public interface SwiftDao extends GenericDao { } diff --git a/server/src/com/cloud/storage/dao/SwiftDaoImpl.java b/server/src/com/cloud/storage/dao/SwiftDaoImpl.java new file mode 100644 index 00000000000..1173306974b --- /dev/null +++ b/server/src/com/cloud/storage/dao/SwiftDaoImpl.java @@ -0,0 +1,29 @@ +/** + * Copyright (C) 2010 Cloud.com, 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.storage.dao; +import javax.ejb.Local; +import com.cloud.storage.SwiftVO; +import org.apache.log4j.Logger; +import com.cloud.utils.db.GenericDaoBase; + +@Local (value={SwiftDao.class}) +public class SwiftDaoImpl extends GenericDaoBase implements SwiftDao { + public static final Logger s_logger = Logger.getLogger(SwiftDaoImpl.class.getName()); +} + diff --git a/setup/db/create-schema.sql b/setup/db/create-schema.sql index 06dbdfd4908..4539cc61553 100755 --- a/setup/db/create-schema.sql +++ b/setup/db/create-schema.sql @@ -406,7 +406,7 @@ CREATE TABLE `cloud`.`snapshots` ( `created` datetime COMMENT 'Date Created', `removed` datetime COMMENT 'Date removed. not null if removed', `backup_snap_id` varchar(255) COMMENT 'Back up uuid of the snapshot', - `swift_id` unsigned COMMENT 'which swift', + `swift_id` bigint unsigned COMMENT 'which swift', `swift_name` varchar(255) COMMENT 'Back up name in swift', `prev_snap_id` bigint unsigned COMMENT 'Id of the most recent snapshot', `hypervisor_type` varchar(32) NOT NULL COMMENT 'hypervisor that the snapshot was taken under', @@ -1489,11 +1489,12 @@ CREATE TABLE `cloud`.`keystore` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `cloud`.`swift` ( - `id` bigint unsigned NOT NULL UNIQUE AUTO_INCREMENT, + `id` bigint unsigned NOT NULL AUTO_INCREMENT, `hostname` varchar(255), `account` varchar(255) COMMENT ' account in swift', `username` varchar(255) COMMENT ' username in swift', `token` varchar(255) COMMENT 'token for this user', + PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;