You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ah...@apache.org on 2012/09/05 23:31:49 UTC
[27/50] [abbrv] git commit: Moved Awsapi (EC2/S3) from Hibernate
framework to CloudStack Generic Dao Framework
Moved Awsapi (EC2/S3) from Hibernate framework to CloudStack Generic Dao Framework
Created/Modified new VO's and Dao Impl classes to use Generic Dao Framework
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/39aa7d86
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/39aa7d86
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/39aa7d86
Branch: refs/heads/javelin
Commit: 39aa7d86affccf42b2e31222fc7ad295ce7180f4
Parents: 9064236
Author: Rajesh Battala <Ra...@citrix.com>
Authored: Fri Aug 31 11:44:07 2012 -0700
Committer: Prachi Damle <pr...@cloud.com>
Committed: Fri Aug 31 11:44:58 2012 -0700
----------------------------------------------------------------------
awsapi-setup/setup/cloudstack-aws-api-register | 2 +-
awsapi/.classpath | 23 +-
awsapi/conf/hibernate.cfg.xml | 51 -
.../bridge/auth/ec2/AuthenticationHandler.java | 21 +-
.../bridge/auth/s3/AuthenticationHandler.java | 10 +-
.../bridge/lifecycle/ServiceEngineLifecycle.java | 4 +-
.../src/com/cloud/bridge/model/BucketPolicyVO.java | 59 +
.../cloud/bridge/model/CloudStackAccountVO.java | 34 +
.../bridge/model/CloudStackConfigurationVO.java | 30 +
.../bridge/model/CloudStackServiceOfferingVO.java | 51 +
awsapi/src/com/cloud/bridge/model/MHost.hbm.xml | 55 -
awsapi/src/com/cloud/bridge/model/MHost.java | 111 --
.../src/com/cloud/bridge/model/MHostMount.hbm.xml | 46 -
awsapi/src/com/cloud/bridge/model/MHostMount.java | 92 --
.../src/com/cloud/bridge/model/MHostMountVO.java | 136 +++
awsapi/src/com/cloud/bridge/model/MHostVO.java | 137 +++
.../com/cloud/bridge/model/MultiPartPartsVO.java | 108 ++
.../com/cloud/bridge/model/MultiPartUploadsVO.java | 94 ++
.../com/cloud/bridge/model/MultipartMetaVO.java | 59 +
.../com/cloud/bridge/model/OfferingBundleVO.java | 46 +
awsapi/src/com/cloud/bridge/model/SAcl.hbm.xml | 54 -
awsapi/src/com/cloud/bridge/model/SAcl.java | 106 +--
awsapi/src/com/cloud/bridge/model/SAclVO.java | 254 +++++
awsapi/src/com/cloud/bridge/model/SBucket.hbm.xml | 56 -
awsapi/src/com/cloud/bridge/model/SBucket.java | 11 +-
awsapi/src/com/cloud/bridge/model/SBucketVO.java | 169 +++
awsapi/src/com/cloud/bridge/model/SHost.hbm.xml | 60 -
awsapi/src/com/cloud/bridge/model/SHost.java | 18 +-
awsapi/src/com/cloud/bridge/model/SHostVO.java | 152 +++
awsapi/src/com/cloud/bridge/model/SMeta.hbm.xml | 41 -
awsapi/src/com/cloud/bridge/model/SMeta.java | 94 --
awsapi/src/com/cloud/bridge/model/SMetaVO.java | 112 ++
awsapi/src/com/cloud/bridge/model/SObject.hbm.xml | 59 -
awsapi/src/com/cloud/bridge/model/SObject.java | 206 ----
.../src/com/cloud/bridge/model/SObjectItem.hbm.xml | 62 -
awsapi/src/com/cloud/bridge/model/SObjectItem.java | 149 ---
.../src/com/cloud/bridge/model/SObjectItemVO.java | 191 ++++
awsapi/src/com/cloud/bridge/model/SObjectVO.java | 242 ++++
.../com/cloud/bridge/model/UserCredentials.hbm.xml | 38 -
.../com/cloud/bridge/model/UserCredentials.java | 95 --
.../com/cloud/bridge/model/UserCredentialsVO.java | 117 ++
awsapi/src/com/cloud/bridge/persist/EntityDao.java | 118 --
.../cloud/bridge/persist/GMTDateTimeUserType.java | 102 --
.../com/cloud/bridge/persist/PersistContext.java | 359 ------
.../com/cloud/bridge/persist/PersistException.java | 36 -
.../cloud/bridge/persist/dao/BucketPolicyDao.java | 157 +---
.../bridge/persist/dao/BucketPolicyDaoImpl.java | 72 ++
.../bridge/persist/dao/CloudStackAccountDao.java | 36 +-
.../persist/dao/CloudStackAccountDaoImpl.java | 39 +
.../persist/dao/CloudStackConfigurationDao.java | 41 +-
.../dao/CloudStackConfigurationDaoImpl.java | 45 +
.../persist/dao/CloudStackSvcOfferingDao.java | 39 +-
.../persist/dao/CloudStackSvcOfferingDaoImpl.java | 75 ++
.../src/com/cloud/bridge/persist/dao/MHostDao.java | 34 +-
.../com/cloud/bridge/persist/dao/MHostDaoImpl.java | 61 +
.../cloud/bridge/persist/dao/MHostMountDao.java | 33 +-
.../bridge/persist/dao/MHostMountDaoImpl.java | 48 +
.../bridge/persist/dao/MultiPartPartsDao.java | 18 +
.../bridge/persist/dao/MultiPartPartsDaoImpl.java | 101 ++
.../bridge/persist/dao/MultiPartUploadsDao.java | 21 +
.../persist/dao/MultiPartUploadsDaoImpl.java | 108 ++
.../cloud/bridge/persist/dao/MultipartLoadDao.java | 428 ++-----
.../cloud/bridge/persist/dao/MultipartMetaDao.java | 12 +
.../bridge/persist/dao/MultipartMetaDaoImpl.java | 34 +
.../com/cloud/bridge/persist/dao/OfferingDao.java | 167 +---
.../cloud/bridge/persist/dao/OfferingDaoImpl.java | 135 +++
.../src/com/cloud/bridge/persist/dao/SAclDao.java | 75 +--
.../com/cloud/bridge/persist/dao/SAclDaoImpl.java | 127 +++
.../com/cloud/bridge/persist/dao/SBucketDao.java | 37 +-
.../cloud/bridge/persist/dao/SBucketDaoImpl.java | 72 ++
.../src/com/cloud/bridge/persist/dao/SHostDao.java | 39 +-
.../com/cloud/bridge/persist/dao/SHostDaoImpl.java | 67 ++
.../src/com/cloud/bridge/persist/dao/SMetaDao.java | 54 +-
.../com/cloud/bridge/persist/dao/SMetaDaoImpl.java | 88 ++
.../com/cloud/bridge/persist/dao/SObjectDao.java | 77 +--
.../cloud/bridge/persist/dao/SObjectDaoImpl.java | 119 ++
.../cloud/bridge/persist/dao/SObjectItemDao.java | 36 +-
.../bridge/persist/dao/SObjectItemDaoImpl.java | 71 ++
.../bridge/persist/dao/UserCredentialsDao.java | 167 +---
.../bridge/persist/dao/UserCredentialsDaoImpl.java | 73 ++
.../com/cloud/bridge/service/EC2MainServlet.java | 20 +-
.../com/cloud/bridge/service/EC2RestServlet.java | 69 +-
.../com/cloud/bridge/service/S3RestServlet.java | 49 +-
.../service/controller/s3/S3BucketAction.java | 870 ++++++++-------
.../service/controller/s3/S3ObjectAction.java | 18 +-
.../service/controller/s3/ServiceProvider.java | 151 ++--
.../cloud/bridge/service/core/ec2/EC2Engine.java | 35 +-
.../com/cloud/bridge/service/core/s3/S3Engine.java | 812 +++++++-------
.../com/cloud/bridge/service/core/s3/S3Grant.java | 5 +-
.../com/cloud/bridge/util/CloudSessionFactory.java | 106 --
.../bridge/util/CloudStackSessionFactory.java | 106 --
awsapi/src/com/cloud/bridge/util/QueryHelper.java | 85 --
.../cloud/stack/models/CloudStackAccount.hbm.xml | 34 -
.../stack/models/CloudStackConfiguration.hbm.xml | 37 -
.../stack/models/CloudStackServiceOffering.hbm.xml | 34 -
build/build-aws-api.xml | 1 +
client/tomcatconf/components.xml.in | 29 +-
utils/src/com/cloud/utils/db/Transaction.java | 38 +-
98 files changed, 4795 insertions(+), 4580 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/39aa7d86/awsapi-setup/setup/cloudstack-aws-api-register
----------------------------------------------------------------------
diff --git a/awsapi-setup/setup/cloudstack-aws-api-register b/awsapi-setup/setup/cloudstack-aws-api-register
index 19b53fd..ea57d0b 100644
--- a/awsapi-setup/setup/cloudstack-aws-api-register
+++ b/awsapi-setup/setup/cloudstack-aws-api-register
@@ -1,4 +1,4 @@
-#!/cygdrive/c/python26/python
+#!/usr/bin/python
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/39aa7d86/awsapi/.classpath
----------------------------------------------------------------------
diff --git a/awsapi/.classpath b/awsapi/.classpath
index 4dc46c4..c5e598f 100644
--- a/awsapi/.classpath
+++ b/awsapi/.classpath
@@ -1,25 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
<classpath>
<classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="test"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/deps"/>
<classpathentry kind="lib" path="/deps/awsapi-lib/antlr-2.7.6.jar"/>
@@ -44,7 +25,6 @@ under the License.
<classpathentry kind="lib" path="/deps/awsapi-lib/commons-io-1.4.jar"/>
<classpathentry kind="lib" path="/deps/awsapi-lib/commons-logging-1.1.1.jar"/>
<classpathentry kind="lib" path="/deps/awsapi-lib/dom4j-1.6.1.jar"/>
- <classpathentry kind="lib" path="/deps/awsapi-lib/hibernate3.jar"/>
<classpathentry kind="lib" path="/deps/awsapi-lib/httpcore-4.0.jar"/>
<classpathentry kind="lib" path="/deps/awsapi-lib/javassist-3.9.0.GA.jar"/>
<classpathentry kind="lib" path="/deps/awsapi-lib/jaxb-api-2.1.jar"/>
@@ -81,5 +61,8 @@ under the License.
<classpathentry kind="lib" path="/deps/awsapi-lib/rampart-lib/xmlsec-1.4.2.jar"/>
<classpathentry kind="lib" path="/deps/awsapi-lib/rampart-lib/xmltooling-1.2.0.jar"/>
<classpathentry kind="lib" path="/deps/cloud-servlet-api.jar"/>
+ <classpathentry kind="lib" path="/deps/cloud-javax.persistence-2.0.0.jar"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/utils"/>
+ <classpathentry kind="lib" path="/deps/cloud-ehcache.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/39aa7d86/awsapi/conf/hibernate.cfg.xml
----------------------------------------------------------------------
diff --git a/awsapi/conf/hibernate.cfg.xml b/awsapi/conf/hibernate.cfg.xml
deleted file mode 100644
index d484849..0000000
--- a/awsapi/conf/hibernate.cfg.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version='1.0' encoding='utf-8'?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
-
-<hibernate-configuration>
-<session-factory>
- <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
- <property name="hibernate.connection.pool_size">20</property>
- <property name="hibernate.connection.autocommit">false</property>
-
- <!-- transactiion isolation level : 1 - read uncommitted, 2 - read committed, 4 - repeatable read, 8 - Serializable -->
- <property name="hibernate.connection.isolation">2</property>
-
- <property name="hibernate.order_updates">true</property>
- <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
-
- <property name="show_sql">false</property>
- <!-- to debug hibernate generated SQL, open following configuration property -->
- <!--
- <property name="show_sql">true</property>
- <property name="hibernate.format_sql">true</property>
- -->
- <!-- Mapping files -->
- <mapping resource="com/cloud/bridge/model/UserCredentials.hbm.xml"/>
- <mapping resource="com/cloud/bridge/model/SHost.hbm.xml"/>
- <mapping resource="com/cloud/bridge/model/MHost.hbm.xml"/>
- <mapping resource="com/cloud/bridge/model/MHostMount.hbm.xml"/>
- <mapping resource="com/cloud/bridge/model/SBucket.hbm.xml"/>
- <mapping resource="com/cloud/bridge/model/SObject.hbm.xml"/>
- <mapping resource="com/cloud/bridge/model/SObjectItem.hbm.xml"/>
- <mapping resource="com/cloud/bridge/model/SMeta.hbm.xml"/>
- <mapping resource="com/cloud/bridge/model/SAcl.hbm.xml"/>
-</session-factory>
-</hibernate-configuration>
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/39aa7d86/awsapi/src/com/cloud/bridge/auth/ec2/AuthenticationHandler.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/auth/ec2/AuthenticationHandler.java b/awsapi/src/com/cloud/bridge/auth/ec2/AuthenticationHandler.java
index 3b28c00..f79feaa 100644
--- a/awsapi/src/com/cloud/bridge/auth/ec2/AuthenticationHandler.java
+++ b/awsapi/src/com/cloud/bridge/auth/ec2/AuthenticationHandler.java
@@ -37,15 +37,16 @@ import java.io.InputStream;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
-import com.cloud.bridge.model.UserCredentials;
-import com.cloud.bridge.persist.dao.UserCredentialsDao;
+import com.cloud.bridge.model.UserCredentialsVO;
+import com.cloud.bridge.persist.dao.UserCredentialsDaoImpl;
import com.cloud.bridge.service.UserContext;
import com.cloud.bridge.util.AuthenticationUtils;
+import com.cloud.utils.component.ComponentLocator;
public class AuthenticationHandler implements Handler {
protected final static Logger logger = Logger.getLogger(AuthenticationHandler.class);
-
+ protected final UserCredentialsDaoImpl ucDao = ComponentLocator.inject(UserCredentialsDaoImpl.class);
private DocumentBuilderFactory dbf = null;
protected HandlerDescription handlerDesc = new HandlerDescription( "EC2AuthenticationHandler" );
@@ -111,13 +112,15 @@ public class AuthenticationHandler implements Handler {
logger.debug( "X509 cert's uniqueId: " + uniqueId );
// -> find the Cloud API key and the secret key from the cert's uniqueId
- UserCredentialsDao credentialDao = new UserCredentialsDao();
+/* UserCredentialsDao credentialDao = new UserCredentialsDao();
UserCredentials cloudKeys = credentialDao.getByCertUniqueId( uniqueId );
- if ( null == cloudKeys ) {
- logger.error( "Cert does not map to Cloud API keys: " + uniqueId );
- throw new AxisFault( "User not properly registered: Certificate does not map to Cloud API Keys", "Client.Blocked" );
- }
- else UserContext.current().initContext( cloudKeys.getAccessKey(), cloudKeys.getSecretKey(), cloudKeys.getAccessKey(), "SOAP Request", null );
+*/
+ UserCredentialsVO cloudKeys = ucDao.getByCertUniqueId(uniqueId);
+ if ( null == cloudKeys ) {
+ logger.error( "Cert does not map to Cloud API keys: " + uniqueId );
+ throw new AxisFault( "User not properly registered: Certificate does not map to Cloud API Keys", "Client.Blocked" );
+ }
+ else UserContext.current().initContext( cloudKeys.getAccessKey(), cloudKeys.getSecretKey(), cloudKeys.getAccessKey(), "SOAP Request", null );
//System.out.println( "end of cert match: " + UserContext.current().getSecretKey());
}
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/39aa7d86/awsapi/src/com/cloud/bridge/auth/s3/AuthenticationHandler.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/auth/s3/AuthenticationHandler.java b/awsapi/src/com/cloud/bridge/auth/s3/AuthenticationHandler.java
index f7a1a7e..b951916 100644
--- a/awsapi/src/com/cloud/bridge/auth/s3/AuthenticationHandler.java
+++ b/awsapi/src/com/cloud/bridge/auth/s3/AuthenticationHandler.java
@@ -29,10 +29,11 @@ import org.apache.axis2.AxisFault;
import org.apache.axis2.description.HandlerDescription;
import org.apache.axis2.description.Parameter;
-import com.cloud.bridge.model.UserCredentials;
-import com.cloud.bridge.persist.dao.UserCredentialsDao;
+import com.cloud.bridge.model.UserCredentialsVO;
+import com.cloud.bridge.persist.dao.UserCredentialsDaoImpl;
import com.cloud.bridge.service.UserContext;
import com.cloud.bridge.util.S3SoapAuth;
+import com.cloud.utils.component.ComponentLocator;
/*
* For SOAP compatibility.
@@ -40,7 +41,7 @@ import com.cloud.bridge.util.S3SoapAuth;
public class AuthenticationHandler implements Handler {
protected final static Logger logger = Logger.getLogger(AuthenticationHandler.class);
-
+ protected final UserCredentialsDaoImpl ucDao = ComponentLocator.inject(UserCredentialsDaoImpl.class);
protected HandlerDescription handlerDesc = new HandlerDescription( "default handler" );
private String name = "S3AuthenticationHandler";
@@ -190,8 +191,7 @@ public class AuthenticationHandler implements Handler {
private String lookupSecretKey( String accessKey )
throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException
{
- UserCredentialsDao credentialDao = new UserCredentialsDao();
- UserCredentials cloudKeys = credentialDao.getByAccessKey( accessKey );
+ UserCredentialsVO cloudKeys = ucDao.getByAccessKey( accessKey );
if ( null == cloudKeys ) {
logger.debug( accessKey + " is not defined in the S3 service - call SetUserKeys" );
return null;
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/39aa7d86/awsapi/src/com/cloud/bridge/lifecycle/ServiceEngineLifecycle.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/lifecycle/ServiceEngineLifecycle.java b/awsapi/src/com/cloud/bridge/lifecycle/ServiceEngineLifecycle.java
index 88c8729..73cb801 100644
--- a/awsapi/src/com/cloud/bridge/lifecycle/ServiceEngineLifecycle.java
+++ b/awsapi/src/com/cloud/bridge/lifecycle/ServiceEngineLifecycle.java
@@ -21,8 +21,8 @@ import org.apache.axis2.description.AxisService;
import org.apache.axis2.engine.ServiceLifeCycle;
import org.apache.log4j.Logger;
-import com.cloud.bridge.persist.dao.UserCredentialsDao;
import com.cloud.bridge.service.controller.s3.ServiceProvider;
+import com.cloud.utils.db.Transaction;
/**
@@ -38,7 +38,7 @@ public class ServiceEngineLifecycle implements ServiceLifeCycle {
public void startUp(ConfigurationContext config, AxisService service) {
// initialize service provider during Axis engine startup
try{
- UserCredentialsDao.preCheckTableExistence();
+ //UserCredentialsDao.preCheckTableExistence();
ServiceProvider.getInstance();
ServiceEngineLifecycle.initialized = true;
}catch(Exception e){
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/39aa7d86/awsapi/src/com/cloud/bridge/model/BucketPolicyVO.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/model/BucketPolicyVO.java b/awsapi/src/com/cloud/bridge/model/BucketPolicyVO.java
new file mode 100644
index 0000000..c4be142
--- /dev/null
+++ b/awsapi/src/com/cloud/bridge/model/BucketPolicyVO.java
@@ -0,0 +1,59 @@
+package com.cloud.bridge.model;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="bucket_policies")
+public class BucketPolicyVO {
+
+ @Id
+ @GeneratedValue(strategy=GenerationType.IDENTITY)
+ @Column(name="ID")
+ private long id;
+
+ @Column(name="BucketName")
+ private String bucketName;
+
+ @Column(name="OwnerCanonicalID")
+ private String ownerCanonicalID;
+
+ @Column(name="Policy")
+ private String policy;
+
+ public BucketPolicyVO() { }
+ public BucketPolicyVO(String bucketName, String client, String policy) {
+ this.bucketName = bucketName;
+ this.ownerCanonicalID = client;
+ this.policy = policy;
+ }
+
+ public long getId() {
+ return id;
+ }
+ public void setId(long id) {
+ this.id = id;
+ }
+ public String getBucketName() {
+ return bucketName;
+ }
+ public void setBucketName(String bucketName) {
+ this.bucketName = bucketName;
+ }
+ public String getOwnerCanonicalID() {
+ return ownerCanonicalID;
+ }
+ public void setOwnerCanonicalID(String ownerCanonicalID) {
+ this.ownerCanonicalID = ownerCanonicalID;
+ }
+ public String getPolicy() {
+ return policy;
+ }
+ public void setPolicy(String policy) {
+ this.policy = policy;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/39aa7d86/awsapi/src/com/cloud/bridge/model/CloudStackAccountVO.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/model/CloudStackAccountVO.java b/awsapi/src/com/cloud/bridge/model/CloudStackAccountVO.java
new file mode 100644
index 0000000..5737abb
--- /dev/null
+++ b/awsapi/src/com/cloud/bridge/model/CloudStackAccountVO.java
@@ -0,0 +1,34 @@
+package com.cloud.bridge.model;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="account")
+public class CloudStackAccountVO {
+
+ @Column(name="uuid")
+ private String uuid;
+
+ @Column(name="default_zone_id")
+ private Long defaultZoneId = null;
+
+ public String getUuid() {
+ return uuid;
+ }
+
+ public void setUuid(String uuid) {
+ this.uuid = uuid;
+ }
+
+ public Long getDefaultZoneId() {
+ return defaultZoneId;
+ }
+
+ public void setDefaultZoneId(Long defaultZoneId) {
+ this.defaultZoneId = defaultZoneId;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/39aa7d86/awsapi/src/com/cloud/bridge/model/CloudStackConfigurationVO.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/model/CloudStackConfigurationVO.java b/awsapi/src/com/cloud/bridge/model/CloudStackConfigurationVO.java
new file mode 100644
index 0000000..982969f
--- /dev/null
+++ b/awsapi/src/com/cloud/bridge/model/CloudStackConfigurationVO.java
@@ -0,0 +1,30 @@
+package com.cloud.bridge.model;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import com.cloud.utils.db.DB;
+
+@Entity
+@Table(name="configuration")
+public class CloudStackConfigurationVO {
+ @Id
+ @Column(name="name")
+ private String name;
+
+ @Column(name="value", length=4095)
+ private String value;
+
+ @DB
+ public String getValue() {
+ return value;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/39aa7d86/awsapi/src/com/cloud/bridge/model/CloudStackServiceOfferingVO.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/model/CloudStackServiceOfferingVO.java b/awsapi/src/com/cloud/bridge/model/CloudStackServiceOfferingVO.java
new file mode 100644
index 0000000..23e0cc8
--- /dev/null
+++ b/awsapi/src/com/cloud/bridge/model/CloudStackServiceOfferingVO.java
@@ -0,0 +1,51 @@
+package com.cloud.bridge.model;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="disk_offering")
+public class CloudStackServiceOfferingVO {
+
+ @Id
+ @Column(name="id")
+ private String id;
+
+ @Column(name="name")
+ private String name;
+
+ @Column(name="domain_id")
+ private String domainId;
+
+
+ public String getId() {
+ return id;
+ }
+
+
+ public String getName() {
+ return name;
+ }
+
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+
+ public String getDomainId() {
+ return domainId;
+ }
+
+
+ public void setDomainId(String domainId) {
+ this.domainId = domainId;
+ }
+
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/39aa7d86/awsapi/src/com/cloud/bridge/model/MHost.hbm.xml
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/model/MHost.hbm.xml b/awsapi/src/com/cloud/bridge/model/MHost.hbm.xml
deleted file mode 100644
index e151171..0000000
--- a/awsapi/src/com/cloud/bridge/model/MHost.hbm.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-<?xml version="1.0"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-
-<hibernate-mapping>
- <class name="com.cloud.bridge.model.MHost" table="mhost" lazy="true">
- <id name="id" type="long" column="ID" >
- <generator class="native" />
- </id>
-
- <property name="host">
- <column name="Host" />
- </property>
-
- <property name="hostKey">
- <column name="MHostKey" />
- </property>
-
- <property name="version">
- <column name="Version" />
- </property>
-
- <property name="lastHeartbeatTime" type="com.cloud.bridge.persist.GMTDateTimeUserType">
- <column name="LastHeartbeatTime" />
- </property>
-
- <set name="localSHosts" inverse="true" lazy="true" cascade="all-delete-orphan">
- <key column="MHostID" />
- <one-to-many class="com.cloud.bridge.model.SHost" />
- </set>
-
- <set name="mounts" inverse="true" lazy="true" cascade="all-delete-orphan">
- <key column="MHostID" />
- <one-to-many class="com.cloud.bridge.model.MHostMount" />
- </set>
- </class>
-</hibernate-mapping>
-
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/39aa7d86/awsapi/src/com/cloud/bridge/model/MHost.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/model/MHost.java b/awsapi/src/com/cloud/bridge/model/MHost.java
deleted file mode 100644
index 2187c7e..0000000
--- a/awsapi/src/com/cloud/bridge/model/MHost.java
+++ /dev/null
@@ -1,111 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.bridge.model;
-
-import java.io.Serializable;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Set;
-
-public class MHost implements Serializable {
- private static final long serialVersionUID = 4848254624679753930L;
-
- private Long id;
-
- private String hostKey;
- private String host;
- private String version;
- private Date lastHeartbeatTime;
-
- private Set<SHost> localSHosts = new HashSet<SHost>();
- private Set<MHostMount> mounts = new HashSet<MHostMount>();
-
- public MHost() {
- }
-
- public Long getId() {
- return id;
- }
-
- private void setId(Long id) {
- this.id = id;
- }
-
- public String getHostKey() {
- return hostKey;
- }
-
- public void setHostKey(String hostKey) {
- this.hostKey = hostKey;
- }
-
- public String getHost() {
- return host;
- }
-
- public void setHost(String host) {
- this.host = host;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- public Date getLastHeartbeatTime() {
- return lastHeartbeatTime;
- }
-
- public void setLastHeartbeatTime(Date lastHeartbeatTime) {
- this.lastHeartbeatTime = lastHeartbeatTime;
- }
-
- public Set<SHost> getLocalSHosts() {
- return localSHosts;
- }
-
- public void setLocalSHosts(Set<SHost> localSHosts) {
- this.localSHosts = localSHosts;
- }
-
- public Set<MHostMount> getMounts() {
- return mounts;
- }
-
- public void setMounts(Set<MHostMount> mounts) {
- this.mounts = mounts;
- }
-
- @Override
- public boolean equals(Object other) {
- if(this == other)
- return true;
-
- if(!(other instanceof MHost))
- return false;
-
- return hostKey == ((MHost)other).getHostKey();
- }
-
- @Override
- public int hashCode() {
- return hostKey.hashCode();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/39aa7d86/awsapi/src/com/cloud/bridge/model/MHostMount.hbm.xml
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/model/MHostMount.hbm.xml b/awsapi/src/com/cloud/bridge/model/MHostMount.hbm.xml
deleted file mode 100644
index c186de5..0000000
--- a/awsapi/src/com/cloud/bridge/model/MHostMount.hbm.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-
-<hibernate-mapping>
- <class name="com.cloud.bridge.model.MHostMount" table="mhost_mount" lazy="true">
- <id name="id" type="long" column="ID" >
- <generator class="native" />
- </id>
-
- <property name="mountPath">
- <column name="MountPath" />
- </property>
-
- <property name="lastMountTime" type="com.cloud.bridge.persist.GMTDateTimeUserType">
- <column name="LastMountTime" />
- </property>
-
- <many-to-one name="mhost" column="MHostID"
- class="com.cloud.bridge.model.MHost"
- cascade="none"
- />
- <many-to-one name="shost" column="SHostID"
- class="com.cloud.bridge.model.SHost"
- cascade="none"
- />
- </class>
-</hibernate-mapping>
-
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/39aa7d86/awsapi/src/com/cloud/bridge/model/MHostMount.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/model/MHostMount.java b/awsapi/src/com/cloud/bridge/model/MHostMount.java
deleted file mode 100644
index 771ed8b..0000000
--- a/awsapi/src/com/cloud/bridge/model/MHostMount.java
+++ /dev/null
@@ -1,92 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.bridge.model;
-
-import java.io.Serializable;
-import java.util.Date;
-
-public class MHostMount implements Serializable {
- private static final long serialVersionUID = -1119494563131099642L;
-
- private Long id;
-
- private MHost mhost;
- private SHost shost;
-
- private String mountPath;
- private Date lastMountTime;
-
- public MHostMount() {
- }
-
- public Long getId() {
- return id;
- }
-
- private void setId(Long id) {
- this.id = id;
- }
-
- public MHost getMhost() {
- return mhost;
- }
-
- public void setMhost(MHost mhost) {
- this.mhost = mhost;
- }
-
- public SHost getShost() {
- return shost;
- }
-
- public void setShost(SHost shost) {
- this.shost = shost;
- }
-
- public String getMountPath() {
- return mountPath;
- }
-
- public void setMountPath(String mountPath) {
- this.mountPath = mountPath;
- }
-
- public Date getLastMountTime() {
- return lastMountTime;
- }
-
- public void setLastMountTime(Date lastMountTime) {
- this.lastMountTime = lastMountTime;
- }
-
- @Override
- public boolean equals(Object other) {
- if(this == other)
- return true;
-
- if(!(other instanceof MHostMount))
- return false;
-
- return getMhost().equals(((MHostMount)other).getMhost()) &&
- getShost().equals(((MHostMount)other).getShost());
- }
-
- @Override
- public int hashCode() {
- return getMhost().hashCode() ^ getShost().hashCode();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/39aa7d86/awsapi/src/com/cloud/bridge/model/MHostMountVO.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/model/MHostMountVO.java b/awsapi/src/com/cloud/bridge/model/MHostMountVO.java
new file mode 100644
index 0000000..a008658
--- /dev/null
+++ b/awsapi/src/com/cloud/bridge/model/MHostMountVO.java
@@ -0,0 +1,136 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.bridge.model;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.persistence.Transient;
+
+@Entity
+@Table(name="mhost_mount")
+public class MHostMountVO implements Serializable {
+ private static final long serialVersionUID = -1119494563131099642L;
+
+ @Id
+ @GeneratedValue(strategy=GenerationType.IDENTITY)
+ @Column(name="ID")
+ private Long id;
+
+ @Column(name="MHostID")
+ private long mHostID;
+
+ @Column(name="SHostID")
+ private long sHostID;
+
+ @Transient
+ private MHostVO mhost;
+
+ @Transient
+ private SHostVO shost;
+
+ @Column(name="MountPath")
+ private String mountPath;
+
+ @Column(name="LastMountTime")
+ @Temporal(value=TemporalType.TIMESTAMP)
+ private Date lastMountTime;
+
+ public MHostMountVO() {
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ private void setId(Long id) {
+ this.id = id;
+ }
+
+ public long getmHostID() {
+ return mHostID;
+ }
+
+ public void setmHostID(long mHostID) {
+ this.mHostID = mHostID;
+ }
+
+ public long getsHostID() {
+ return sHostID;
+ }
+
+ public void setsHostID(long sHostID) {
+ this.sHostID = sHostID;
+ }
+
+ public MHostVO getMhost() {
+ return mhost;
+ }
+
+ public void setMhost(MHostVO mhost) {
+ this.mhost = mhost;
+ }
+
+ public SHostVO getShost() {
+ return shost;
+ }
+
+ public void setShost(SHostVO shost) {
+ this.shost = shost;
+ }
+
+ public String getMountPath() {
+ return mountPath;
+ }
+
+ public void setMountPath(String mountPath) {
+ this.mountPath = mountPath;
+ }
+
+ public Date getLastMountTime() {
+ return lastMountTime;
+ }
+
+ public void setLastMountTime(Date lastMountTime) {
+ this.lastMountTime = lastMountTime;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if(this == other)
+ return true;
+
+ if(!(other instanceof MHostMountVO))
+ return false;
+
+ return getMhost().equals(((MHostMountVO)other).getMhost()) &&
+ getShost().equals(((MHostMountVO)other).getShost());
+ }
+
+ @Override
+ public int hashCode() {
+ return getMhost().hashCode() ^ getShost().hashCode();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/39aa7d86/awsapi/src/com/cloud/bridge/model/MHostVO.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/model/MHostVO.java b/awsapi/src/com/cloud/bridge/model/MHostVO.java
new file mode 100644
index 0000000..0be74b7
--- /dev/null
+++ b/awsapi/src/com/cloud/bridge/model/MHostVO.java
@@ -0,0 +1,137 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.bridge.model;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.persistence.Transient;
+
+@Entity
+@Table(name="mhost")
+public class MHostVO implements Serializable {
+ private static final long serialVersionUID = 4848254624679753930L;
+
+ @Id
+ @GeneratedValue(strategy=GenerationType.IDENTITY)
+ @Column(name="ID")
+ private Long id;
+
+ @Column(name="MHostKey", nullable=false)
+ private String hostKey;
+
+ @Column(name="Host")
+ private String host;
+
+ @Column(name="Version")
+ private String version;
+
+ @Column(name="LastHeartbeatTime")
+ @Temporal(value=TemporalType.TIMESTAMP)
+ private Date lastHeartbeatTime;
+
+ @Transient
+ private Set<SHostVO> localSHosts = new HashSet<SHostVO>();
+
+ @Transient
+ private Set<MHostMountVO> mounts = new HashSet<MHostMountVO>();
+
+ public MHostVO() {
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ private void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getHostKey() {
+ return hostKey;
+ }
+
+ public void setHostKey(String hostKey) {
+ this.hostKey = hostKey;
+ }
+
+ public String getHost() {
+ return host;
+ }
+
+ public void setHost(String host) {
+ this.host = host;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public Date getLastHeartbeatTime() {
+ return lastHeartbeatTime;
+ }
+
+ public void setLastHeartbeatTime(Date lastHeartbeatTime) {
+ this.lastHeartbeatTime = lastHeartbeatTime;
+ }
+
+ public Set<SHostVO> getLocalSHosts() {
+ return localSHosts;
+ }
+
+ public void setLocalSHosts(Set<SHostVO> localSHosts) {
+ this.localSHosts = localSHosts;
+ }
+
+ public Set<MHostMountVO> getMounts() {
+ return mounts;
+ }
+
+ public void setMounts(Set<MHostMountVO> mounts) {
+ this.mounts = mounts;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if(this == other)
+ return true;
+
+ if(!(other instanceof MHostVO))
+ return false;
+
+ return hostKey == ((MHostVO)other).getHostKey();
+ }
+
+ @Override
+ public int hashCode() {
+ return hostKey.hashCode();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/39aa7d86/awsapi/src/com/cloud/bridge/model/MultiPartPartsVO.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/model/MultiPartPartsVO.java b/awsapi/src/com/cloud/bridge/model/MultiPartPartsVO.java
new file mode 100644
index 0000000..d622e47
--- /dev/null
+++ b/awsapi/src/com/cloud/bridge/model/MultiPartPartsVO.java
@@ -0,0 +1,108 @@
+package com.cloud.bridge.model;
+
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+@Entity
+@Table(name="multipart_parts")
+public class MultiPartPartsVO {
+
+ @Id
+ @GeneratedValue(strategy=GenerationType.IDENTITY)
+ @Column(name="ID")
+ private Long id;
+
+ @Column(name="UploadID")
+ private Long uploadid;
+
+ @Column(name="partNumber")
+ private int partNumber;
+
+ @Column(name="MD5")
+ private String md5;
+
+ @Column(name="StoredPath")
+ private String storedPath;
+
+ @Column(name="StoredSize")
+ private Long storedSize;
+
+ @Column(name="CreateTime")
+ @Temporal(value=TemporalType.TIMESTAMP)
+ private Date createTime;
+
+ public MultiPartPartsVO() { }
+
+ public MultiPartPartsVO(int uploadId, int partNumber, String md5,
+ String storedPath, int size, Date date) {
+ this.uploadid = new Long(uploadId);
+ this.partNumber = partNumber;
+ this.md5 = md5;
+ this.storedPath = storedPath;
+ this.storedSize = new Long(size);
+ this.createTime = date;
+ }
+
+ public Long getUploadid() {
+ return uploadid;
+ }
+
+ public void setUploadid(Long uploadid) {
+ this.uploadid = uploadid;
+ }
+
+ public int getPartNumber() {
+ return partNumber;
+ }
+
+ public void setPartNumber(int partNumber) {
+ this.partNumber = partNumber;
+ }
+
+ public String getMd5() {
+ return md5;
+ }
+
+ public void setMd5(String md5) {
+ this.md5 = md5;
+ }
+
+ public String getStoredPath() {
+ return storedPath;
+ }
+
+ public void setStoredPath(String storedPath) {
+ this.storedPath = storedPath;
+ }
+
+ public Long getStoredSize() {
+ return storedSize;
+ }
+
+ public void setStoredSize(Long storedSize) {
+ this.storedSize = storedSize;
+ }
+
+ public Date getCreateTime() {
+ return createTime;
+ }
+
+ public void setCreateTime(Date createTime) {
+ this.createTime = createTime;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/39aa7d86/awsapi/src/com/cloud/bridge/model/MultiPartUploadsVO.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/model/MultiPartUploadsVO.java b/awsapi/src/com/cloud/bridge/model/MultiPartUploadsVO.java
new file mode 100644
index 0000000..fd0bb42
--- /dev/null
+++ b/awsapi/src/com/cloud/bridge/model/MultiPartUploadsVO.java
@@ -0,0 +1,94 @@
+package com.cloud.bridge.model;
+
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+@Entity
+@Table(name="multipart_uploads")
+
+public class MultiPartUploadsVO {
+
+ @Id
+ @GeneratedValue(strategy=GenerationType.IDENTITY)
+ @Column(name="ID")
+ private Long id;
+
+ @Column(name="AccessKey")
+ private String accessKey;
+
+ @Column(name="BucketName")
+ private String bucketName;
+
+ @Column(name="NameKey")
+ private String nameKey;
+
+ @Column(name="x_amz_acl")
+ private String amzAcl;
+
+ @Column(name="CreateTime")
+ @Temporal(value=TemporalType.TIMESTAMP)
+ private Date createTime;
+
+ public MultiPartUploadsVO() {}
+
+ public MultiPartUploadsVO(String accessKey, String bucketName, String key, String cannedAccess, Date tod) {
+ this.accessKey = accessKey;
+ this.bucketName = bucketName;
+ this.nameKey = key;
+ this.amzAcl = cannedAccess;
+ this.createTime = tod;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public String getAccessKey() {
+ return accessKey;
+ }
+
+ public void setAccessKey(String accessKey) {
+ this.accessKey = accessKey;
+ }
+
+ public String getBucketName() {
+ return bucketName;
+ }
+
+ public void setBucketName(String bucketName) {
+ this.bucketName = bucketName;
+ }
+
+ public String getNameKey() {
+ return nameKey;
+ }
+
+ public void setNameKey(String nameKey) {
+ this.nameKey = nameKey;
+ }
+
+ public String getAmzAcl() {
+ return amzAcl;
+ }
+
+ public void setAmzAcl(String amzAcl) {
+ this.amzAcl = amzAcl;
+ }
+
+ public Date getCreateTime() {
+ return createTime;
+ }
+
+ public void setCreateTime(Date createTime) {
+ this.createTime = createTime;
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/39aa7d86/awsapi/src/com/cloud/bridge/model/MultipartMetaVO.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/model/MultipartMetaVO.java b/awsapi/src/com/cloud/bridge/model/MultipartMetaVO.java
new file mode 100644
index 0000000..ca2b69e
--- /dev/null
+++ b/awsapi/src/com/cloud/bridge/model/MultipartMetaVO.java
@@ -0,0 +1,59 @@
+package com.cloud.bridge.model;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="multipart_meta")
+
+public class MultipartMetaVO {
+
+ @Id
+ @GeneratedValue(strategy=GenerationType.IDENTITY)
+ @Column(name="ID")
+ private Long id;
+
+ @Column(name="UploadID")
+ private long uploadID;
+
+ @Column(name="Name")
+ private String name;
+
+ @Column(name="Value")
+ private String value;
+
+ public long getID() {
+ return id;
+ }
+
+ public long getUploadID() {
+ return uploadID;
+ }
+
+ public void setUploadID(long uploadID) {
+ this.uploadID = uploadID;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/39aa7d86/awsapi/src/com/cloud/bridge/model/OfferingBundleVO.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/model/OfferingBundleVO.java b/awsapi/src/com/cloud/bridge/model/OfferingBundleVO.java
new file mode 100644
index 0000000..4c41cff
--- /dev/null
+++ b/awsapi/src/com/cloud/bridge/model/OfferingBundleVO.java
@@ -0,0 +1,46 @@
+package com.cloud.bridge.model;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+
+@Entity
+@Table(name="offering_bundle")
+public class OfferingBundleVO {
+ @Id
+ @GeneratedValue(strategy=GenerationType.IDENTITY)
+ @Column(name="ID")
+ private long id;
+
+ @Column(name="AmazonEC2Offering")
+ private String amazonOffering;
+
+ @Column(name="CloudStackOffering")
+ private String cloudstackOffering;
+
+ public long getID() {
+ return id;
+ }
+
+ public String getAmazonOffering() {
+ return amazonOffering;
+ }
+
+ public void setAmazonOffering(String amazonOffering) {
+ this.amazonOffering = amazonOffering;
+ }
+
+ public String getCloudstackOffering() {
+ return cloudstackOffering;
+ }
+
+ public void setCloudstackOffering(String cloudstackOffering) {
+ this.cloudstackOffering = cloudstackOffering;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/39aa7d86/awsapi/src/com/cloud/bridge/model/SAcl.hbm.xml
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/model/SAcl.hbm.xml b/awsapi/src/com/cloud/bridge/model/SAcl.hbm.xml
deleted file mode 100644
index 175e1a7..0000000
--- a/awsapi/src/com/cloud/bridge/model/SAcl.hbm.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-
-<hibernate-mapping>
- <class name="com.cloud.bridge.model.SAcl" table="acl" lazy="true">
- <id name="id" type="long" column="ID" >
- <generator class="native" />
- </id>
-
- <property name="target">
- <column name="Target" />
- </property>
- <property name="targetId">
- <column name="TargetID" />
- </property>
- <property name="granteeType">
- <column name="GranteeType" />
- </property>
- <property name="granteeCanonicalId">
- <column name="GranteeCanonicalID" />
- </property>
- <property name="permission">
- <column name="Permission" />
- </property>
- <property name="grantOrder">
- <column name="GrantOrder" />
- </property>
- <property name="createTime" type="com.cloud.bridge.persist.GMTDateTimeUserType">
- <column name="CreateTime" />
- </property>
- <property name="lastModifiedTime" type="com.cloud.bridge.persist.GMTDateTimeUserType">
- <column name="LastModifiedTime" />
- </property>
- </class>
-</hibernate-mapping>
-
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/39aa7d86/awsapi/src/com/cloud/bridge/model/SAcl.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/model/SAcl.java b/awsapi/src/com/cloud/bridge/model/SAcl.java
index 7cbcabe..af0bb5e 100644
--- a/awsapi/src/com/cloud/bridge/model/SAcl.java
+++ b/awsapi/src/com/cloud/bridge/model/SAcl.java
@@ -37,8 +37,7 @@ import com.cloud.bridge.util.Triple;
* < permission1, permission2, symbol >
* when given an aclRequestString, a target (i.e. bucket or object) and the ID of the owner.
*/
-public class SAcl implements Serializable {
- private static final long serialVersionUID = 7900837117165018850L;
+public interface SAcl {
public static final int GRANTEE_USER = 0;
public static final int GRANTEE_ALLUSERS = 1;
@@ -52,95 +51,6 @@ public class SAcl implements Serializable {
public static final int PERMISSION_WRITE_ACL = 8;
public static final int PERMISSION_FULL = (PERMISSION_READ | PERMISSION_WRITE | PERMISSION_READ_ACL | PERMISSION_WRITE_ACL);
- private Long id;
-
- private String target;
- private long targetId;
-
- private int granteeType;
- private String granteeCanonicalId;
-
- private int permission;
- private int grantOrder;
-
- private Date createTime;
- private Date lastModifiedTime;
-
- public SAcl() {
- }
-
- public Long getId() {
- return id;
- }
-
- private void setId(Long id) {
- this.id = id;
- }
-
- public String getTarget() {
- return target;
- }
-
- public void setTarget(String target) {
- this.target = target;
- }
-
- public long getTargetId() {
- return targetId;
- }
-
- public void setTargetId(long targetId) {
- this.targetId = targetId;
- }
-
- public int getGranteeType() {
- return granteeType;
- }
-
- public void setGranteeType(int granteeType) {
- this.granteeType = granteeType;
- }
-
- public String getGranteeCanonicalId() {
- return granteeCanonicalId;
- }
-
- public void setGranteeCanonicalId(String granteeCanonicalId) {
- this.granteeCanonicalId = granteeCanonicalId;
- }
-
- public int getPermission() {
- return permission;
- }
-
- public void setPermission(int permission) {
- this.permission = permission;
- }
-
- public int getGrantOrder() {
- return grantOrder;
- }
-
- public void setGrantOrder(int grantOrder) {
- this.grantOrder = grantOrder;
- }
-
- public Date getCreateTime() {
- return createTime;
- }
-
- public void setCreateTime(Date createTime) {
- this.createTime = createTime;
- }
-
- public Date getLastModifiedTime() {
- return lastModifiedTime;
- }
-
- public void setLastModifiedTime(Date lastModifiedTime) {
- this.lastModifiedTime = lastModifiedTime;
- }
-
/** Return an OrderedPair
* < permission, grantee >
* comprising
@@ -153,9 +63,9 @@ public class SAcl implements Serializable {
* @param aclRequestString - The requested ACL from the set of AWS S3 canned ACLs
* @param target - Either "SBucket" or otherwise assumed to be for a single object item
*/
- public static OrderedPair <Integer,Integer> getCannedAccessControls ( String aclRequestString, String target )
- throws UnsupportedException
- {
+ //public static OrderedPair <Integer,Integer> getCannedAccessControls ( String aclRequestString, String target );
+
+/* {
if ( aclRequestString.equalsIgnoreCase( "public-read" ))
// All users granted READ access.
return new OrderedPair <Integer,Integer> (PERMISSION_READ,GRANTEE_ALLUSERS);
@@ -184,7 +94,7 @@ public class SAcl implements Serializable {
}
else throw new UnsupportedException( "Unknown Canned Access Policy: " + aclRequestString + " is not supported" );
}
-
+*/
/** Return a Triple
* < permission1, permission2, symbol >
* comprising
@@ -200,8 +110,8 @@ public class SAcl implements Serializable {
* @param target - Either "SBucket" or otherwise assumed to be for a single object item
* @param ownerID - An ID for the owner, if used in place of symbols "A" or "*"
*/
- public static Triple <Integer,Integer,String> getCannedAccessControls ( String aclRequestString, String target, String ownerID )
- throws UnsupportedException
+ //public static Triple <Integer,Integer,String> getCannedAccessControls ( String aclRequestString, String target, String ownerID );
+/* throws UnsupportedException
{
if ( aclRequestString.equalsIgnoreCase( "public-read" ))
// Owner gets FULL_CONTROL and the anonymous principal (the 'A' symbol here) is granted READ access.
@@ -235,5 +145,5 @@ public class SAcl implements Serializable {
}
else throw new UnsupportedException( "Unknown Canned Access Policy: " + aclRequestString + " is not supported" );
}
-
+*/
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/39aa7d86/awsapi/src/com/cloud/bridge/model/SAclVO.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/model/SAclVO.java b/awsapi/src/com/cloud/bridge/model/SAclVO.java
new file mode 100644
index 0000000..96a252f
--- /dev/null
+++ b/awsapi/src/com/cloud/bridge/model/SAclVO.java
@@ -0,0 +1,254 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.bridge.model;
+
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import com.cloud.bridge.service.exception.UnsupportedException;
+import com.cloud.bridge.util.OrderedPair;
+import com.cloud.bridge.util.Triple;
+
+/**
+ * A model of stored ACLs to remember the ACL permissions per canonicalUserID per grantee
+ * Hold the AWS S3 grantee and permission constants.
+ *
+ * This class implements two forms of getCannedAccessControls mappings, as static methods,
+ *
+ * (a) an OrderedPair which provides a maplet across
+ * < permission, grantee >
+ * when given an aclRequestString and a target (i.e. bucket or object),
+ *
+ * (b) a Triplet
+ * < permission1, permission2, symbol >
+ * when given an aclRequestString, a target (i.e. bucket or object) and the ID of the owner.
+ */
+@Entity
+@Table(name="acl")
+public class SAclVO implements SAcl {
+ private static final long serialVersionUID = 7900837117165018850L;
+
+
+ @Id
+ @GeneratedValue(strategy=GenerationType.IDENTITY)
+ @Column(name="ID")
+ private Long id;
+ @Column(name="Target")
+ private String target;
+
+ @Column(name="TargetID")
+ private long targetId;
+
+ @Column(name="GranteeType")
+ private int granteeType;
+
+ @Column(name="GranteeCanonicalID")
+ private String granteeCanonicalId;
+
+ @Column(name="Permission")
+ private int permission;
+
+ @Column(name="GrantOrder")
+ private int grantOrder;
+
+ @Column(name="CreateTime")
+ @Temporal(value=TemporalType.TIMESTAMP)
+ private Date createTime;
+
+ @Column(name="LastModifiedTime")
+ @Temporal(value=TemporalType.TIMESTAMP)
+ private Date lastModifiedTime;
+
+ public SAclVO() {
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ private void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getTarget() {
+ return target;
+ }
+
+ public void setTarget(String target) {
+ this.target = target;
+ }
+
+ public long getTargetId() {
+ return targetId;
+ }
+
+ public void setTargetId(long targetId) {
+ this.targetId = targetId;
+ }
+
+ public int getGranteeType() {
+ return granteeType;
+ }
+
+ public void setGranteeType(int granteeType) {
+ this.granteeType = granteeType;
+ }
+
+ public String getGranteeCanonicalId() {
+ return granteeCanonicalId;
+ }
+
+ public void setGranteeCanonicalId(String granteeCanonicalId) {
+ this.granteeCanonicalId = granteeCanonicalId;
+ }
+
+ public int getPermission() {
+ return permission;
+ }
+
+ public void setPermission(int permission) {
+ this.permission = permission;
+ }
+
+ public int getGrantOrder() {
+ return grantOrder;
+ }
+
+ public void setGrantOrder(int grantOrder) {
+ this.grantOrder = grantOrder;
+ }
+
+ public Date getCreateTime() {
+ return createTime;
+ }
+
+ public void setCreateTime(Date createTime) {
+ this.createTime = createTime;
+ }
+
+ public Date getLastModifiedTime() {
+ return lastModifiedTime;
+ }
+
+ public void setLastModifiedTime(Date lastModifiedTime) {
+ this.lastModifiedTime = lastModifiedTime;
+ }
+
+ /** Return an OrderedPair
+ * < permission, grantee >
+ * comprising
+ * a permission - which is one of SAcl.PERMISSION_PASS, SAcl.PERMISSION_NONE, SAcl.PERMISSION_READ,
+ * SAcl.PERMISSION_WRITE, SAcl.PERMISSION_READ_ACL, SAcl.PERMISSION_WRITE_ACL, SAcl.PERMISSION_FULL
+ * a grantee - which is one of GRANTEE_ALLUSERS, GRANTEE_AUTHENTICATED, GRANTEE_USER
+ *
+ * Access controls that are specified via the "x-amz-acl:" headers in REST requests for buckets.
+ * The ACL request string is treated as a request for a known cannedAccessPolicy
+ * @param aclRequestString - The requested ACL from the set of AWS S3 canned ACLs
+ * @param target - Either "SBucket" or otherwise assumed to be for a single object item
+ */
+ public static OrderedPair <Integer,Integer> getCannedAccessControls ( String aclRequestString, String target )
+ throws UnsupportedException
+ {
+ if ( aclRequestString.equalsIgnoreCase( "public-read" ))
+ // All users granted READ access.
+ return new OrderedPair <Integer,Integer> (PERMISSION_READ,GRANTEE_ALLUSERS);
+ else if (aclRequestString.equalsIgnoreCase( "public-read-write" ))
+ // All users granted READ and WRITE access
+ return new OrderedPair <Integer,Integer> ((PERMISSION_READ | PERMISSION_WRITE),GRANTEE_ALLUSERS);
+ else if (aclRequestString.equalsIgnoreCase( "authenticated-read" ))
+ // Authenticated users have READ access
+ return new OrderedPair <Integer,Integer> (PERMISSION_READ,GRANTEE_AUTHENTICATED);
+ else if (aclRequestString.equalsIgnoreCase( "private" ))
+ // Only Owner gets FULL_CONTROL
+ return new OrderedPair <Integer,Integer> (PERMISSION_FULL,GRANTEE_USER);
+ else if (aclRequestString.equalsIgnoreCase( "bucket-owner-read" ))
+ {
+ // Object Owner gets FULL_CONTROL, Bucket Owner gets READ
+ if ( target.equalsIgnoreCase( "SBucket" ))
+ return new OrderedPair <Integer,Integer> (PERMISSION_READ, GRANTEE_USER);
+ else
+ return new OrderedPair <Integer,Integer> (PERMISSION_FULL, GRANTEE_USER);
+ }
+ else if (aclRequestString.equalsIgnoreCase( "bucket-owner-full-control" ))
+ {
+ // Object Owner gets FULL_CONTROL, Bucket Owner gets FULL_CONTROL
+ // This is equivalent to private when used with PUT Bucket
+ return new OrderedPair <Integer,Integer> (PERMISSION_FULL,GRANTEE_USER);
+ }
+ else throw new UnsupportedException( "Unknown Canned Access Policy: " + aclRequestString + " is not supported" );
+ }
+
+ /** Return a Triple
+ * < permission1, permission2, symbol >
+ * comprising
+ * two permissions - which is one of SAcl.PERMISSION_PASS, SAcl.PERMISSION_NONE, SAcl.PERMISSION_READ,
+ * SAcl.PERMISSION_WRITE, SAcl.PERMISSION_READ_ACL, SAcl.PERMISSION_WRITE_ACL, SAcl.PERMISSION_FULL
+ * permission1 applies to objects, permission2 applies to buckets.
+ * a symbol to indicate whether the principal is anonymous (i.e. string "A") or authenticated user (i.e.
+ * string "*") - otherwise null indicates a single ACL for all users.
+ *
+ * Access controls that are specified via the "x-amz-acl:" headers in REST requests for buckets.
+ * The ACL request string is treated as a request for a known cannedAccessPolicy
+ * @param aclRequestString - The requested ACL from the set of AWS S3 canned ACLs
+ * @param target - Either "SBucket" or otherwise assumed to be for a single object item
+ * @param ownerID - An ID for the owner, if used in place of symbols "A" or "*"
+ */
+ public static Triple <Integer,Integer,String> getCannedAccessControls ( String aclRequestString, String target, String ownerID )
+ throws UnsupportedException
+ {
+ if ( aclRequestString.equalsIgnoreCase( "public-read" ))
+ // Owner gets FULL_CONTROL and the anonymous principal (the 'A' symbol here) is granted READ access.
+ return new Triple <Integer, Integer, String> (PERMISSION_FULL, PERMISSION_READ,"A");
+ else if (aclRequestString.equalsIgnoreCase( "public-read-write" ))
+ // Owner gets FULL_CONTROL and the anonymous principal (the 'A' symbol here) is granted READ and WRITE access
+ return new Triple <Integer, Integer, String> (PERMISSION_FULL, (PERMISSION_READ | PERMISSION_WRITE),"A");
+ else if (aclRequestString.equalsIgnoreCase( "authenticated-read" ))
+ // Owner gets FULL_CONTROL and ANY principal authenticated as a registered S3 user (the '*' symbol here) is granted READ access
+ return new Triple <Integer, Integer, String> (PERMISSION_FULL, PERMISSION_READ,"*");
+ else if (aclRequestString.equalsIgnoreCase( "private" ))
+ // This is termed the "private" or default ACL, "Owner gets FULL_CONTROL"
+ return new Triple <Integer, Integer, String> (PERMISSION_FULL, PERMISSION_FULL,null);
+ else if (aclRequestString.equalsIgnoreCase( "bucket-owner-read" ))
+ {
+ // Object Owner gets FULL_CONTROL, Bucket Owner gets READ
+ // This is equivalent to private when used with PUT Bucket
+ if ( target.equalsIgnoreCase( "SBucket" ))
+ return new Triple <Integer, Integer, String> (PERMISSION_FULL,PERMISSION_FULL ,null);
+ else
+ return new Triple <Integer, Integer, String> (PERMISSION_FULL,PERMISSION_READ,ownerID);
+ }
+ else if (aclRequestString.equalsIgnoreCase( "bucket-owner-full-control" ))
+ {
+ // Object Owner gets FULL_CONTROL, Bucket Owner gets FULL_CONTROL
+ // This is equivalent to private when used with PUT Bucket
+ if ( target.equalsIgnoreCase( "SBucket" ))
+ return new Triple <Integer, Integer, String> (PERMISSION_FULL, PERMISSION_FULL, null);
+ else
+ return new Triple <Integer, Integer, String> (PERMISSION_FULL,PERMISSION_FULL, ownerID);
+ }
+ else throw new UnsupportedException( "Unknown Canned Access Policy: " + aclRequestString + " is not supported" );
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/39aa7d86/awsapi/src/com/cloud/bridge/model/SBucket.hbm.xml
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/model/SBucket.hbm.xml b/awsapi/src/com/cloud/bridge/model/SBucket.hbm.xml
deleted file mode 100644
index 83f495d..0000000
--- a/awsapi/src/com/cloud/bridge/model/SBucket.hbm.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-
-<hibernate-mapping>
- <class name="com.cloud.bridge.model.SBucket" table="sbucket" lazy="true">
- <id name="id" type="long" column="ID" >
- <generator class="native" />
- </id>
-
- <property name="name">
- <column name="Name" />
- </property>
-
- <property name="ownerCanonicalId">
- <column name="OwnerCanonicalId" />
- </property>
-
- <property name="createTime" type="com.cloud.bridge.persist.GMTDateTimeUserType">
- <column name="CreateTime" />
- </property>
-
- <property name="versioningStatus">
- <column name="VersioningStatus" />
- </property>
-
- <many-to-one name="shost" column="SHostID"
- class="com.cloud.bridge.model.SHost"
- cascade="none"
- />
-
- <set name="objectsInBucket" inverse="true" lazy="true" cascade="all-delete-orphan">
- <key column="SBucketID" />
- <one-to-many class="com.cloud.bridge.model.SObject" />
- </set>
-
- </class>
-</hibernate-mapping>
-
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/39aa7d86/awsapi/src/com/cloud/bridge/model/SBucket.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/model/SBucket.java b/awsapi/src/com/cloud/bridge/model/SBucket.java
index 720907f..7703ae7 100644
--- a/awsapi/src/com/cloud/bridge/model/SBucket.java
+++ b/awsapi/src/com/cloud/bridge/model/SBucket.java
@@ -31,14 +31,13 @@ import java.util.Set;
* VersioningStatus
* For ORM see "com/cloud/bridge/model/SHost.hbm.xml"
*/
-public class SBucket implements Serializable {
- private static final long serialVersionUID = 7430267766019671273L;
-
- public static final int VERSIONING_NULL = 0;
+public interface SBucket {
+
+ public static final int VERSIONING_NULL = 0;
public static final int VERSIONING_ENABLED = 1;
public static final int VERSIONING_SUSPENDED = 2;
- private Long id;
+/* private Long id;
private String name;
private String ownerCanonicalId;
@@ -124,5 +123,5 @@ public class SBucket implements Serializable {
@Override
public int hashCode() {
return getName().hashCode();
- }
+ }*/
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/39aa7d86/awsapi/src/com/cloud/bridge/model/SBucketVO.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/model/SBucketVO.java b/awsapi/src/com/cloud/bridge/model/SBucketVO.java
new file mode 100644
index 0000000..ca47bf7
--- /dev/null
+++ b/awsapi/src/com/cloud/bridge/model/SBucketVO.java
@@ -0,0 +1,169 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.bridge.model;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.persistence.Transient;
+
+/**
+ * Holds the relation
+ * Id,
+ * Name,
+ * OwnerCanonicalId,
+ * SHost,
+ * CreateTime,
+ * VersioningStatus
+ * For ORM see "com/cloud/bridge/model/SHost.hbm.xml"
+ */
+
+@Entity
+@Table(name="sbucket")
+public class SBucketVO implements SBucket {
+
+ @Id
+ @GeneratedValue(strategy=GenerationType.IDENTITY)
+ @Column(name="ID")
+ private Long id;
+
+ @Column(name="Name")
+ private String name;
+
+ @Column(name="OwnerCanonicalID")
+ private String ownerCanonicalId;
+
+ @Column(name="SHostID")
+ private long shostID;
+
+ @Column(name="CreateTime")
+ @Temporal(value=TemporalType.TIMESTAMP)
+ private Date createTime;
+
+ @Column(name="VersioningStatus")
+ private int versioningStatus;
+
+ @Transient
+ private SHostVO shost;
+
+ @Transient
+ private Set<SObjectVO> objectsInBucket = new HashSet<SObjectVO>();
+
+ public SBucketVO() {
+ versioningStatus = VERSIONING_NULL;
+ this.createTime = new Date();
+ }
+
+
+ public SBucketVO(String bucketName, Date currentGMTTime,
+ String canonicalUserId, SHostVO first) {
+ this.versioningStatus = VERSIONING_NULL;
+ this.name = bucketName;
+ this.createTime = new Date();
+ this.ownerCanonicalId = canonicalUserId;
+ this.shost = first;
+ this.shostID = shost.getId();
+ }
+
+
+ public Long getId() {
+ return id;
+ }
+
+ private void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getOwnerCanonicalId() {
+ return ownerCanonicalId;
+ }
+
+ public void setOwnerCanonicalId(String ownerCanonicalId) {
+ this.ownerCanonicalId = ownerCanonicalId;
+ }
+
+ public long getShostID() {
+ return shostID;
+ }
+
+ public void setShostID(long shostID) {
+ this.shostID = shostID;
+ }
+
+ public SHostVO getShost() {
+ return shost;
+ }
+
+ public void setShost(SHostVO shost) {
+ this.shost = shost;
+ }
+
+ public Date getCreateTime() {
+ return createTime;
+ }
+
+
+ public int getVersioningStatus() {
+ return versioningStatus;
+ }
+
+ public void setVersioningStatus( int versioningStatus ) {
+ this.versioningStatus = versioningStatus;
+ }
+
+ public Set<SObjectVO> getObjectsInBucket() {
+ return objectsInBucket;
+ }
+
+ public void setObjectsInBucket(Set<SObjectVO> objectsInBucket) {
+ this.objectsInBucket = objectsInBucket;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if(this == other)
+ return true;
+
+ if(!(other instanceof SBucketVO))
+ return false;
+
+ return getName().equals(((SBucketVO)other).getName());
+ }
+
+ @Override
+ public int hashCode() {
+ return getName().hashCode();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/39aa7d86/awsapi/src/com/cloud/bridge/model/SHost.hbm.xml
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/model/SHost.hbm.xml b/awsapi/src/com/cloud/bridge/model/SHost.hbm.xml
deleted file mode 100644
index 5308a08..0000000
--- a/awsapi/src/com/cloud/bridge/model/SHost.hbm.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-<?xml version="1.0"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-
-<hibernate-mapping>
- <class name="com.cloud.bridge.model.SHost" table="shost" lazy="true">
- <id name="id" type="long" column="ID" >
- <generator class="native" />
- </id>
-
- <property name="host">
- <column name="Host" />
- </property>
- <property name="hostType">
- <column name="HostType" />
- </property>
- <property name="exportRoot">
- <column name="ExportRoot" />
- </property>
- <property name="userOnHost">
- <column name="UserOnHost"/>
- </property>
- <property name="userPassword">
- <column name="UserPassword"/>
- </property>
-
- <many-to-one name="mhost" column="MHostID"
- class="com.cloud.bridge.model.MHost"
- cascade="none"
- />
-
- <set name="buckets" inverse="true" lazy="true" cascade="all-delete-orphan">
- <key column="SHostID" />
- <one-to-many class="com.cloud.bridge.model.SBucket" />
- </set>
-
- <set name="mounts" inverse="true" lazy="true" cascade="all-delete-orphan">
- <key column="SHostID" />
- <one-to-many class="com.cloud.bridge.model.MHostMount" />
- </set>
- </class>
-</hibernate-mapping>
-
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/39aa7d86/awsapi/src/com/cloud/bridge/model/SHost.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/model/SHost.java b/awsapi/src/com/cloud/bridge/model/SHost.java
index 758cbbf..4ed5b7e 100644
--- a/awsapi/src/com/cloud/bridge/model/SHost.java
+++ b/awsapi/src/com/cloud/bridge/model/SHost.java
@@ -20,17 +20,19 @@ import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
-public class SHost implements Serializable {
- private static final long serialVersionUID = 213346565810468018L;
+public interface SHost {
public static final int STORAGE_HOST_TYPE_LOCAL = 0;
public static final int STORAGE_HOST_TYPE_NFS = 1;
-
- private Long id;
+ public static enum StorageHostType {
+ STORAGE_HOST_TYPE_LOCAL, //0
+ STORAGE_HOST_TYPE_NFS //1
+ }
+/* private Long id;
private String host;
private int hostType;
- private MHost mhost;
+ private MHostVO mhost;
private String exportRoot;
private String userOnHost;
private String userPassword;
@@ -89,11 +91,11 @@ public class SHost implements Serializable {
this.userPassword = userPassword;
}
- public MHost getMhost() {
+ public MHostVO getMhost() {
return mhost;
}
- public void setMhost(MHost mhost) {
+ public void setMhost(MHostVO mhost) {
this.mhost = mhost;
}
@@ -111,5 +113,5 @@ public class SHost implements Serializable {
public void setMounts(Set<MHostMount> mounts) {
this.mounts = mounts;
- }
+ }*/
}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/39aa7d86/awsapi/src/com/cloud/bridge/model/SHostVO.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/model/SHostVO.java b/awsapi/src/com/cloud/bridge/model/SHostVO.java
new file mode 100644
index 0000000..f3d2a58
--- /dev/null
+++ b/awsapi/src/com/cloud/bridge/model/SHostVO.java
@@ -0,0 +1,152 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.bridge.model;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+
+@Entity
+@Table(name="shost")
+public class SHostVO implements SHost{
+ private static final long serialVersionUID = 213346565810468018L;
+
+ public static final int STORAGE_HOST_TYPE_LOCAL = 0;
+ public static final int STORAGE_HOST_TYPE_NFS = 1;
+
+ @Id
+ @GeneratedValue(strategy=GenerationType.IDENTITY)
+ @Column(name="ID")
+ private Long id;
+
+ @Column(name="Host")
+ private String host;
+
+ @Column(name="HostType")
+ private int hostType;
+
+ @Column(name="MHostID")
+ private long mhostid;
+
+ @Column(name="ExportRoot")
+ private String exportRoot;
+
+ @Column(name="UserOnHost")
+ private String userOnHost;
+
+ @Column(name="UserPassword")
+ private String userPassword;
+
+ @Transient
+ private MHostVO mhost;
+
+ @Transient
+ private Set<SBucket> buckets = new HashSet<SBucket>();
+
+ @Transient
+ private Set<MHostMountVO> mounts = new HashSet<MHostMountVO>();
+
+ public SHostVO() {
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ private void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getHost() {
+ return host;
+ }
+
+ public void setHost(String host) {
+ this.host = host;
+ }
+
+ public int getHostType() {
+ return hostType;
+ }
+
+ public void setHostType(int hostType) {
+ this.hostType = hostType;
+ }
+
+ public long getMhostid() {
+ return mhostid;
+ }
+
+ public void setMhostid(long mhostid) {
+ this.mhostid = mhostid;
+ }
+
+ public String getExportRoot() {
+ return exportRoot;
+ }
+
+ public void setExportRoot(String exportRoot) {
+ this.exportRoot = exportRoot;
+ }
+
+ public String getUserOnHost() {
+ return userOnHost;
+ }
+
+ public void setUserOnHost(String userOnHost) {
+ this.userOnHost = userOnHost;
+ }
+
+ public String getUserPassword() {
+ return userPassword;
+ }
+
+ public void setUserPassword(String userPassword) {
+ this.userPassword = userPassword;
+ }
+
+ public MHostVO getMhost() {
+ return mhost;
+ }
+
+ public void setMhost(MHostVO mhost) {
+ this.mhost = mhost;
+ }
+
+ public Set<SBucket> getBuckets() {
+ return buckets;
+ }
+
+ public void setBuckets(Set<SBucket> buckets) {
+ this.buckets = buckets;
+ }
+
+ public Set<MHostMountVO> getMounts() {
+ return mounts;
+ }
+
+ public void setMounts(Set<MHostMountVO> mounts) {
+ this.mounts = mounts;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/39aa7d86/awsapi/src/com/cloud/bridge/model/SMeta.hbm.xml
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/model/SMeta.hbm.xml b/awsapi/src/com/cloud/bridge/model/SMeta.hbm.xml
deleted file mode 100644
index 0f3b12b..0000000
--- a/awsapi/src/com/cloud/bridge/model/SMeta.hbm.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-
-<hibernate-mapping>
- <class name="com.cloud.bridge.model.SMeta" table="meta" lazy="true">
- <id name="id" type="long" column="ID" >
- <generator class="native" />
- </id>
- <property name="target">
- <column name="Target" />
- </property>
- <property name="targetId">
- <column name="TargetID" />
- </property>
- <property name="name">
- <column name="Name" />
- </property>
- <property name="value">
- <column name="Value" />
- </property>
- </class>
-</hibernate-mapping>
-
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/39aa7d86/awsapi/src/com/cloud/bridge/model/SMeta.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/model/SMeta.java b/awsapi/src/com/cloud/bridge/model/SMeta.java
deleted file mode 100644
index 2c98571..0000000
--- a/awsapi/src/com/cloud/bridge/model/SMeta.java
+++ /dev/null
@@ -1,94 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.bridge.model;
-
-import java.io.Serializable;
-
-public class SMeta implements Serializable {
- private static final long serialVersionUID = 7459503272337054283L;
-
- private Long id;
- private String target;
- private long targetId;
-
- private String name;
- private String value;
-
- public SMeta() {
- }
-
- public Long getId() {
- return id;
- }
-
- private void setId(Long id) {
- this.id = id;
- }
-
- public String getTarget() {
- return target;
- }
-
- public void setTarget(String target) {
- this.target = target;
- }
-
- public long getTargetId() {
- return targetId;
- }
-
- public void setTargetId(long targetId) {
- this.targetId = targetId;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- @Override
- public boolean equals(Object other) {
- if(this == other)
- return true;
-
- if(!(other instanceof SMeta))
- return false;
-
- return getTarget().equals(((SMeta)other).getTarget()) && getTargetId() == ((SMeta)other).getTargetId()
- && getName().equals(((SMeta)other).getName());
- }
-
- @Override
- public int hashCode() {
- int hashCode = 0;
- hashCode = hashCode*17 + getTarget().hashCode();
- hashCode = hashCode*17 + (int)getTargetId();
- hashCode = hashCode*17 + getName().hashCode();
- return hashCode;
- }
-}