mirror of https://github.com/apache/cloudstack.git
Finishing merge with 3.0.x
This commit is contained in:
parent
6257af95ed
commit
4643e403ff
|
|
@ -33,12 +33,9 @@ import com.cloud.bridge.persist.dao.UserCredentialsDao;
|
|||
import com.cloud.bridge.service.UserContext;
|
||||
import com.cloud.bridge.util.S3SoapAuth;
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
/*
|
||||
* For SOAP compatibility.
|
||||
*/
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
|
||||
public class AuthenticationHandler implements Handler {
|
||||
protected final static Logger logger = Logger.getLogger(AuthenticationHandler.class);
|
||||
|
|
|
|||
|
|
@ -19,11 +19,7 @@ import org.apache.axis2.context.ConfigurationContext;
|
|||
import org.apache.axis2.description.AxisService;
|
||||
import org.apache.axis2.engine.ServiceLifeCycle;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.cloud.bridge.service.ServiceProvider;
|
||||
=======
|
||||
import com.cloud.bridge.service.controller.s3.ServiceProvider;
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
|
||||
/**
|
||||
* @author Kelven Yang
|
||||
|
|
|
|||
|
|
@ -1,251 +1,239 @@
|
|||
/*
|
||||
* Copyright (C) 2011 Citrix Systems, Inc. All rights reserved.
|
||||
*
|
||||
* Licensed 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;
|
||||
|
||||
<<<<<<< HEAD
|
||||
/**
|
||||
* @author Kelven Yang
|
||||
=======
|
||||
import com.cloud.bridge.service.exception.UnsupportedException;
|
||||
import com.cloud.bridge.util.OrderedPair;
|
||||
import com.cloud.bridge.util.Triple;
|
||||
|
||||
/**
|
||||
* @author John Zucker, Kelven Yang
|
||||
* 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.
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
*/
|
||||
public class SAcl implements Serializable {
|
||||
private static final long serialVersionUID = 7900837117165018850L;
|
||||
|
||||
public static final int GRANTEE_USER = 0;
|
||||
public static final int GRANTEE_ALLUSERS = 1;
|
||||
public static final int GRANTEE_AUTHENTICATED = 2;
|
||||
|
||||
<<<<<<< HEAD
|
||||
public static final int PERMISSION_PASS = -1; // -> no ACL test required
|
||||
=======
|
||||
public static final int PERMISSION_PASS = -1; // No ACL test required
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
public static final int PERMISSION_NONE = 0;
|
||||
public static final int PERMISSION_READ = 1;
|
||||
public static final int PERMISSION_WRITE = 2;
|
||||
public static final int PERMISSION_READ_ACL = 4;
|
||||
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;
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
/** 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" );
|
||||
}
|
||||
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2011 Citrix Systems, Inc. All rights reserved.
|
||||
*
|
||||
* Licensed 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 com.cloud.bridge.service.exception.UnsupportedException;
|
||||
import com.cloud.bridge.util.OrderedPair;
|
||||
import com.cloud.bridge.util.Triple;
|
||||
|
||||
/**
|
||||
* @author John Zucker, Kelven Yang
|
||||
* 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.
|
||||
*/
|
||||
public class SAcl implements Serializable {
|
||||
private static final long serialVersionUID = 7900837117165018850L;
|
||||
|
||||
public static final int GRANTEE_USER = 0;
|
||||
public static final int GRANTEE_ALLUSERS = 1;
|
||||
public static final int GRANTEE_AUTHENTICATED = 2;
|
||||
|
||||
public static final int PERMISSION_PASS = -1; // No ACL test required
|
||||
public static final int PERMISSION_NONE = 0;
|
||||
public static final int PERMISSION_READ = 1;
|
||||
public static final int PERMISSION_WRITE = 2;
|
||||
public static final int PERMISSION_READ_ACL = 4;
|
||||
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
|
||||
* 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" );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -21,9 +21,6 @@ import java.util.HashSet;
|
|||
import java.util.Set;
|
||||
|
||||
/**
|
||||
<<<<<<< HEAD
|
||||
* @author Kelven Yang
|
||||
=======
|
||||
* @author Kelven Yang, John Zucker
|
||||
* Holds the relation
|
||||
* Id,
|
||||
|
|
@ -33,16 +30,11 @@ import java.util.Set;
|
|||
* CreateTime,
|
||||
* VersioningStatus
|
||||
* For ORM see "com/cloud/bridge/model/SHost.hbm.xml"
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
*/
|
||||
public class SBucket implements Serializable {
|
||||
private static final long serialVersionUID = 7430267766019671273L;
|
||||
|
||||
<<<<<<< HEAD
|
||||
public static final int VERSIONING_NULL = 0; // -> initial set, not set to anything yet
|
||||
=======
|
||||
public static final int VERSIONING_NULL = 0;
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
public static final int VERSIONING_ENABLED = 1;
|
||||
public static final int VERSIONING_SUSPENDED = 2;
|
||||
|
||||
|
|
|
|||
|
|
@ -22,11 +22,7 @@ import java.util.Iterator;
|
|||
import java.util.Set;
|
||||
|
||||
/**
|
||||
<<<<<<< HEAD
|
||||
* @author Kelven Yang
|
||||
=======
|
||||
* @author Kelven Yang, John Zucker
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
*/
|
||||
public class SObject implements Serializable {
|
||||
private static final long serialVersionUID = 8566744941395660486L;
|
||||
|
|
@ -37,11 +33,7 @@ public class SObject implements Serializable {
|
|||
private String ownerCanonicalId;
|
||||
|
||||
private int nextSequence;
|
||||
<<<<<<< HEAD
|
||||
private String deletionMark; // -> this must also a unique ID to give to the REST client
|
||||
=======
|
||||
private String deletionMark; // This must also a unique ID to give to the REST client
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
|
||||
private Date createTime;
|
||||
|
||||
|
|
@ -141,11 +133,7 @@ public class SObject implements Serializable {
|
|||
{
|
||||
SObjectItem item = it.next();
|
||||
|
||||
<<<<<<< HEAD
|
||||
// -> If versioning is off then return the item with the null version string (if exists)
|
||||
=======
|
||||
// If versioning is off then return the item with the null version string (if exists)
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
// For example, the bucket could have allowed versioning and then it was suspended
|
||||
// If an application wants a specific version it will need to explicitly ask for it
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -19,11 +19,7 @@ import java.io.Serializable;
|
|||
import java.util.Date;
|
||||
|
||||
/**
|
||||
<<<<<<< HEAD
|
||||
* @author Kelven Yang
|
||||
=======
|
||||
* @author Kelven Yang, John Zucker
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
*/
|
||||
public class SObjectItem implements Serializable {
|
||||
private static final long serialVersionUID = -7351173256185687851L;
|
||||
|
|
@ -80,11 +76,7 @@ public class SObjectItem implements Serializable {
|
|||
}
|
||||
|
||||
public void setStoredPath(String storedPath) {
|
||||
<<<<<<< HEAD
|
||||
this.storedPath = storedPath;
|
||||
=======
|
||||
this.storedPath = storedPath; // TODO - storedpath holds integer, called from S3Engine.allocObjectItem
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
}
|
||||
|
||||
public long getStoredSize() {
|
||||
|
|
|
|||
|
|
@ -66,11 +66,7 @@ public class UserCredentials implements Serializable {
|
|||
|
||||
if (!(other instanceof UserCredentials)) return false;
|
||||
|
||||
<<<<<<< HEAD
|
||||
// -> the cert id can be null in both or either, since it is only used for the SOAP API
|
||||
=======
|
||||
// The cert id can be null. The cert is unused in the REST API.
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
if ( getAccessKey().equals(((UserCredentials)other).getAccessKey()) &&
|
||||
getSecretKey().equals(((UserCredentials)other).getSecretKey()))
|
||||
{
|
||||
|
|
@ -89,11 +85,7 @@ public class UserCredentials implements Serializable {
|
|||
int hashCode = 0;
|
||||
String thisCertId = getCertUniqueId();
|
||||
|
||||
<<<<<<< HEAD
|
||||
// -> the cert id can be null, since it is only used for the SOAP API
|
||||
=======
|
||||
// The cert id can be null. The cert is unused in the REST API.
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
hashCode = hashCode*17 + getAccessKey().hashCode();
|
||||
hashCode = hashCode*17 + getSecretKey().hashCode();
|
||||
if (null != thisCertId) hashCode = hashCode*17 + thisCertId.hashCode();
|
||||
|
|
|
|||
|
|
@ -24,24 +24,6 @@ import org.hibernate.Session;
|
|||
import com.cloud.bridge.util.QueryHelper;
|
||||
|
||||
/**
|
||||
<<<<<<< HEAD
|
||||
* @author Kelven Yang
|
||||
*/
|
||||
public class EntityDao<T> {
|
||||
private Class<?> clazz;
|
||||
|
||||
private boolean isCloudStackSession = false;
|
||||
|
||||
public EntityDao(Class<?> clazz){
|
||||
this(clazz, false);
|
||||
}
|
||||
|
||||
public EntityDao(Class<?> clazz, boolean isCloudStackSession) {
|
||||
this.clazz = clazz;
|
||||
this.isCloudStackSession = isCloudStackSession;
|
||||
// Note : beginTransaction can be called multiple times
|
||||
PersistContext.beginTransaction(isCloudStackSession);
|
||||
=======
|
||||
* @author Kelven Yang, John Zucker
|
||||
* Provide methods for getting, saving, deleting or updating state per session or, in a given session, returnin a List in
|
||||
* response to queryEntities for a particular instantation of the EntityDao generic class, as defined here.
|
||||
|
|
@ -52,6 +34,14 @@ public class EntityDao<T> {
|
|||
public class EntityDao<T> {
|
||||
private Class<?> clazz;
|
||||
|
||||
private boolean isCloudStackSession = false;
|
||||
public EntityDao(Class<?> clazz, boolean isCloudStackSession) {
|
||||
this.clazz = clazz;
|
||||
this.isCloudStackSession = isCloudStackSession;
|
||||
// Note : beginTransaction can be called multiple times
|
||||
PersistContext.beginTransaction(isCloudStackSession);
|
||||
}
|
||||
|
||||
public EntityDao(Class<?> clazz) {
|
||||
this.clazz = clazz;
|
||||
|
||||
|
|
@ -59,54 +49,34 @@ public class EntityDao<T> {
|
|||
// "If a new underlying transaction is required, begin the transaction. Otherwise continue the new work in the
|
||||
// context of the existing underlying transaction." from the Hibernate spec
|
||||
PersistContext.beginTransaction();
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public T get(Serializable id) {
|
||||
<<<<<<< HEAD
|
||||
Session session = PersistContext.getSession(isCloudStackSession);
|
||||
=======
|
||||
Session session = PersistContext.getSession();
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
return (T)session.get(clazz, id);
|
||||
}
|
||||
|
||||
public T save(T entity) {
|
||||
<<<<<<< HEAD
|
||||
Session session = PersistContext.getSession(isCloudStackSession);
|
||||
=======
|
||||
Session session = PersistContext.getSession();
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
session.saveOrUpdate(entity);
|
||||
return entity;
|
||||
}
|
||||
|
||||
public T update(T entity) {
|
||||
<<<<<<< HEAD
|
||||
Session session = PersistContext.getSession(isCloudStackSession);
|
||||
=======
|
||||
Session session = PersistContext.getSession();
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
session.saveOrUpdate(entity);
|
||||
return entity;
|
||||
}
|
||||
|
||||
public void delete(T entity) {
|
||||
<<<<<<< HEAD
|
||||
Session session = PersistContext.getSession(isCloudStackSession);
|
||||
=======
|
||||
Session session = PersistContext.getSession();
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
session.delete(entity);
|
||||
}
|
||||
|
||||
public T queryEntity(String hql, Object[] params) {
|
||||
<<<<<<< HEAD
|
||||
Session session = PersistContext.getSession(isCloudStackSession);
|
||||
=======
|
||||
Session session = PersistContext.getSession();
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
Query query = session.createQuery(hql);
|
||||
query.setMaxResults(1);
|
||||
QueryHelper.bindParameters(query, params);
|
||||
|
|
@ -114,11 +84,7 @@ public class EntityDao<T> {
|
|||
}
|
||||
|
||||
public List<T> queryEntities(String hql, Object[] params) {
|
||||
<<<<<<< HEAD
|
||||
Session session = PersistContext.getSession(isCloudStackSession);
|
||||
=======
|
||||
Session session = PersistContext.getSession();
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
Query query = session.createQuery(hql);
|
||||
QueryHelper.bindParameters(query, params);
|
||||
|
||||
|
|
@ -126,11 +92,7 @@ public class EntityDao<T> {
|
|||
}
|
||||
|
||||
public List<T> queryEntities(String hql, int offset, int limit, Object[] params) {
|
||||
<<<<<<< HEAD
|
||||
Session session = PersistContext.getSession(isCloudStackSession);
|
||||
=======
|
||||
Session session = PersistContext.getSession();
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
Query query = session.createQuery(hql);
|
||||
QueryHelper.bindParameters(query, params);
|
||||
query.setFirstResult(offset);
|
||||
|
|
@ -139,11 +101,7 @@ public class EntityDao<T> {
|
|||
}
|
||||
|
||||
public int executeUpdate(String hql, Object[] params) {
|
||||
<<<<<<< HEAD
|
||||
Session session = PersistContext.getSession(isCloudStackSession);
|
||||
=======
|
||||
Session session = PersistContext.getSession();
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
Query query = session.createQuery(hql);
|
||||
QueryHelper.bindParameters(query, params);
|
||||
|
||||
|
|
|
|||
|
|
@ -28,12 +28,8 @@ import org.hibernate.Session;
|
|||
import org.hibernate.Transaction;
|
||||
|
||||
import com.cloud.bridge.util.CloudSessionFactory;
|
||||
<<<<<<< HEAD
|
||||
import com.cloud.bridge.util.CloudStackSessionFactory;
|
||||
import com.cloud.bridge.util.Tuple;
|
||||
=======
|
||||
import com.cloud.bridge.util.OrderedPair;
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
|
||||
/**
|
||||
* @author Kelven Yang
|
||||
|
|
@ -53,16 +49,11 @@ public class PersistContext {
|
|||
protected final static Logger logger = Logger.getLogger(PersistContext.class);
|
||||
|
||||
private static final CloudSessionFactory sessionFactory;
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
private static final ThreadLocal<Session> threadSession = new ThreadLocal<Session>();
|
||||
private static final ThreadLocal<Transaction> threadTransaction = new ThreadLocal<Transaction>();
|
||||
private static final ThreadLocal<Map<String, Object>> threadStore = new ThreadLocal<Map<String, Object>>();
|
||||
|
||||
<<<<<<< HEAD
|
||||
private static final CloudStackSessionFactory cloudStackSessionFactory;
|
||||
private static final ThreadLocal<Session> threadCloudStackSession = new ThreadLocal<Session>();
|
||||
private static final ThreadLocal<Transaction> threadCloudStackTransaction = new ThreadLocal<Transaction>();
|
||||
|
|
@ -71,18 +62,12 @@ public class PersistContext {
|
|||
try {
|
||||
sessionFactory = CloudSessionFactory.getInstance();
|
||||
cloudStackSessionFactory = CloudStackSessionFactory.getInstance();
|
||||
=======
|
||||
static {
|
||||
try {
|
||||
sessionFactory = CloudSessionFactory.getInstance();
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
} catch(HibernateException e) {
|
||||
logger.error("Exception " + e.getMessage(), e);
|
||||
throw new PersistException(e);
|
||||
}
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
public static Session getSession(boolean cloudStackSession) {
|
||||
Session s = null;
|
||||
try {
|
||||
|
|
@ -150,48 +135,12 @@ public class PersistContext {
|
|||
}else{
|
||||
threadTransaction.set(tx);
|
||||
}
|
||||
=======
|
||||
public static Session getSession() {
|
||||
Session s = threadSession.get();
|
||||
try {
|
||||
if(s == null) {
|
||||
s = sessionFactory.openSession();
|
||||
threadSession.set(s);
|
||||
}
|
||||
} catch(HibernateException e) {
|
||||
logger.error("Exception " + e.getMessage(), e);
|
||||
throw new PersistException(e);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
public static void closeSession() {
|
||||
try {
|
||||
Session s = (Session) threadSession.get();
|
||||
threadSession.set(null);
|
||||
|
||||
if (s != null && s.isOpen())
|
||||
s.close();
|
||||
} catch(HibernateException e) {
|
||||
logger.error("Exception " + e.getMessage(), e);
|
||||
throw new PersistException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void beginTransaction() {
|
||||
Transaction tx = threadTransaction.get();
|
||||
try {
|
||||
if (tx == null) {
|
||||
tx = getSession().beginTransaction();
|
||||
threadTransaction.set(tx);
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
}
|
||||
} catch(HibernateException e) {
|
||||
logger.error("Exception " + e.getMessage(), e);
|
||||
throw new PersistException(e);
|
||||
}
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
|
||||
public static void beginTransaction() {
|
||||
beginTransaction(false);
|
||||
|
|
@ -219,24 +168,10 @@ public class PersistContext {
|
|||
logger.error("Exception " + e.getMessage(), e);
|
||||
|
||||
rollbackTransaction(cloudStackTxn);
|
||||
=======
|
||||
|
||||
public static void commitTransaction() {
|
||||
Transaction tx = threadTransaction.get();
|
||||
try {
|
||||
if ( tx != null && !tx.wasCommitted() && !tx.wasRolledBack() )
|
||||
tx.commit();
|
||||
threadTransaction.set(null);
|
||||
} catch (HibernateException e) {
|
||||
logger.error("Exception " + e.getMessage(), e);
|
||||
|
||||
rollbackTransaction();
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
throw new PersistException(e);
|
||||
}
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
public static void commitTransaction() {
|
||||
commitTransaction(false);
|
||||
}
|
||||
|
|
@ -252,12 +187,6 @@ public class PersistContext {
|
|||
threadTransaction.set(null);
|
||||
}
|
||||
try {
|
||||
=======
|
||||
public static void rollbackTransaction() {
|
||||
Transaction tx = (Transaction) threadTransaction.get();
|
||||
try {
|
||||
threadTransaction.set(null);
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
if ( tx != null && !tx.wasCommitted() && !tx.wasRolledBack() ) {
|
||||
tx.rollback();
|
||||
}
|
||||
|
|
@ -265,7 +194,6 @@ public class PersistContext {
|
|||
logger.error("Exception " + e.getMessage(), e);
|
||||
throw new PersistException(e);
|
||||
} finally {
|
||||
<<<<<<< HEAD
|
||||
closeSession(cloudStackTxn);
|
||||
}
|
||||
}
|
||||
|
|
@ -274,12 +202,6 @@ public class PersistContext {
|
|||
rollbackTransaction(false);
|
||||
}
|
||||
|
||||
=======
|
||||
closeSession();
|
||||
}
|
||||
}
|
||||
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
public static void flush() {
|
||||
commitTransaction();
|
||||
beginTransaction();
|
||||
|
|
@ -294,24 +216,15 @@ public class PersistContext {
|
|||
* @return
|
||||
*/
|
||||
public static boolean acquireNamedLock(String name, int timeoutSeconds) {
|
||||
<<<<<<< HEAD
|
||||
Connection conn = getJDBCConnection(name, true);
|
||||
if(conn == null) {
|
||||
=======
|
||||
Connection jdbcConnection = getJDBCConnection(name, true);
|
||||
if(jdbcConnection == null) {
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
logger.warn("Unable to acquire named lock connection for named lock: " + name);
|
||||
return false;
|
||||
}
|
||||
|
||||
PreparedStatement pstmt = null;
|
||||
try {
|
||||
<<<<<<< HEAD
|
||||
pstmt = conn.prepareStatement("SELECT COALESCE(GET_LOCK(?, ?),0)");
|
||||
=======
|
||||
pstmt = jdbcConnection.prepareStatement("SELECT COALESCE(GET_LOCK(?, ?),0)");
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
|
||||
pstmt.setString(1, name);
|
||||
pstmt.setInt(2, timeoutSeconds);
|
||||
|
|
@ -343,24 +256,15 @@ public class PersistContext {
|
|||
}
|
||||
|
||||
public static boolean releaseNamedLock(String name) {
|
||||
<<<<<<< HEAD
|
||||
Connection conn = getJDBCConnection(name, false);
|
||||
if(conn == null) {
|
||||
=======
|
||||
Connection jdbcConnection = getJDBCConnection(name, false);
|
||||
if(jdbcConnection == null) {
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
logger.error("Unable to acquire DB connection for global lock system");
|
||||
return false;
|
||||
}
|
||||
|
||||
PreparedStatement pstmt = null;
|
||||
try {
|
||||
<<<<<<< HEAD
|
||||
pstmt = conn.prepareStatement("SELECT COALESCE(RELEASE_LOCK(?), 0)");
|
||||
=======
|
||||
pstmt = jdbcConnection.prepareStatement("SELECT COALESCE(RELEASE_LOCK(?), 0)");
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
pstmt.setString(1, name);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
if(rs != null && rs.first())
|
||||
|
|
@ -379,11 +283,7 @@ public class PersistContext {
|
|||
@SuppressWarnings("deprecation")
|
||||
private static Connection getJDBCConnection(String name, boolean allocNew) {
|
||||
String registryKey = "JDBC-Connection." + name;
|
||||
<<<<<<< HEAD
|
||||
Tuple<Session, Connection> info = (Tuple<Session, Connection>)getThreadStoreObject(registryKey);
|
||||
=======
|
||||
OrderedPair<Session, Connection> info = (OrderedPair<Session, Connection>)getThreadStoreObject(registryKey);
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
if(info == null && allocNew) {
|
||||
Session session = sessionFactory.openSession();
|
||||
Connection connection = session.connection();
|
||||
|
|
@ -405,11 +305,7 @@ public class PersistContext {
|
|||
return null;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
registerThreadStoreObject(registryKey, new Tuple<Session, Connection>(session, connection));
|
||||
=======
|
||||
registerThreadStoreObject(registryKey, new OrderedPair<Session, Connection>(session, connection));
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
return connection;
|
||||
}
|
||||
|
||||
|
|
@ -421,11 +317,7 @@ public class PersistContext {
|
|||
|
||||
private static void releaseJDBCConnection(String name) {
|
||||
String registryKey = "JDBC-Connection." + name;
|
||||
<<<<<<< HEAD
|
||||
Tuple<Session, Connection> info = (Tuple<Session, Connection>)unregisterThreadStoreObject(registryKey);
|
||||
=======
|
||||
OrderedPair<Session, Connection> info = (OrderedPair<Session, Connection>)unregisterThreadStoreObject(registryKey);
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
if(info != null) {
|
||||
try {
|
||||
info.getSecond().close();
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ import com.cloud.bridge.util.ConfigurationHelper;
|
|||
public class BucketPolicyDao {
|
||||
public static final Logger logger = Logger.getLogger(BucketPolicyDao.class);
|
||||
|
||||
<<<<<<< HEAD
|
||||
private Connection conn = null;
|
||||
private String dbName = null;
|
||||
private String dbUser = null;
|
||||
|
|
@ -44,16 +43,6 @@ public class BucketPolicyDao {
|
|||
public BucketPolicyDao()
|
||||
{
|
||||
File propertiesFile = ConfigurationHelper.findConfigurationFile("db.properties");
|
||||
=======
|
||||
private Connection jdbcConnection = null;
|
||||
private String dbName = null;
|
||||
private String dbUser = null;
|
||||
private String dbPassword = null;
|
||||
|
||||
public BucketPolicyDao()
|
||||
{
|
||||
File propertiesFile = ConfigurationHelper.findConfigurationFile("ec2-service.properties");
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
Properties EC2Prop = null;
|
||||
|
||||
if (null != propertiesFile) {
|
||||
|
|
@ -65,17 +54,11 @@ public class BucketPolicyDao {
|
|||
} catch (IOException e) {
|
||||
logger.warn("Unable to read properties file: " + propertiesFile.getAbsolutePath(), e);
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
dbHost = EC2Prop.getProperty( "db.cloud.host" );
|
||||
dbName = EC2Prop.getProperty( "db.awsapi.name" );
|
||||
dbUser = EC2Prop.getProperty( "db.cloud.username" );
|
||||
dbPassword = EC2Prop.getProperty( "db.cloud.password" );
|
||||
dbPort = EC2Prop.getProperty( "db.cloud.port" );
|
||||
=======
|
||||
dbName = EC2Prop.getProperty( "dbName" );
|
||||
dbUser = EC2Prop.getProperty( "dbUser" );
|
||||
dbPassword = EC2Prop.getProperty( "dbPassword" );
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -86,11 +69,7 @@ public class BucketPolicyDao {
|
|||
|
||||
openConnection();
|
||||
try {
|
||||
<<<<<<< HEAD
|
||||
statement = conn.prepareStatement ( "INSERT INTO bucket_policies (BucketName, OwnerCanonicalID, Policy) VALUES (?,?,?)" );
|
||||
=======
|
||||
statement = jdbcConnection.prepareStatement ( "INSERT INTO bucket_policies (BucketName, OwnerCanonicalID, Policy) VALUES (?,?,?)" );
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
statement.setString( 1, bucketName );
|
||||
statement.setString( 2, owner );
|
||||
statement.setString( 3, policy );
|
||||
|
|
@ -114,11 +93,7 @@ public class BucketPolicyDao {
|
|||
|
||||
openConnection();
|
||||
try {
|
||||
<<<<<<< HEAD
|
||||
statement = conn.prepareStatement ( "SELECT OwnerCanonicalID FROM bucket_policies WHERE BucketName=?" );
|
||||
=======
|
||||
statement = jdbcConnection.prepareStatement ( "SELECT OwnerCanonicalID FROM bucket_policies WHERE BucketName=?" );
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
statement.setString( 1, bucketName );
|
||||
ResultSet rs = statement.executeQuery();
|
||||
if (rs.next()) owner = rs.getString( "OwnerCanonicalID" );
|
||||
|
|
@ -138,11 +113,7 @@ public class BucketPolicyDao {
|
|||
|
||||
openConnection();
|
||||
try {
|
||||
<<<<<<< HEAD
|
||||
statement = conn.prepareStatement ( "SELECT Policy FROM bucket_policies WHERE BucketName=?" );
|
||||
=======
|
||||
statement = jdbcConnection.prepareStatement ( "SELECT Policy FROM bucket_policies WHERE BucketName=?" );
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
statement.setString( 1, bucketName );
|
||||
ResultSet rs = statement.executeQuery();
|
||||
if (rs.next()) policy = rs.getString( "Policy" );
|
||||
|
|
@ -161,11 +132,7 @@ public class BucketPolicyDao {
|
|||
|
||||
openConnection();
|
||||
try {
|
||||
<<<<<<< HEAD
|
||||
statement = conn.prepareStatement ( "DELETE FROM bucket_policies WHERE BucketName=?" );
|
||||
=======
|
||||
statement = jdbcConnection.prepareStatement ( "DELETE FROM bucket_policies WHERE BucketName=?" );
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
statement.setString( 1, bucketName );
|
||||
int count = statement.executeUpdate();
|
||||
statement.close();
|
||||
|
|
@ -178,25 +145,14 @@ public class BucketPolicyDao {
|
|||
private void openConnection()
|
||||
throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
if (null == conn) {
|
||||
Class.forName( "com.mysql.jdbc.Driver" ).newInstance();
|
||||
conn = DriverManager.getConnection( "jdbc:mysql://" + dbHost + ":" + dbPort + "/" + dbName, dbUser, dbPassword );
|
||||
=======
|
||||
if (null == jdbcConnection) {
|
||||
Class.forName( "com.mysql.jdbc.Driver" ).newInstance();
|
||||
jdbcConnection = DriverManager.getConnection( "jdbc:mysql://localhost:3306/"+dbName, dbUser, dbPassword );
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
}
|
||||
}
|
||||
|
||||
private void closeConnection() throws SQLException {
|
||||
<<<<<<< HEAD
|
||||
if (null != conn) conn.close();
|
||||
conn = null;
|
||||
=======
|
||||
if (null != jdbcConnection) jdbcConnection.close();
|
||||
jdbcConnection = null;
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,11 +37,7 @@ import com.cloud.bridge.service.core.s3.S3MetaDataEntry;
|
|||
import com.cloud.bridge.service.core.s3.S3MultipartPart;
|
||||
import com.cloud.bridge.service.core.s3.S3MultipartUpload;
|
||||
import com.cloud.bridge.util.ConfigurationHelper;
|
||||
<<<<<<< HEAD
|
||||
import com.cloud.bridge.util.Tuple;
|
||||
=======
|
||||
import com.cloud.bridge.util.OrderedPair;
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
|
||||
public class MultipartLoadDao {
|
||||
public static final Logger logger = Logger.getLogger(MultipartLoadDao.class);
|
||||
|
|
@ -50,21 +46,12 @@ public class MultipartLoadDao {
|
|||
private String dbName = null;
|
||||
private String dbUser = null;
|
||||
private String dbPassword = null;
|
||||
<<<<<<< HEAD
|
||||
private String dbHost = null;
|
||||
private String dbPort = null;
|
||||
|
||||
public MultipartLoadDao() {
|
||||
File propertiesFile = ConfigurationHelper.findConfigurationFile("db.properties");
|
||||
Properties EC2Prop = null;
|
||||
=======
|
||||
|
||||
public MultipartLoadDao() {
|
||||
File propertiesFile = ConfigurationHelper.findConfigurationFile("ec2-service.properties");
|
||||
Properties EC2Prop = null;
|
||||
|
||||
// The settings for the CLOUDBRIDGE database are shared with the EC2 API
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
|
||||
if (null != propertiesFile) {
|
||||
EC2Prop = new Properties();
|
||||
|
|
@ -75,17 +62,11 @@ public class MultipartLoadDao {
|
|||
} catch (IOException e) {
|
||||
logger.warn("Unable to read properties file: " + propertiesFile.getAbsolutePath(), e);
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
dbHost = EC2Prop.getProperty( "db.cloud.host" );
|
||||
dbName = EC2Prop.getProperty( "db.awsapi.name" );
|
||||
dbUser = EC2Prop.getProperty( "db.cloud.username" );
|
||||
dbPassword = EC2Prop.getProperty( "db.cloud.password" );
|
||||
dbPort = EC2Prop.getProperty( "db.cloud.port" );
|
||||
=======
|
||||
dbName = EC2Prop.getProperty( "dbName" );
|
||||
dbUser = EC2Prop.getProperty( "dbUser" );
|
||||
dbPassword = EC2Prop.getProperty( "dbPassword" );
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -97,11 +78,7 @@ public class MultipartLoadDao {
|
|||
* @return creator of the multipart upload, and NameKey of upload
|
||||
* @throws SQLException, ClassNotFoundException, IllegalAccessException, InstantiationException
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
public Tuple<String,String> multipartExits( int uploadId )
|
||||
=======
|
||||
public OrderedPair<String,String> multipartExits( int uploadId )
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException
|
||||
{
|
||||
PreparedStatement statement = null;
|
||||
|
|
@ -116,11 +93,7 @@ public class MultipartLoadDao {
|
|||
if ( rs.next()) {
|
||||
accessKey = rs.getString( "AccessKey" );
|
||||
nameKey = rs.getString( "NameKey" );
|
||||
<<<<<<< HEAD
|
||||
return new Tuple<String,String>( accessKey, nameKey );
|
||||
=======
|
||||
return new OrderedPair<String,String>( accessKey, nameKey );
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
}
|
||||
else return null;
|
||||
|
||||
|
|
@ -365,17 +338,10 @@ public class MultipartLoadDao {
|
|||
* @param prefix - can be null
|
||||
* @param keyMarker - can be null
|
||||
* @param uploadIdMarker - can be null, should only be defined if keyMarker is not-null
|
||||
<<<<<<< HEAD
|
||||
* @return Tuple<S3MultipartUpload[], isTruncated>
|
||||
* @throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException
|
||||
*/
|
||||
public Tuple<S3MultipartUpload[],Boolean> getInitiatedUploads( String bucketName, int maxParts, String prefix, String keyMarker, String uploadIdMarker )
|
||||
=======
|
||||
* @return OrderedPair<S3MultipartUpload[], isTruncated>
|
||||
* @throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException
|
||||
*/
|
||||
public OrderedPair<S3MultipartUpload[],Boolean> getInitiatedUploads( String bucketName, int maxParts, String prefix, String keyMarker, String uploadIdMarker )
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException
|
||||
{
|
||||
S3MultipartUpload[] inProgress = new S3MultipartUpload[maxParts];
|
||||
|
|
@ -421,11 +387,7 @@ public class MultipartLoadDao {
|
|||
statement.close();
|
||||
|
||||
if (i < maxParts) inProgress = (S3MultipartUpload[])resizeArray(inProgress,i);
|
||||
<<<<<<< HEAD
|
||||
return new Tuple<S3MultipartUpload[], Boolean>(inProgress, isTruncated);
|
||||
=======
|
||||
return new OrderedPair<S3MultipartUpload[], Boolean>(inProgress, isTruncated);
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
|
||||
} finally {
|
||||
closeConnection();
|
||||
|
|
@ -470,11 +432,7 @@ public class MultipartLoadDao {
|
|||
|
||||
parts[i] = new S3MultipartPart();
|
||||
parts[i].setPartNumber( rs.getInt( "partNumber" ));
|
||||
<<<<<<< HEAD
|
||||
parts[i].setEtag( rs.getString( "MD5" ));
|
||||
=======
|
||||
parts[i].setEtag( rs.getString( "MD5" ).toLowerCase());
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
parts[i].setLastModified( tod );
|
||||
parts[i].setSize( rs.getInt( "StoredSize" ));
|
||||
parts[i].setPath( rs.getString( "StoredPath" ));
|
||||
|
|
@ -556,11 +514,7 @@ public class MultipartLoadDao {
|
|||
throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException {
|
||||
if (null == conn) {
|
||||
Class.forName( "com.mysql.jdbc.Driver" ).newInstance();
|
||||
<<<<<<< HEAD
|
||||
conn = DriverManager.getConnection( "jdbc:mysql://" + dbHost + ":" + dbPort + "/" + dbName, dbUser, dbPassword );
|
||||
=======
|
||||
conn = DriverManager.getConnection( "jdbc:mysql://localhost:3306/"+dbName, dbUser, dbPassword );
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ import org.apache.log4j.Logger;
|
|||
|
||||
import com.cloud.bridge.util.ConfigurationHelper;
|
||||
|
||||
<<<<<<< HEAD
|
||||
|
||||
public class OfferingDao extends BaseDao {
|
||||
public static final Logger logger = Logger.getLogger(OfferingDao.class);
|
||||
|
|
@ -39,36 +38,6 @@ public class OfferingDao extends BaseDao {
|
|||
|
||||
public OfferingDao()
|
||||
{
|
||||
=======
|
||||
public class OfferingDao {
|
||||
public static final Logger logger = Logger.getLogger(OfferingDao.class);
|
||||
|
||||
private Connection conn = null;
|
||||
private String dbName = null;
|
||||
private String dbUser = null;
|
||||
private String dbPassword = null;
|
||||
|
||||
public OfferingDao()
|
||||
{
|
||||
File propertiesFile = ConfigurationHelper.findConfigurationFile("ec2-service.properties");
|
||||
Properties EC2Prop = null;
|
||||
|
||||
// The settings for the CLOUDBRIDGE database are shared with the EC2 API
|
||||
|
||||
if (null != propertiesFile) {
|
||||
EC2Prop = new Properties();
|
||||
try {
|
||||
EC2Prop.load( new FileInputStream( propertiesFile ));
|
||||
} catch (FileNotFoundException e) {
|
||||
logger.warn("Unable to open properties file: " + propertiesFile.getAbsolutePath(), e);
|
||||
} catch (IOException e) {
|
||||
logger.warn("Unable to read properties file: " + propertiesFile.getAbsolutePath(), e);
|
||||
}
|
||||
dbName = EC2Prop.getProperty( "dbName" );
|
||||
dbUser = EC2Prop.getProperty( "dbUser" );
|
||||
dbPassword = EC2Prop.getProperty( "dbPassword" );
|
||||
}
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
}
|
||||
|
||||
public int getOfferingCount()
|
||||
|
|
@ -186,11 +155,7 @@ public class OfferingDao {
|
|||
{
|
||||
if (null == conn) {
|
||||
Class.forName( "com.mysql.jdbc.Driver" ).newInstance();
|
||||
<<<<<<< HEAD
|
||||
conn = DriverManager.getConnection( "jdbc:mysql://" + dbHost + ":" + dbPort + "/" + awsapi_dbName, dbUser, dbPassword );
|
||||
=======
|
||||
conn = DriverManager.getConnection( "jdbc:mysql://localhost:3306/"+dbName, dbUser, dbPassword );
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,11 +23,7 @@ import com.cloud.bridge.persist.PersistContext;
|
|||
import com.cloud.bridge.service.core.s3.S3MetaDataEntry;
|
||||
|
||||
/**
|
||||
<<<<<<< HEAD
|
||||
* @author Kelven Yang
|
||||
=======
|
||||
* @author Kelven Yang, John Zucker
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
*/
|
||||
public class SMetaDao extends EntityDao<SMeta> {
|
||||
public SMetaDao() {
|
||||
|
|
@ -50,11 +46,7 @@ public class SMetaDao extends EntityDao<SMeta> {
|
|||
}
|
||||
|
||||
public void save(String target, long targetId, S3MetaDataEntry[] entries) {
|
||||
<<<<<<< HEAD
|
||||
// -> the target's meta data are being redefined
|
||||
=======
|
||||
// To redefine the target's metadaa
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
executeUpdate("delete from SMeta where target=? and targetId=?", new Object[] { target, new Long(targetId)});
|
||||
|
||||
if(entries != null) {
|
||||
|
|
|
|||
|
|
@ -15,32 +15,17 @@
|
|||
*/
|
||||
package com.cloud.bridge.persist.dao;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import java.sql.*;
|
||||
|
||||
=======
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.sql.*;
|
||||
import java.util.Properties;
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.bridge.model.UserCredentials;
|
||||
import com.cloud.bridge.service.exception.NoSuchObjectException;
|
||||
<<<<<<< HEAD
|
||||
|
||||
|
||||
public class UserCredentialsDao extends BaseDao {
|
||||
public static final Logger logger = Logger.getLogger(UserCredentialsDao.class);
|
||||
|
||||
private Connection conn = null;
|
||||
|
||||
public UserCredentialsDao() {
|
||||
=======
|
||||
import com.cloud.bridge.util.ConfigurationHelper;
|
||||
|
||||
|
||||
|
|
@ -73,7 +58,6 @@ public class UserCredentialsDao {
|
|||
dbUser = EC2Prop.getProperty( "dbUser" );
|
||||
dbPassword = EC2Prop.getProperty( "dbPassword" );
|
||||
}
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
}
|
||||
|
||||
public void setUserKeys( String cloudAccessKey, String cloudSecretKey )
|
||||
|
|
@ -175,11 +159,7 @@ public class UserCredentialsDao {
|
|||
throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException {
|
||||
if (null == conn) {
|
||||
Class.forName( "com.mysql.jdbc.Driver" ).newInstance();
|
||||
<<<<<<< HEAD
|
||||
conn = DriverManager.getConnection( "jdbc:mysql://" + dbHost + "/" + awsapi_dbName, dbUser, dbPassword );
|
||||
=======
|
||||
conn = DriverManager.getConnection( "jdbc:mysql://" + dbHost + "/" + dbName, dbUser, dbPassword );
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,11 +9,8 @@ import javax.servlet.http.HttpServlet;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.cloud.bridge.persist.PersistContext;
|
||||
import com.cloud.bridge.persist.dao.CloudStackConfigurationDao;
|
||||
=======
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
import com.cloud.bridge.persist.dao.UserCredentialsDao;
|
||||
import com.cloud.bridge.util.ConfigurationHelper;
|
||||
|
||||
|
|
@ -23,18 +20,14 @@ public class EC2MainServlet extends HttpServlet{
|
|||
|
||||
public static final String EC2_REST_SERVLET_PATH="/rest/AmazonEC2/";
|
||||
public static final String EC2_SOAP_SERVLET_PATH="/services/AmazonEC2/";
|
||||
<<<<<<< HEAD
|
||||
public static final String ENABLE_EC2_API="enable.ec2.api";
|
||||
private static boolean isEC2APIEnabled = false;
|
||||
=======
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
|
||||
/**
|
||||
* We build the path to where the keystore holding the WS-Security X509 certificates
|
||||
* are stored.
|
||||
*/
|
||||
public void init( ServletConfig config ) throws ServletException {
|
||||
<<<<<<< HEAD
|
||||
try{
|
||||
ConfigurationHelper.preConfigureConfigPathFromServletContext(config.getServletContext());
|
||||
UserCredentialsDao.preCheckTableExistence();
|
||||
|
|
@ -49,10 +42,6 @@ public class EC2MainServlet extends HttpServlet{
|
|||
PersistContext.closeSession(true);
|
||||
}
|
||||
|
||||
=======
|
||||
ConfigurationHelper.preConfigureConfigPathFromServletContext(config.getServletContext());
|
||||
UserCredentialsDao.preCheckTableExistence();
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
}
|
||||
|
||||
protected void doGet(HttpServletRequest req, HttpServletResponse resp) {
|
||||
|
|
@ -64,7 +53,6 @@ public class EC2MainServlet extends HttpServlet{
|
|||
}
|
||||
|
||||
protected void doGetOrPost(HttpServletRequest request, HttpServletResponse response) {
|
||||
<<<<<<< HEAD
|
||||
String action = request.getParameter( "Action" );
|
||||
|
||||
if(!isEC2APIEnabled){
|
||||
|
|
@ -72,10 +60,6 @@ public class EC2MainServlet extends HttpServlet{
|
|||
}
|
||||
|
||||
if(action != null){
|
||||
=======
|
||||
String action = request.getParameter( "Action" );
|
||||
if(action!=null){
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
//We presume it's a Query/Rest call
|
||||
try {
|
||||
RequestDispatcher dispatcher = request.getRequestDispatcher(EC2_REST_SERVLET_PATH);
|
||||
|
|
@ -97,4 +81,4 @@ public class EC2MainServlet extends HttpServlet{
|
|||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -22,9 +22,6 @@ package com.cloud.bridge.service;
|
|||
public interface S3Constants {
|
||||
public final String BUCKET_ATTR_KEY = "s3-bucket";
|
||||
public final String OBJECT_ATTR_KEY = "s3-object-key";
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
public final String PLAIN_POST_ACCESS_KEY = "s3-access-key";
|
||||
public final String PLAIN_POST_SIGNATURE = "s3-signature";
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,768 +1,3 @@
|
|||
<<<<<<< HEAD
|
||||
/*
|
||||
* Copyright (C) 2011 Citrix Systems, Inc. All rights reserved.
|
||||
*
|
||||
* Licensed 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.service;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.security.SignatureException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Enumeration;
|
||||
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.bind.*;
|
||||
|
||||
import org.apache.axis2.AxisFault;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import com.cloud.bridge.model.SAcl;
|
||||
import com.cloud.bridge.persist.PersistContext;
|
||||
import com.cloud.bridge.persist.dao.UserCredentialsDao;
|
||||
import com.cloud.bridge.service.controller.s3.S3BucketAction;
|
||||
import com.cloud.bridge.service.controller.s3.S3ObjectAction;
|
||||
import com.cloud.bridge.service.core.s3.S3AccessControlList;
|
||||
import com.cloud.bridge.service.core.s3.S3AuthParams;
|
||||
import com.cloud.bridge.service.core.s3.S3Engine;
|
||||
import com.cloud.bridge.service.core.s3.S3Grant;
|
||||
import com.cloud.bridge.service.core.s3.S3MetaDataEntry;
|
||||
import com.cloud.bridge.service.core.s3.S3PutObjectRequest;
|
||||
import com.cloud.bridge.service.core.s3.S3PutObjectResponse;
|
||||
import com.cloud.bridge.service.exception.InvalidBucketName;
|
||||
import com.cloud.bridge.service.exception.NoSuchObjectException;
|
||||
import com.cloud.bridge.service.exception.PermissionDeniedException;
|
||||
import com.cloud.bridge.util.AuthenticationUtils;
|
||||
import com.cloud.bridge.util.HeaderParam;
|
||||
import com.cloud.bridge.util.MultiPartDimeInputStream;
|
||||
import com.cloud.bridge.util.RestAuth;
|
||||
import com.cloud.bridge.util.S3SoapAuth;
|
||||
|
||||
/**
|
||||
* @author Kelven Yang, Mark Joseph
|
||||
*/
|
||||
public class S3RestServlet extends HttpServlet {
|
||||
private static final long serialVersionUID = -6168996266762804877L;
|
||||
|
||||
public static final Logger logger = Logger.getLogger(S3RestServlet.class);
|
||||
|
||||
protected void doGet(HttpServletRequest req, HttpServletResponse resp) {
|
||||
processRequest( req, resp, "GET" );
|
||||
}
|
||||
|
||||
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
|
||||
{
|
||||
// -> DIME requests are authenticated via the SOAP auth mechanism
|
||||
String type = req.getHeader( "Content-Type" );
|
||||
if ( null != type && type.equalsIgnoreCase( "application/dime" ))
|
||||
processDimeRequest(req, resp);
|
||||
else processRequest( req, resp, "POST" );
|
||||
}
|
||||
|
||||
protected void doPut(HttpServletRequest req, HttpServletResponse resp) {
|
||||
processRequest( req, resp, "PUT" );
|
||||
}
|
||||
|
||||
protected void doHead(HttpServletRequest req, HttpServletResponse resp) {
|
||||
processRequest( req, resp, "HEAD" );
|
||||
}
|
||||
|
||||
protected void doOptions(HttpServletRequest req, HttpServletResponse resp) {
|
||||
processRequest( req, resp, "OPTIONS" );
|
||||
}
|
||||
|
||||
protected void doDelete( HttpServletRequest req, HttpServletResponse resp ) {
|
||||
processRequest( req, resp, "DELETE" );
|
||||
}
|
||||
|
||||
/**
|
||||
* POST requests do not get authenticated on entry. The associated
|
||||
* access key and signature headers are embedded in the message not encoded
|
||||
* as HTTP headers.
|
||||
*/
|
||||
private void processRequest( HttpServletRequest request, HttpServletResponse response, String method )
|
||||
{
|
||||
try {
|
||||
logRequest(request);
|
||||
|
||||
// Our extensions to the S3 REST API for simple management actions
|
||||
// -> unauthenticated calls, should still be done over HTTPS
|
||||
String cloudAction = request.getParameter( "CloudAction" );
|
||||
if (null != cloudAction)
|
||||
{
|
||||
if (cloudAction.equalsIgnoreCase( "SetUserKeys" )) {
|
||||
setUserKeys(request, response);
|
||||
return;
|
||||
}
|
||||
|
||||
if (cloudAction.equalsIgnoreCase( "CloudS3Version" )) {
|
||||
cloudS3Version(request, response);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// -> authenticated calls
|
||||
if (!method.equalsIgnoreCase( "POST" )) {
|
||||
S3AuthParams params = extractRequestHeaders( request );
|
||||
authenticateRequest( request, params );
|
||||
}
|
||||
|
||||
ServletAction action = routeRequest(request);
|
||||
if ( action != null ) {
|
||||
action.execute(request, response);
|
||||
}
|
||||
else {
|
||||
response.setStatus(404);
|
||||
endResponse(response, "File not found");
|
||||
}
|
||||
|
||||
PersistContext.commitTransaction();
|
||||
|
||||
}
|
||||
catch( InvalidBucketName e) {
|
||||
logger.error("Unexpected exception " + e.getMessage(), e);
|
||||
response.setStatus(400);
|
||||
endResponse(response, "Invalid Bucket Name - " + e.toString());
|
||||
}
|
||||
catch(PermissionDeniedException e) {
|
||||
logger.error("Unexpected exception " + e.getMessage(), e);
|
||||
response.setStatus(403);
|
||||
endResponse(response, "Access denied - " + e.toString());
|
||||
}
|
||||
catch(Throwable e) {
|
||||
logger.error("Unexpected exception " + e.getMessage(), e);
|
||||
response.setStatus(500);
|
||||
endResponse(response, "Internal server error");
|
||||
|
||||
} finally {
|
||||
try {
|
||||
response.flushBuffer();
|
||||
} catch (IOException e) {
|
||||
logger.error("Unexpected exception " + e.getMessage(), e);
|
||||
}
|
||||
PersistContext.closeSession();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide an easy way to determine the version of the implementation running.
|
||||
*
|
||||
* This is an unauthenticated REST call.
|
||||
*/
|
||||
private void cloudS3Version( HttpServletRequest request, HttpServletResponse response ) {
|
||||
String version = new String( "<?xml version=\"1.0\" encoding=\"utf-8\"?><CloudS3Version>1.04</CloudS3Version>" );
|
||||
response.setStatus(200);
|
||||
endResponse(response, version);
|
||||
}
|
||||
|
||||
/**
|
||||
* This request registers the user Cloud.com account holder to the S3 service. The Cloud.com
|
||||
* account holder saves his API access and secret keys with the S3 service so that
|
||||
* each rest call he makes can be verified was originated from him. The given API access
|
||||
* and secret key are saved into the "usercredentials" database table.
|
||||
*
|
||||
* This is an unauthenticated REST call. The only required parameters are 'accesskey' and
|
||||
* 'secretkey'.
|
||||
*
|
||||
* To verify that the given keys represent an existing account they are used to execute the
|
||||
* Cloud.com's listAccounts API function. If the keys do not represent a valid account the
|
||||
* listAccounts function will fail.
|
||||
*
|
||||
* A user can call this REST function any number of times, on each call the Cloud.com secret
|
||||
* key is simply over writes any previously stored value.
|
||||
*
|
||||
* As with all REST calls HTTPS should be used to ensure their security.
|
||||
*/
|
||||
private void setUserKeys( HttpServletRequest request, HttpServletResponse response ) {
|
||||
String[] accessKey = null;
|
||||
String[] secretKey = null;
|
||||
|
||||
try {
|
||||
// -> all these parameters are required
|
||||
accessKey = request.getParameterValues( "accesskey" );
|
||||
if ( null == accessKey || 0 == accessKey.length ) {
|
||||
response.sendError(530, "Missing accesskey parameter" );
|
||||
return;
|
||||
}
|
||||
|
||||
secretKey = request.getParameterValues( "secretkey" );
|
||||
if ( null == secretKey || 0 == secretKey.length ) {
|
||||
response.sendError(530, "Missing secretkey parameter" );
|
||||
return;
|
||||
}
|
||||
} catch( Exception e ) {
|
||||
logger.error("SetUserKeys exception " + e.getMessage(), e);
|
||||
response.setStatus(500);
|
||||
endResponse(response, "SetUserKeys exception " + e.getMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
// -> use the keys to see if the account actually exists
|
||||
//ServiceProvider.getInstance().getEC2Engine().validateAccount( accessKey[0], secretKey[0] );
|
||||
UserCredentialsDao credentialDao = new UserCredentialsDao();
|
||||
credentialDao.setUserKeys( accessKey[0], secretKey[0] );
|
||||
|
||||
} catch( Exception e ) {
|
||||
logger.error("SetUserKeys " + e.getMessage(), e);
|
||||
response.setStatus(401);
|
||||
endResponse(response, e.toString());
|
||||
return;
|
||||
}
|
||||
response.setStatus(200);
|
||||
endResponse(response, "User keys set successfully");
|
||||
}
|
||||
|
||||
/**
|
||||
* We are using the S3AuthParams class to hide where the header values are coming
|
||||
* from so that the authenticateRequest call can be made from several places.
|
||||
*/
|
||||
public static S3AuthParams extractRequestHeaders( HttpServletRequest request ) {
|
||||
S3AuthParams params = new S3AuthParams();
|
||||
|
||||
Enumeration headers = request.getHeaderNames();
|
||||
if (null != headers)
|
||||
{
|
||||
while( headers.hasMoreElements())
|
||||
{
|
||||
HeaderParam oneHeader = new HeaderParam();
|
||||
String headerName = (String)headers.nextElement();
|
||||
oneHeader.setName( headerName );
|
||||
oneHeader.setValue( request.getHeader( headerName ));
|
||||
params.addHeader( oneHeader );
|
||||
}
|
||||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
public static void authenticateRequest( HttpServletRequest request, S3AuthParams params )
|
||||
throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException
|
||||
{
|
||||
RestAuth auth = new RestAuth(ServiceProvider.getInstance().getUseSubDomain());
|
||||
String AWSAccessKey = null;
|
||||
String signature = null;
|
||||
String authorization = null;
|
||||
|
||||
// [A] Is it an annonymous request?
|
||||
if (null == (authorization = params.getHeader( "Authorization" ))) {
|
||||
UserContext.current().initContext();
|
||||
return;
|
||||
}
|
||||
|
||||
// [B] Is it an authenticated request?
|
||||
int offset = authorization.indexOf( "AWS" );
|
||||
if (-1 != offset) {
|
||||
String temp = authorization.substring( offset+3 ).trim();
|
||||
offset = temp.indexOf( ":" );
|
||||
AWSAccessKey = temp.substring( 0, offset );
|
||||
signature = temp.substring( offset+1 );
|
||||
}
|
||||
|
||||
// [C] Calculate the signature from the request's headers
|
||||
auth.setDateHeader( request.getHeader( "Date" ));
|
||||
auth.setContentTypeHeader( request.getHeader( "Content-Type" ));
|
||||
auth.setContentMD5Header( request.getHeader( "Content-MD5" ));
|
||||
auth.setHostHeader( request.getHeader( "Host" ));
|
||||
auth.setQueryString( request.getQueryString());
|
||||
auth.addUriPath( request.getRequestURI());
|
||||
|
||||
// -> are their any Amazon specific (i.e. 'x-amz-' ) headers?
|
||||
HeaderParam[] headers = params.getHeaders();
|
||||
for( int i=0; null != headers && i < headers.length; i++ )
|
||||
{
|
||||
String headerName = headers[i].getName();
|
||||
String ignoreCase = headerName.toLowerCase();
|
||||
if (ignoreCase.startsWith( "x-amz-" ))
|
||||
auth.addAmazonHeader( headerName + ":" + headers[i].getValue());
|
||||
}
|
||||
|
||||
UserInfo info = ServiceProvider.getInstance().getUserInfo(AWSAccessKey);
|
||||
if (info == null) throw new PermissionDeniedException("Unable to authenticate access key: " + AWSAccessKey);
|
||||
|
||||
try {
|
||||
if (auth.verifySignature( request.getMethod(), info.getSecretKey(), signature )) {
|
||||
UserContext.current().initContext(AWSAccessKey, info.getSecretKey(), AWSAccessKey, info.getDescription(), request);
|
||||
return;
|
||||
}
|
||||
|
||||
// -> turn off auth - just for testing
|
||||
//UserContext.current().initContext("Mark", "123", "Mark", "testing", request);
|
||||
//return;
|
||||
|
||||
} catch (SignatureException e) {
|
||||
throw new PermissionDeniedException(e);
|
||||
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
throw new PermissionDeniedException(e);
|
||||
}
|
||||
throw new PermissionDeniedException("Invalid signature");
|
||||
}
|
||||
|
||||
|
||||
private ServletAction routeRequest(HttpServletRequest request)
|
||||
{
|
||||
// Simple URL routing for S3 REST calls.
|
||||
String pathInfo = request.getPathInfo();
|
||||
String bucketName = null;
|
||||
String key = null;
|
||||
|
||||
if (ServiceProvider.getInstance().getUseSubDomain())
|
||||
{
|
||||
String serviceEndpoint = ServiceProvider.getInstance().getServiceEndpoint();
|
||||
String host = request.getHeader("Host");
|
||||
|
||||
// -> a request of "/" on the service endpoint means do a list all my buckets command
|
||||
if (serviceEndpoint.equalsIgnoreCase( host )) {
|
||||
request.setAttribute(S3Constants.BUCKET_ATTR_KEY, "/");
|
||||
return new S3BucketAction();
|
||||
}
|
||||
|
||||
// -> verify the format of the bucket name
|
||||
int endPos = host.indexOf( ServiceProvider.getInstance().getMasterDomain());
|
||||
if ( endPos > 0 )
|
||||
{
|
||||
bucketName = host.substring(0, endPos);
|
||||
S3Engine.verifyBucketName( bucketName, false );
|
||||
request.setAttribute(S3Constants.BUCKET_ATTR_KEY, bucketName);
|
||||
}
|
||||
else request.setAttribute(S3Constants.BUCKET_ATTR_KEY, "");
|
||||
|
||||
if (pathInfo == null || pathInfo.equalsIgnoreCase("/"))
|
||||
{
|
||||
return new S3BucketAction();
|
||||
}
|
||||
else {
|
||||
String objectKey = pathInfo.substring(1);
|
||||
request.setAttribute(S3Constants.OBJECT_ATTR_KEY, objectKey);
|
||||
return new S3ObjectAction();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(pathInfo == null || pathInfo.equalsIgnoreCase("/")) {
|
||||
logger.warn("Invalid REST request URI " + pathInfo);
|
||||
return null;
|
||||
}
|
||||
|
||||
int endPos = pathInfo.indexOf('/', 1);
|
||||
if ( endPos > 0 )
|
||||
{
|
||||
bucketName = pathInfo.substring(1, endPos);
|
||||
key = pathInfo.substring(endPos + 1);
|
||||
S3Engine.verifyBucketName( bucketName, false );
|
||||
|
||||
if (!key.isEmpty())
|
||||
{
|
||||
request.setAttribute(S3Constants.BUCKET_ATTR_KEY, bucketName);
|
||||
request.setAttribute(S3Constants.OBJECT_ATTR_KEY, pathInfo.substring(endPos + 1));
|
||||
return new S3ObjectAction();
|
||||
}
|
||||
else {
|
||||
request.setAttribute(S3Constants.BUCKET_ATTR_KEY, bucketName);
|
||||
return new S3BucketAction();
|
||||
}
|
||||
}
|
||||
else {
|
||||
String bucket = pathInfo.substring(1);
|
||||
request.setAttribute(S3Constants.BUCKET_ATTR_KEY, bucket);
|
||||
return new S3BucketAction();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void endResponse(HttpServletResponse response, String content) {
|
||||
try {
|
||||
byte[] data = content.getBytes();
|
||||
response.setContentLength(data.length);
|
||||
OutputStream os = response.getOutputStream();
|
||||
os.write(data);
|
||||
os.close();
|
||||
} catch(Throwable e) {
|
||||
logger.error("Unexpected exception " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void writeResponse(HttpServletResponse response, String content) throws IOException {
|
||||
byte[] data = content.getBytes();
|
||||
OutputStream os = response.getOutputStream();
|
||||
os.write(data);
|
||||
}
|
||||
|
||||
public static void writeResponse(HttpServletResponse response, InputStream is) throws IOException {
|
||||
byte[] data = new byte[4096];
|
||||
int length = 0;
|
||||
while((length = is.read(data)) > 0) {
|
||||
response.getOutputStream().write(data, 0, length);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A DIME request is really a SOAP request that we are dealing with, and so its
|
||||
* authentication is the SOAP authentication approach. Since Axis2 does not handle
|
||||
* DIME messages we deal with them here.
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
private void processDimeRequest(HttpServletRequest request, HttpServletResponse response) {
|
||||
S3PutObjectRequest putRequest = null;
|
||||
S3PutObjectResponse putResponse = null;
|
||||
int bytesRead = 0;
|
||||
|
||||
S3Engine engine = new S3Engine();
|
||||
|
||||
try {
|
||||
logRequest(request);
|
||||
|
||||
MultiPartDimeInputStream ds = new MultiPartDimeInputStream( request.getInputStream());
|
||||
|
||||
// -> the first stream MUST be the SOAP party
|
||||
if (ds.nextInputStream())
|
||||
{
|
||||
//logger.debug( "DIME msg [" + ds.getStreamType() + "," + ds.getStreamTypeFormat() + "," + ds.getStreamId() + "]" );
|
||||
byte[] buffer = new byte[8192];
|
||||
bytesRead = ds.read( buffer, 0, 8192 );
|
||||
//logger.debug( "DIME SOAP Bytes read: " + bytesRead );
|
||||
ByteArrayInputStream bis = new ByteArrayInputStream( buffer, 0, bytesRead );
|
||||
putRequest = toEnginePutObjectRequest( bis );
|
||||
}
|
||||
|
||||
// -> we only need to support a DIME message with two bodyparts
|
||||
if (null != putRequest && ds.nextInputStream())
|
||||
{
|
||||
InputStream is = ds.getInputStream();
|
||||
putRequest.setData( is );
|
||||
}
|
||||
|
||||
// -> need to do SOAP level auth here, on failure return the SOAP fault
|
||||
StringBuffer xml = new StringBuffer();
|
||||
String AWSAccessKey = putRequest.getAccessKey();
|
||||
UserInfo info = ServiceProvider.getInstance().getUserInfo(AWSAccessKey);
|
||||
try
|
||||
{ S3SoapAuth.verifySignature( putRequest.getSignature(), "PutObject", putRequest.getRawTimestamp(), AWSAccessKey, info.getSecretKey());
|
||||
|
||||
} catch( AxisFault e ) {
|
||||
String reason = e.toString();
|
||||
int start = reason.indexOf( ".AxisFault:" );
|
||||
if (-1 != start) reason = reason.substring( start+11 );
|
||||
|
||||
xml.append( "<?xml version=\"1.0\" encoding=\"utf-8\"?>" );
|
||||
xml.append( "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" >\n" );
|
||||
xml.append( "<soap:Body>\n" );
|
||||
xml.append( "<soap:Fault>\n" );
|
||||
xml.append( "<faultcode>" ).append( e.getFaultCode().toString()).append( "</faultcode>\n" );
|
||||
xml.append( "<faultstring>" ).append( reason ).append( "</faultstring>\n" );
|
||||
xml.append( "</soap:Fault>\n" );
|
||||
xml.append( "</soap:Body></soap:Envelope>" );
|
||||
|
||||
endResponse(response, xml.toString());
|
||||
PersistContext.commitTransaction();
|
||||
return;
|
||||
}
|
||||
|
||||
// -> PutObject S3 Bucket Policy would be done in the engine.handleRequest() call
|
||||
UserContext.current().initContext( AWSAccessKey, info.getSecretKey(), AWSAccessKey, "S3 DIME request", request );
|
||||
putResponse = engine.handleRequest( putRequest );
|
||||
|
||||
xml.append( "<?xml version=\"1.0\" encoding=\"utf-8\"?>" );
|
||||
xml.append( "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:tns=\"http://s3.amazonaws.com/doc/2006-03-01/\">" );
|
||||
xml.append( "<soap:Body>" );
|
||||
xml.append( "<tns:PutObjectResponse>" );
|
||||
xml.append( "<tns:PutObjectResponse>" );
|
||||
xml.append( "<tns:ETag>\"").append( putResponse.getETag()).append( "\"</tns:ETag>" );
|
||||
xml.append( "<tns:LastModified>").append( DatatypeConverter.printDateTime(putResponse.getLastModified())).append( "</tns:LastModified>" );
|
||||
xml.append( "</tns:PutObjectResponse></tns:PutObjectResponse>" );
|
||||
xml.append( "</soap:Body></soap:Envelope>" );
|
||||
|
||||
endResponse(response, xml.toString());
|
||||
PersistContext.commitTransaction();
|
||||
}
|
||||
catch(PermissionDeniedException e) {
|
||||
logger.error("Unexpected exception " + e.getMessage(), e);
|
||||
response.setStatus(403);
|
||||
endResponse(response, "Access denied");
|
||||
}
|
||||
catch(Throwable e)
|
||||
{
|
||||
logger.error("Unexpected exception " + e.getMessage(), e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
PersistContext.closeSession();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert the SOAP XML we extract from the DIME message into our local object.
|
||||
* Here Axis2 is not parsing the SOAP for us. I tried to use the Amazon PutObject
|
||||
* parser but it keep throwing exceptions.
|
||||
*
|
||||
* @param putObjectInline
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static S3PutObjectRequest toEnginePutObjectRequest( InputStream is ) throws Exception
|
||||
{
|
||||
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
|
||||
dbf.setNamespaceAware( true );
|
||||
|
||||
DocumentBuilder db = dbf.newDocumentBuilder();
|
||||
Document doc = db.parse( is );
|
||||
Node parent = null;
|
||||
Node contents = null;
|
||||
NodeList children = null;
|
||||
String temp = null;
|
||||
String element = null;
|
||||
int count = 0;
|
||||
|
||||
S3PutObjectRequest request = new S3PutObjectRequest();
|
||||
|
||||
// [A] Pull out the simple nodes first
|
||||
NodeList part = getElement( doc, "http://s3.amazonaws.com/doc/2006-03-01/", "Bucket" );
|
||||
if (null != part)
|
||||
{
|
||||
if (null != (contents = part.item( 0 )))
|
||||
request.setBucketName( contents.getFirstChild().getNodeValue());
|
||||
}
|
||||
part = getElement( doc, "http://s3.amazonaws.com/doc/2006-03-01/", "Key" );
|
||||
if (null != part)
|
||||
{
|
||||
if (null != (contents = part.item( 0 )))
|
||||
request.setKey( contents.getFirstChild().getNodeValue());
|
||||
}
|
||||
part = getElement( doc, "http://s3.amazonaws.com/doc/2006-03-01/", "ContentLength" );
|
||||
if (null != part)
|
||||
{
|
||||
if (null != (contents = part.item( 0 )))
|
||||
{
|
||||
String length = contents.getFirstChild().getNodeValue();
|
||||
if (null != length) request.setContentLength( Long.decode( length ));
|
||||
}
|
||||
}
|
||||
part = getElement( doc, "http://s3.amazonaws.com/doc/2006-03-01/", "AWSAccessKeyId" );
|
||||
if (null != part)
|
||||
{
|
||||
if (null != (contents = part.item( 0 )))
|
||||
request.setAccessKey( contents.getFirstChild().getNodeValue());
|
||||
}
|
||||
part = getElement( doc, "http://s3.amazonaws.com/doc/2006-03-01/", "Signature" );
|
||||
if (null != part)
|
||||
{
|
||||
if (null != (contents = part.item( 0 )))
|
||||
request.setSignature( contents.getFirstChild().getNodeValue());
|
||||
}
|
||||
part = getElement( doc, "http://s3.amazonaws.com/doc/2006-03-01/", "Timestamp" );
|
||||
if (null != part)
|
||||
{
|
||||
if (null != (contents = part.item( 0 )))
|
||||
request.setRawTimestamp( contents.getFirstChild().getNodeValue());
|
||||
}
|
||||
part = getElement( doc, "http://s3.amazonaws.com/doc/2006-03-01/", "StorageClass" );
|
||||
if (null != part)
|
||||
{
|
||||
if (null != (contents = part.item( 0 )))
|
||||
request.setStorageClass( contents.getFirstChild().getNodeValue());
|
||||
}
|
||||
part = getElement( doc, "http://s3.amazonaws.com/doc/2006-03-01/", "Credential" );
|
||||
if (null != part)
|
||||
{
|
||||
if (null != (contents = part.item( 0 )))
|
||||
request.setCredential( contents.getFirstChild().getNodeValue());
|
||||
}
|
||||
|
||||
|
||||
// [B] Get a list of all 'Metadata' elements
|
||||
part = getElement( doc, "http://s3.amazonaws.com/doc/2006-03-01/", "Metadata" );
|
||||
if (null != part)
|
||||
{
|
||||
count = part.getLength();
|
||||
S3MetaDataEntry[] metaEntry = new S3MetaDataEntry[ count ];
|
||||
|
||||
for( int i=0; i < count; i++ )
|
||||
{
|
||||
parent = part.item(i);
|
||||
metaEntry[i] = new S3MetaDataEntry();
|
||||
|
||||
// -> get a list of all the children elements of the 'Metadata' parent element
|
||||
if (null != (children = parent.getChildNodes()))
|
||||
{
|
||||
int numChildren = children.getLength();
|
||||
for( int j=0; j < numChildren; j++ )
|
||||
{
|
||||
contents = children.item( j );
|
||||
element = contents.getNodeName().trim();
|
||||
if ( element.endsWith( "Name" ))
|
||||
{
|
||||
temp = contents.getFirstChild().getNodeValue();
|
||||
if (null != temp) metaEntry[i].setName( temp );
|
||||
}
|
||||
else if (element.endsWith( "Value" ))
|
||||
{
|
||||
temp = contents.getFirstChild().getNodeValue();
|
||||
if (null != temp) metaEntry[i].setValue( temp );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
request.setMetaEntries( metaEntry );
|
||||
}
|
||||
|
||||
// [C] Get a list of all Grant elements in an AccessControlList
|
||||
part = getElement( doc, "http://s3.amazonaws.com/doc/2006-03-01/", "Grant" );
|
||||
if (null != part)
|
||||
{
|
||||
S3AccessControlList engineAcl = new S3AccessControlList();
|
||||
|
||||
count = part.getLength();
|
||||
for( int i=0; i < count; i++ )
|
||||
{
|
||||
parent = part.item(i);
|
||||
S3Grant engineGrant = new S3Grant();
|
||||
|
||||
// -> get a list of all the children elements of the 'Grant' parent element
|
||||
if (null != (children = parent.getChildNodes()))
|
||||
{
|
||||
int numChildren = children.getLength();
|
||||
for( int j=0; j < numChildren; j++ )
|
||||
{
|
||||
contents = children.item( j );
|
||||
element = contents.getNodeName().trim();
|
||||
if ( element.endsWith( "Grantee" ))
|
||||
{
|
||||
NamedNodeMap attbs = contents.getAttributes();
|
||||
if (null != attbs)
|
||||
{
|
||||
Node type = attbs.getNamedItemNS( "http://www.w3.org/2001/XMLSchema-instance", "type" );
|
||||
if ( null != type )
|
||||
temp = type.getFirstChild().getNodeValue().trim();
|
||||
else temp = null;
|
||||
|
||||
if ( null != temp && temp.equalsIgnoreCase( "CanonicalUser" ))
|
||||
{
|
||||
engineGrant.setGrantee(SAcl.GRANTEE_USER);
|
||||
engineGrant.setCanonicalUserID( getChildNodeValue( contents, "ID" ));
|
||||
}
|
||||
else throw new UnsupportedOperationException( "Missing http://www.w3.org/2001/XMLSchema-instance:type value" );
|
||||
}
|
||||
}
|
||||
else if (element.endsWith( "Permission" ))
|
||||
{
|
||||
temp = contents.getFirstChild().getNodeValue().trim();
|
||||
if (temp.equalsIgnoreCase("READ" )) engineGrant.setPermission(SAcl.PERMISSION_READ);
|
||||
else if (temp.equalsIgnoreCase("WRITE" )) engineGrant.setPermission(SAcl.PERMISSION_WRITE);
|
||||
else if (temp.equalsIgnoreCase("READ_ACP" )) engineGrant.setPermission(SAcl.PERMISSION_READ_ACL);
|
||||
else if (temp.equalsIgnoreCase("WRITE_ACP" )) engineGrant.setPermission(SAcl.PERMISSION_WRITE_ACL);
|
||||
else if (temp.equalsIgnoreCase("FULL_CONTROL")) engineGrant.setPermission(SAcl.PERMISSION_FULL);
|
||||
else throw new UnsupportedOperationException( "Unsupported permission: " + temp );
|
||||
}
|
||||
}
|
||||
engineAcl.addGrant( engineGrant );
|
||||
}
|
||||
}
|
||||
request.setAcl( engineAcl );
|
||||
}
|
||||
return request;
|
||||
}
|
||||
|
||||
/**
|
||||
* Have to deal with XML with and without namespaces.
|
||||
*/
|
||||
public static NodeList getElement( Document doc, String namespace, String tagName )
|
||||
{
|
||||
NodeList part = doc.getElementsByTagNameNS( namespace, tagName );
|
||||
if (null == part || 0 == part.getLength()) part = doc.getElementsByTagName( tagName );
|
||||
|
||||
return part;
|
||||
}
|
||||
|
||||
/**
|
||||
* Looking for the value of a specific child of the given parent node.
|
||||
*
|
||||
* @param parent
|
||||
* @param childName
|
||||
* @return
|
||||
*/
|
||||
private static String getChildNodeValue( Node parent, String childName )
|
||||
{
|
||||
NodeList children = null;
|
||||
Node element = null;
|
||||
|
||||
if (null != (children = parent.getChildNodes()))
|
||||
{
|
||||
int numChildren = children.getLength();
|
||||
for( int i=0; i < numChildren; i++ )
|
||||
{
|
||||
if (null != (element = children.item( i )))
|
||||
{
|
||||
// -> name may have a namespace on it
|
||||
String name = element.getNodeName().trim();
|
||||
if ( name.endsWith( childName ))
|
||||
{
|
||||
String value = element.getFirstChild().getNodeValue();
|
||||
if (null != value) value = value.trim();
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void logRequest(HttpServletRequest request) {
|
||||
if(logger.isInfoEnabled()) {
|
||||
logger.info("Request method: " + request.getMethod());
|
||||
logger.info("Request contextPath: " + request.getContextPath());
|
||||
logger.info("Request pathInfo: " + request.getPathInfo());
|
||||
logger.info("Request pathTranslated: " + request.getPathTranslated());
|
||||
logger.info("Request queryString: " + request.getQueryString());
|
||||
logger.info("Request requestURI: " + request.getRequestURI());
|
||||
logger.info("Request requestURL: " + request.getRequestURL());
|
||||
logger.info("Request servletPath: " + request.getServletPath());
|
||||
Enumeration headers = request.getHeaderNames();
|
||||
if(headers != null) {
|
||||
while(headers.hasMoreElements()) {
|
||||
Object headerName = headers.nextElement();
|
||||
logger.info("Request header " + headerName + ":" + request.getHeader((String)headerName));
|
||||
}
|
||||
}
|
||||
|
||||
Enumeration params = request.getParameterNames();
|
||||
if(params != null) {
|
||||
while(params.hasMoreElements()) {
|
||||
Object paramName = params.nextElement();
|
||||
logger.info("Request parameter " + paramName + ":" +
|
||||
request.getParameter((String)paramName));
|
||||
}
|
||||
}
|
||||
logger.info( "- End of request -" );
|
||||
}
|
||||
}
|
||||
}
|
||||
=======
|
||||
/*
|
||||
* Copyright (C) 2011 Citrix Systems, Inc. All rights reserved.
|
||||
*
|
||||
|
|
@ -1600,5 +835,4 @@ private S3ObjectAction routePlainPostRequest (HttpServletRequest request)
|
|||
logger.info( "- End of request -" );
|
||||
}
|
||||
}
|
||||
}
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
}
|
||||
|
|
@ -33,11 +33,7 @@ public class UserContext {
|
|||
private boolean annonymous = false;
|
||||
private String accessKey;
|
||||
private String secretKey;
|
||||
<<<<<<< HEAD
|
||||
private String canonicalUserId; // -> for us this is the accessKey
|
||||
=======
|
||||
private String canonicalUserId; // In our design, we re-use the accessKey to provide the canonicalUserId -- TODO loPri - reconsider?
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
private String description;
|
||||
private HttpServletRequest request = null;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,919 +1,3 @@
|
|||
<<<<<<< HEAD
|
||||
/*
|
||||
* Copyright (C) 2011 Citrix Systems, Inc. All rights reserved.
|
||||
*
|
||||
* Licensed 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.service.controller.s3;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.io.Reader;
|
||||
import java.io.StringWriter;
|
||||
import java.io.Writer;
|
||||
import java.util.Calendar;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.xml.bind.DatatypeConverter;
|
||||
import javax.xml.namespace.QName;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.stream.XMLOutputFactory;
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
import javax.xml.stream.XMLStreamWriter;
|
||||
|
||||
import org.apache.axiom.om.OMAbstractFactory;
|
||||
import org.apache.axiom.om.OMFactory;
|
||||
import org.apache.axis2.databinding.utils.writer.MTOMAwareXMLSerializer;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.json.simple.parser.ParseException;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import com.amazon.s3.GetBucketAccessControlPolicyResponse;
|
||||
import com.amazon.s3.ListAllMyBucketsResponse;
|
||||
import com.amazon.s3.ListBucketResponse;
|
||||
import com.cloud.bridge.model.SAcl;
|
||||
import com.cloud.bridge.model.SBucket;
|
||||
import com.cloud.bridge.persist.dao.BucketPolicyDao;
|
||||
import com.cloud.bridge.persist.dao.MultipartLoadDao;
|
||||
import com.cloud.bridge.persist.dao.SBucketDao;
|
||||
import com.cloud.bridge.service.S3Constants;
|
||||
import com.cloud.bridge.service.S3RestServlet;
|
||||
import com.cloud.bridge.service.S3SoapServiceImpl;
|
||||
import com.cloud.bridge.service.ServiceProvider;
|
||||
import com.cloud.bridge.service.ServletAction;
|
||||
import com.cloud.bridge.service.UserContext;
|
||||
import com.cloud.bridge.service.core.s3.S3AccessControlPolicy;
|
||||
import com.cloud.bridge.service.core.s3.S3BucketPolicy;
|
||||
import com.cloud.bridge.service.core.s3.S3CanonicalUser;
|
||||
import com.cloud.bridge.service.core.s3.S3CreateBucketConfiguration;
|
||||
import com.cloud.bridge.service.core.s3.S3CreateBucketRequest;
|
||||
import com.cloud.bridge.service.core.s3.S3CreateBucketResponse;
|
||||
import com.cloud.bridge.service.core.s3.S3DeleteBucketRequest;
|
||||
import com.cloud.bridge.service.core.s3.S3Engine;
|
||||
import com.cloud.bridge.service.core.s3.S3GetBucketAccessControlPolicyRequest;
|
||||
import com.cloud.bridge.service.core.s3.S3ListAllMyBucketsRequest;
|
||||
import com.cloud.bridge.service.core.s3.S3ListAllMyBucketsResponse;
|
||||
import com.cloud.bridge.service.core.s3.S3ListBucketObjectEntry;
|
||||
import com.cloud.bridge.service.core.s3.S3ListBucketRequest;
|
||||
import com.cloud.bridge.service.core.s3.S3ListBucketResponse;
|
||||
import com.cloud.bridge.service.core.s3.S3MultipartUpload;
|
||||
import com.cloud.bridge.service.core.s3.S3PolicyContext;
|
||||
import com.cloud.bridge.service.core.s3.S3PutObjectRequest;
|
||||
import com.cloud.bridge.service.core.s3.S3Response;
|
||||
import com.cloud.bridge.service.core.s3.S3SetBucketAccessControlPolicyRequest;
|
||||
import com.cloud.bridge.service.core.s3.S3BucketPolicy.PolicyAccess;
|
||||
import com.cloud.bridge.service.core.s3.S3PolicyAction.PolicyActions;
|
||||
import com.cloud.bridge.service.core.s3.S3PolicyCondition.ConditionKeys;
|
||||
import com.cloud.bridge.service.exception.InvalidRequestContentException;
|
||||
import com.cloud.bridge.service.exception.NetworkIOException;
|
||||
import com.cloud.bridge.service.exception.PermissionDeniedException;
|
||||
import com.cloud.bridge.util.Converter;
|
||||
import com.cloud.bridge.util.PolicyParser;
|
||||
import com.cloud.bridge.util.StringHelper;
|
||||
import com.cloud.bridge.util.Tuple;
|
||||
import com.cloud.bridge.util.XSerializer;
|
||||
import com.cloud.bridge.util.XSerializerXmlAdapter;
|
||||
|
||||
|
||||
/**
|
||||
* @author Kelven Yang
|
||||
*/
|
||||
public class S3BucketAction implements ServletAction {
|
||||
protected final static Logger logger = Logger.getLogger(S3BucketAction.class);
|
||||
|
||||
private DocumentBuilderFactory dbf = null;
|
||||
private OMFactory factory = OMAbstractFactory.getOMFactory();
|
||||
private XMLOutputFactory xmlOutFactory = XMLOutputFactory.newInstance();
|
||||
|
||||
public S3BucketAction() {
|
||||
dbf = DocumentBuilderFactory.newInstance();
|
||||
dbf.setNamespaceAware( true );
|
||||
|
||||
}
|
||||
|
||||
public void execute(HttpServletRequest request, HttpServletResponse response)
|
||||
throws IOException, XMLStreamException
|
||||
{
|
||||
String method = request.getMethod();
|
||||
String queryString = request.getQueryString();
|
||||
|
||||
if ( method.equalsIgnoreCase("PUT"))
|
||||
{
|
||||
if ( queryString != null && queryString.length() > 0 )
|
||||
{
|
||||
if ( queryString.startsWith("acl")) {
|
||||
executePutBucketAcl(request, response);
|
||||
return;
|
||||
}
|
||||
else if (queryString.startsWith("versioning")) {
|
||||
executePutBucketVersioning(request, response);
|
||||
return;
|
||||
}
|
||||
else if (queryString.startsWith("policy")) {
|
||||
executePutBucketPolicy(request, response);
|
||||
return;
|
||||
}
|
||||
else if (queryString.startsWith("logging")) {
|
||||
executePutBucketLogging(request, response);
|
||||
return;
|
||||
}
|
||||
else if (queryString.startsWith("website")) {
|
||||
executePutBucketWebsite(request, response);
|
||||
return;
|
||||
}
|
||||
}
|
||||
executePutBucket(request, response);
|
||||
}
|
||||
else if(method.equalsIgnoreCase("GET"))
|
||||
{
|
||||
if (queryString != null && queryString.length() > 0)
|
||||
{
|
||||
if ( queryString.startsWith("acl")) {
|
||||
executeGetBucketAcl(request, response);
|
||||
return;
|
||||
}
|
||||
else if (queryString.startsWith("versioning")) {
|
||||
executeGetBucketVersioning(request, response);
|
||||
return;
|
||||
}
|
||||
else if (queryString.contains("versions")) {
|
||||
executeGetBucketObjectVersions(request, response);
|
||||
return;
|
||||
}
|
||||
else if (queryString.startsWith("location")) {
|
||||
executeGetBucketLocation(request, response);
|
||||
return;
|
||||
}
|
||||
else if (queryString.startsWith("uploads")) {
|
||||
executeListMultipartUploads(request, response);
|
||||
return;
|
||||
}
|
||||
else if (queryString.startsWith("policy")) {
|
||||
executeGetBucketPolicy(request, response);
|
||||
return;
|
||||
}
|
||||
else if (queryString.startsWith("logging")) {
|
||||
executeGetBucketLogging(request, response);
|
||||
return;
|
||||
}
|
||||
else if (queryString.startsWith("website")) {
|
||||
executeGetBucketWebsite(request, response);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
String bucketAtr = (String)request.getAttribute(S3Constants.BUCKET_ATTR_KEY);
|
||||
if ( bucketAtr.equals( "/" ))
|
||||
executeGetAllBuckets(request, response);
|
||||
else executeGetBucket(request, response);
|
||||
}
|
||||
else if (method.equalsIgnoreCase("DELETE"))
|
||||
{
|
||||
if (queryString != null && queryString.length() > 0)
|
||||
{
|
||||
if ( queryString.startsWith("policy")) {
|
||||
executeDeleteBucketPolicy(request, response);
|
||||
return;
|
||||
}
|
||||
else if (queryString.startsWith("website")) {
|
||||
executeDeleteBucketWebsite(request, response);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
executeDeleteBucket(request, response);
|
||||
}
|
||||
else throw new IllegalArgumentException("Unsupported method in REST request");
|
||||
}
|
||||
|
||||
/**
|
||||
* In order to support a policy on the "s3:CreateBucket" action we must be able to set and get
|
||||
* policies before a bucket is actually created.
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @throws IOException
|
||||
*/
|
||||
private void executePutBucketPolicy(HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
{
|
||||
String bucketName = (String)request.getAttribute(S3Constants.BUCKET_ATTR_KEY);
|
||||
String policy = streamToString( request.getInputStream());
|
||||
|
||||
// [A] Is there an owner of an existing policy or bucket?
|
||||
BucketPolicyDao policyDao = new BucketPolicyDao();
|
||||
SBucketDao bucketDao = new SBucketDao();
|
||||
SBucket bucket = bucketDao.getByName( bucketName );
|
||||
String owner = null;
|
||||
|
||||
if ( null != bucket )
|
||||
{
|
||||
owner = bucket.getOwnerCanonicalId();
|
||||
}
|
||||
else
|
||||
{ try {
|
||||
owner = policyDao.getPolicyOwner( bucketName );
|
||||
}
|
||||
catch( Exception e ) {}
|
||||
}
|
||||
|
||||
|
||||
// [B] "The bucket owner by default has permissions to attach bucket policies to their buckets using PUT Bucket policy."
|
||||
// -> the bucket owner may want to restrict the IP address from where this can be executed
|
||||
String client = UserContext.current().getCanonicalUserId();
|
||||
S3PolicyContext context = new S3PolicyContext( PolicyActions.PutBucketPolicy, bucketName );
|
||||
switch( S3Engine.verifyPolicy( context )) {
|
||||
case ALLOW:
|
||||
break;
|
||||
|
||||
case DEFAULT_DENY:
|
||||
if (null != owner && !client.equals( owner )) {
|
||||
response.setStatus(405);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case DENY:
|
||||
response.setStatus(403);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// [B] Place the policy into the database over writting an existing policy
|
||||
try {
|
||||
// -> first make sure that the policy is valid by parsing it
|
||||
PolicyParser parser = new PolicyParser();
|
||||
S3BucketPolicy sbp = parser.parse( policy, bucketName );
|
||||
|
||||
policyDao.deletePolicy( bucketName );
|
||||
if (null != policy && !policy.isEmpty()) policyDao.addPolicy( bucketName, client, policy );
|
||||
|
||||
if (null != sbp) ServiceProvider.getInstance().setBucketPolicy( bucketName, sbp );
|
||||
response.setStatus(200);
|
||||
}
|
||||
catch( PermissionDeniedException e ) {
|
||||
logger.error("Put Bucket Policy failed due to " + e.getMessage(), e);
|
||||
throw e;
|
||||
}
|
||||
catch( ParseException e ) {
|
||||
logger.error("Put Bucket Policy failed due to " + e.getMessage(), e);
|
||||
throw new PermissionDeniedException( e.toString());
|
||||
}
|
||||
catch( Exception e ) {
|
||||
logger.error("Put Bucket Policy failed due to " + e.getMessage(), e);
|
||||
response.setStatus(500);
|
||||
}
|
||||
}
|
||||
|
||||
private void executeGetBucketPolicy(HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
String bucketName = (String)request.getAttribute(S3Constants.BUCKET_ATTR_KEY);
|
||||
|
||||
// [A] Is there an owner of an existing policy or bucket?
|
||||
BucketPolicyDao policyDao = new BucketPolicyDao();
|
||||
SBucketDao bucketDao = new SBucketDao();
|
||||
SBucket bucket = bucketDao.getByName( bucketName );
|
||||
String owner = null;
|
||||
|
||||
if ( null != bucket )
|
||||
{
|
||||
owner = bucket.getOwnerCanonicalId();
|
||||
}
|
||||
else
|
||||
{ try {
|
||||
owner = policyDao.getPolicyOwner( bucketName );
|
||||
}
|
||||
catch( Exception e ) {}
|
||||
}
|
||||
|
||||
|
||||
// [B] "The bucket owner by default has permissions to retrieve bucket policies using GET Bucket policy."
|
||||
// -> the bucket owner may want to restrict the IP address from where this can be executed
|
||||
String client = UserContext.current().getCanonicalUserId();
|
||||
S3PolicyContext context = new S3PolicyContext( PolicyActions.GetBucketPolicy, bucketName );
|
||||
switch( S3Engine.verifyPolicy( context )) {
|
||||
case ALLOW:
|
||||
break;
|
||||
|
||||
case DEFAULT_DENY:
|
||||
if (null != owner && !client.equals( owner )) {
|
||||
response.setStatus(405);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case DENY:
|
||||
response.setStatus(403);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// [B] Pull the policy from the database if one exists
|
||||
try {
|
||||
String policy = policyDao.getPolicy( bucketName );
|
||||
if ( null == policy ) {
|
||||
response.setStatus(404);
|
||||
}
|
||||
else {
|
||||
response.setStatus(200);
|
||||
response.setContentType("application/json");
|
||||
S3RestServlet.endResponse(response, policy);
|
||||
}
|
||||
}
|
||||
catch( Exception e ) {
|
||||
logger.error("Get Bucket Policy failed due to " + e.getMessage(), e);
|
||||
response.setStatus(500);
|
||||
}
|
||||
}
|
||||
|
||||
private void executeDeleteBucketPolicy(HttpServletRequest request, HttpServletResponse response)
|
||||
{
|
||||
String bucketName = (String)request.getAttribute(S3Constants.BUCKET_ATTR_KEY);
|
||||
|
||||
SBucketDao bucketDao = new SBucketDao();
|
||||
SBucket bucket = bucketDao.getByName( bucketName );
|
||||
if (bucket != null)
|
||||
{
|
||||
String client = UserContext.current().getCanonicalUserId();
|
||||
if (!client.equals( bucket.getOwnerCanonicalId())) {
|
||||
response.setStatus(405);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
BucketPolicyDao policyDao = new BucketPolicyDao();
|
||||
String policy = policyDao.getPolicy( bucketName );
|
||||
if ( null == policy ) {
|
||||
response.setStatus(204);
|
||||
}
|
||||
else {
|
||||
ServiceProvider.getInstance().deleteBucketPolicy( bucketName );
|
||||
policyDao.deletePolicy( bucketName );
|
||||
response.setStatus(200);
|
||||
}
|
||||
}
|
||||
catch( Exception e ) {
|
||||
logger.error("Delete Bucket Policy failed due to " + e.getMessage(), e);
|
||||
response.setStatus(500);
|
||||
}
|
||||
}
|
||||
|
||||
public void executeGetAllBuckets(HttpServletRequest request, HttpServletResponse response)
|
||||
throws IOException, XMLStreamException
|
||||
{
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.set( 1970, 1, 1 );
|
||||
S3ListAllMyBucketsRequest engineRequest = new S3ListAllMyBucketsRequest();
|
||||
engineRequest.setAccessKey(UserContext.current().getAccessKey());
|
||||
engineRequest.setRequestTimestamp( cal );
|
||||
engineRequest.setSignature( "" );
|
||||
|
||||
S3ListAllMyBucketsResponse engineResponse = ServiceProvider.getInstance().getS3Engine().handleRequest(engineRequest);
|
||||
|
||||
// -> serialize using the apache's Axiom classes
|
||||
ListAllMyBucketsResponse allBuckets = S3SoapServiceImpl.toListAllMyBucketsResponse( engineResponse );
|
||||
|
||||
OutputStream os = response.getOutputStream();
|
||||
response.setStatus(200);
|
||||
response.setContentType("text/xml; charset=UTF-8");
|
||||
XMLStreamWriter xmlWriter = xmlOutFactory.createXMLStreamWriter( os );
|
||||
String documentStart = new String( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" );
|
||||
os.write( documentStart.getBytes());
|
||||
MTOMAwareXMLSerializer MTOMWriter = new MTOMAwareXMLSerializer( xmlWriter );
|
||||
allBuckets.serialize( new QName( "http://s3.amazonaws.com/doc/2006-03-01/", "ListAllMyBucketsResponse", "ns1" ), factory, MTOMWriter );
|
||||
xmlWriter.flush();
|
||||
xmlWriter.close();
|
||||
os.close();
|
||||
}
|
||||
|
||||
public void executeGetBucket(HttpServletRequest request, HttpServletResponse response)
|
||||
throws IOException, XMLStreamException
|
||||
{
|
||||
S3ListBucketRequest engineRequest = new S3ListBucketRequest();
|
||||
engineRequest.setBucketName((String)request.getAttribute(S3Constants.BUCKET_ATTR_KEY));
|
||||
engineRequest.setDelimiter(request.getParameter("delimiter"));
|
||||
engineRequest.setMarker(request.getParameter("marker"));
|
||||
engineRequest.setPrefix(request.getParameter("prefix"));
|
||||
|
||||
int maxKeys = Converter.toInt(request.getParameter("max-keys"), 1000);
|
||||
engineRequest.setMaxKeys(maxKeys);
|
||||
S3ListBucketResponse engineResponse = ServiceProvider.getInstance().getS3Engine().listBucketContents( engineRequest, false );
|
||||
|
||||
// -> serialize using the apache's Axiom classes
|
||||
ListBucketResponse oneBucket = S3SoapServiceImpl.toListBucketResponse( engineResponse );
|
||||
|
||||
OutputStream os = response.getOutputStream();
|
||||
response.setStatus(200);
|
||||
response.setContentType("text/xml; charset=UTF-8");
|
||||
XMLStreamWriter xmlWriter = xmlOutFactory.createXMLStreamWriter( os );
|
||||
String documentStart = new String( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" );
|
||||
os.write( documentStart.getBytes());
|
||||
MTOMAwareXMLSerializer MTOMWriter = new MTOMAwareXMLSerializer( xmlWriter );
|
||||
oneBucket.serialize( new QName( "http://s3.amazonaws.com/doc/2006-03-01/", "ListBucketResponse", "ns1" ), factory, MTOMWriter );
|
||||
xmlWriter.flush();
|
||||
xmlWriter.close();
|
||||
os.close();
|
||||
}
|
||||
|
||||
public void executeGetBucketAcl(HttpServletRequest request, HttpServletResponse response)
|
||||
throws IOException, XMLStreamException
|
||||
{
|
||||
S3GetBucketAccessControlPolicyRequest engineRequest = new S3GetBucketAccessControlPolicyRequest();
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.set( 1970, 1, 1 );
|
||||
engineRequest.setAccessKey(UserContext.current().getAccessKey());
|
||||
engineRequest.setRequestTimestamp( cal );
|
||||
engineRequest.setSignature( "" );
|
||||
engineRequest.setBucketName((String)request.getAttribute(S3Constants.BUCKET_ATTR_KEY));
|
||||
|
||||
S3AccessControlPolicy engineResponse = ServiceProvider.getInstance().getS3Engine().handleRequest(engineRequest);
|
||||
|
||||
// -> serialize using the apache's Axiom classes
|
||||
GetBucketAccessControlPolicyResponse onePolicy = S3SoapServiceImpl.toGetBucketAccessControlPolicyResponse( engineResponse );
|
||||
|
||||
OutputStream os = response.getOutputStream();
|
||||
response.setStatus(200);
|
||||
response.setContentType("text/xml; charset=UTF-8");
|
||||
XMLStreamWriter xmlWriter = xmlOutFactory.createXMLStreamWriter( os );
|
||||
String documentStart = new String( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" );
|
||||
os.write( documentStart.getBytes());
|
||||
MTOMAwareXMLSerializer MTOMWriter = new MTOMAwareXMLSerializer( xmlWriter );
|
||||
onePolicy.serialize( new QName( "http://s3.amazonaws.com/doc/2006-03-01/", "GetBucketAccessControlPolicyResponse", "ns1" ), factory, MTOMWriter );
|
||||
xmlWriter.flush();
|
||||
xmlWriter.close();
|
||||
os.close();
|
||||
}
|
||||
|
||||
public void executeGetBucketVersioning(HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
{
|
||||
// [A] Does the bucket exist?
|
||||
String bucketName = (String)request.getAttribute(S3Constants.BUCKET_ATTR_KEY);
|
||||
String versioningStatus = null;
|
||||
|
||||
if (null == bucketName) {
|
||||
logger.error( "executeGetBucketVersioning - no bucket name given" );
|
||||
response.setStatus( 400 );
|
||||
return;
|
||||
}
|
||||
|
||||
SBucketDao bucketDao = new SBucketDao();
|
||||
SBucket sbucket = bucketDao.getByName( bucketName );
|
||||
if (sbucket == null) {
|
||||
response.setStatus( 404 );
|
||||
return;
|
||||
}
|
||||
|
||||
// [B] The owner may want to restrict the IP address at which this can be performed
|
||||
String client = UserContext.current().getCanonicalUserId();
|
||||
if (!client.equals( sbucket.getOwnerCanonicalId()))
|
||||
throw new PermissionDeniedException( "Access Denied - only the owner can read bucket versioning" );
|
||||
|
||||
S3PolicyContext context = new S3PolicyContext( PolicyActions.GetBucketVersioning, bucketName );
|
||||
if (PolicyAccess.DENY == S3Engine.verifyPolicy( context )) {
|
||||
response.setStatus(403);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// [C]
|
||||
switch( sbucket.getVersioningStatus()) {
|
||||
default:
|
||||
case 0: versioningStatus = ""; break;
|
||||
case 1: versioningStatus = "Enabled"; break;
|
||||
case 2: versioningStatus = "Suspended"; break;
|
||||
}
|
||||
|
||||
StringBuffer xml = new StringBuffer();
|
||||
xml.append( "<?xml version=\"1.0\" encoding=\"utf-8\"?>" );
|
||||
xml.append( "<VersioningConfiguration xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\">" );
|
||||
if (0 < versioningStatus.length()) xml.append( "<Status>" ).append( versioningStatus ).append( "</Status>" );
|
||||
xml.append( "</VersioningConfiguration>" );
|
||||
|
||||
response.setStatus(200);
|
||||
response.setContentType("text/xml; charset=UTF-8");
|
||||
S3RestServlet.endResponse(response, xml.toString());
|
||||
}
|
||||
|
||||
public void executeGetBucketObjectVersions(HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
{
|
||||
S3ListBucketRequest engineRequest = new S3ListBucketRequest();
|
||||
String keyMarker = request.getParameter("key-marker");
|
||||
String versionIdMarker = request.getParameter("version-id-marker");
|
||||
|
||||
engineRequest.setBucketName((String)request.getAttribute(S3Constants.BUCKET_ATTR_KEY));
|
||||
engineRequest.setDelimiter(request.getParameter("delimiter"));
|
||||
engineRequest.setMarker( keyMarker );
|
||||
engineRequest.setPrefix(request.getParameter("prefix"));
|
||||
engineRequest.setVersionIdMarker( versionIdMarker );
|
||||
|
||||
int maxKeys = Converter.toInt(request.getParameter("max-keys"), 1000);
|
||||
engineRequest.setMaxKeys(maxKeys);
|
||||
S3ListBucketResponse engineResponse = ServiceProvider.getInstance().getS3Engine().listBucketContents( engineRequest, true );
|
||||
|
||||
// -> the SOAP version produces different XML
|
||||
StringBuffer xml = new StringBuffer();
|
||||
xml.append( "<?xml version=\"1.0\" encoding=\"utf-8\"?>" );
|
||||
xml.append( "<ListVersionsResult xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\">" );
|
||||
xml.append( "<Name>" ).append( engineResponse.getBucketName()).append( "</Name>" );
|
||||
|
||||
if ( null == keyMarker )
|
||||
xml.append( "<KeyMarker/>" );
|
||||
else xml.append( "<KeyMarker>" ).append( keyMarker ).append( "</KeyMarker" );
|
||||
|
||||
if ( null == versionIdMarker )
|
||||
xml.append( "<VersionIdMarker/>" );
|
||||
else xml.append( "<VersionIdMarker>" ).append( keyMarker ).append( "</VersionIdMarker" );
|
||||
|
||||
xml.append( "<MaxKeys>" ).append( engineResponse.getMaxKeys()).append( "</MaxKeys>" );
|
||||
xml.append( "<IsTruncated>" ).append( engineResponse.isTruncated()).append( "</IsTruncated>" );
|
||||
|
||||
S3ListBucketObjectEntry[] versions = engineResponse.getContents();
|
||||
for( int i=0; null != versions && i < versions.length; i++ )
|
||||
{
|
||||
S3CanonicalUser owner = versions[i].getOwner();
|
||||
boolean isDeletionMarker = versions[i].getIsDeletionMarker();
|
||||
String displayName = owner.getDisplayName();
|
||||
String id = owner.getID();
|
||||
|
||||
if ( isDeletionMarker )
|
||||
{
|
||||
xml.append( "<DeleteMarker>" );
|
||||
xml.append( "<Key>" ).append( versions[i].getKey()).append( "</Key>" );
|
||||
xml.append( "<VersionId>" ).append( versions[i].getVersion()).append( "</VersionId>" );
|
||||
xml.append( "<IsLatest>" ).append( versions[i].getIsLatest()).append( "</IsLatest>" );
|
||||
xml.append( "<LastModified>" ).append( DatatypeConverter.printDateTime( versions[i].getLastModified())).append( "</LastModified>" );
|
||||
}
|
||||
else
|
||||
{ xml.append( "<Version>" );
|
||||
xml.append( "<Key>" ).append( versions[i].getKey()).append( "</Key>" );
|
||||
xml.append( "<VersionId>" ).append( versions[i].getVersion()).append( "</VersionId>" );
|
||||
xml.append( "<IsLatest>" ).append( versions[i].getIsLatest()).append( "</IsLatest>" );
|
||||
xml.append( "<LastModified>" ).append( DatatypeConverter.printDateTime( versions[i].getLastModified())).append( "</LastModified>" );
|
||||
xml.append( "<ETag>" ).append( versions[i].getETag()).append( "</ETag>" );
|
||||
xml.append( "<Size>" ).append( versions[i].getSize()).append( "</Size>" );
|
||||
xml.append( "<StorageClass>" ).append( versions[i].getStorageClass()).append( "</StorageClass>" );
|
||||
}
|
||||
|
||||
xml.append( "<Owner>" );
|
||||
xml.append( "<ID>" ).append( id ).append( "</ID>" );
|
||||
if ( null == displayName )
|
||||
xml.append( "<DisplayName/>" );
|
||||
else xml.append( "<DisplayName>" ).append( owner.getDisplayName()).append( "</DisplayName>" );
|
||||
xml.append( "</Owner>" );
|
||||
|
||||
if ( isDeletionMarker )
|
||||
xml.append( "</DeleteMarker>" );
|
||||
else xml.append( "</Version>" );
|
||||
}
|
||||
xml.append( "</ListVersionsResult>" );
|
||||
|
||||
response.setStatus(200);
|
||||
response.setContentType("text/xml; charset=UTF-8");
|
||||
S3RestServlet.endResponse(response, xml.toString());
|
||||
}
|
||||
|
||||
public void executeGetBucketLogging(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
// TODO -- this is a beta feature of S3
|
||||
response.setStatus(501);
|
||||
}
|
||||
|
||||
public void executeGetBucketLocation(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
response.setStatus(501);
|
||||
}
|
||||
|
||||
public void executeGetBucketWebsite(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
response.setStatus(501);
|
||||
}
|
||||
|
||||
public void executeDeleteBucketWebsite(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
response.setStatus(501);
|
||||
}
|
||||
|
||||
public void executePutBucket(HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
{
|
||||
int contentLength = request.getContentLength();
|
||||
Object objectInContent = null;
|
||||
|
||||
if(contentLength > 0)
|
||||
{
|
||||
InputStream is = null;
|
||||
try {
|
||||
is = request.getInputStream();
|
||||
String xml = StringHelper.stringFromStream(is);
|
||||
XSerializer serializer = new XSerializer(new XSerializerXmlAdapter());
|
||||
objectInContent = serializer.serializeFrom(xml);
|
||||
if(objectInContent != null && !(objectInContent instanceof S3CreateBucketConfiguration)) {
|
||||
throw new InvalidRequestContentException("Invalid rquest content in create-bucket: " + xml);
|
||||
}
|
||||
is.close();
|
||||
|
||||
} catch (IOException e) {
|
||||
logger.error("Unable to read request data due to " + e.getMessage(), e);
|
||||
throw new NetworkIOException(e);
|
||||
|
||||
} finally {
|
||||
if(is != null) is.close();
|
||||
}
|
||||
}
|
||||
|
||||
S3CreateBucketRequest engineRequest = new S3CreateBucketRequest();
|
||||
engineRequest.setBucketName((String)request.getAttribute(S3Constants.BUCKET_ATTR_KEY));
|
||||
engineRequest.setConfig((S3CreateBucketConfiguration)objectInContent);
|
||||
|
||||
S3CreateBucketResponse engineResponse = ServiceProvider.getInstance().getS3Engine().handleRequest(engineRequest);
|
||||
response.addHeader("Location", "/" + engineResponse.getBucketName());
|
||||
response.setContentLength(0);
|
||||
response.setStatus(200);
|
||||
response.flushBuffer();
|
||||
}
|
||||
|
||||
public void executePutBucketAcl(HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
{
|
||||
S3PutObjectRequest putRequest = null;
|
||||
|
||||
// -> reuse the Access Control List parsing code that was added to support DIME
|
||||
String bucketName = (String)request.getAttribute(S3Constants.BUCKET_ATTR_KEY);
|
||||
try {
|
||||
putRequest = S3RestServlet.toEnginePutObjectRequest( request.getInputStream());
|
||||
}
|
||||
catch( Exception e ) {
|
||||
throw new IOException( e.toString());
|
||||
}
|
||||
|
||||
// -> reuse the SOAP code to save the passed in ACLs
|
||||
S3SetBucketAccessControlPolicyRequest engineRequest = new S3SetBucketAccessControlPolicyRequest();
|
||||
engineRequest.setBucketName( bucketName );
|
||||
engineRequest.setAcl( putRequest.getAcl());
|
||||
|
||||
S3Response engineResponse = ServiceProvider.getInstance().getS3Engine().handleRequest(engineRequest);
|
||||
response.setStatus( engineResponse.getResultCode());
|
||||
}
|
||||
|
||||
public void executePutBucketVersioning(HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
{
|
||||
String bucketName = (String)request.getAttribute(S3Constants.BUCKET_ATTR_KEY);
|
||||
String versioningStatus = null;
|
||||
Node item = null;
|
||||
|
||||
if (null == bucketName) {
|
||||
logger.error( "executePutBucketVersioning - no bucket name given" );
|
||||
response.setStatus( 400 );
|
||||
return;
|
||||
}
|
||||
|
||||
// -> is the XML as defined?
|
||||
try {
|
||||
DocumentBuilder db = dbf.newDocumentBuilder();
|
||||
Document restXML = db.parse( request.getInputStream());
|
||||
NodeList match = S3RestServlet.getElement( restXML, "http://s3.amazonaws.com/doc/2006-03-01/", "Status" );
|
||||
if ( 0 < match.getLength())
|
||||
{
|
||||
item = match.item(0);
|
||||
versioningStatus = new String( item.getFirstChild().getNodeValue());
|
||||
}
|
||||
else
|
||||
{ logger.error( "executePutBucketVersioning - cannot find Status tag in XML body" );
|
||||
response.setStatus( 400 );
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch( Exception e ) {
|
||||
logger.error( "executePutBucketVersioning - failed to parse XML due to " + e.getMessage(), e);
|
||||
response.setStatus(400);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
// -> does not matter what the ACLs say only the owner can turn on versioning on a bucket
|
||||
// -> the bucket owner may want to restrict the IP address from which this can occur
|
||||
SBucketDao bucketDao = new SBucketDao();
|
||||
SBucket sbucket = bucketDao.getByName( bucketName );
|
||||
|
||||
String client = UserContext.current().getCanonicalUserId();
|
||||
if (!client.equals( sbucket.getOwnerCanonicalId()))
|
||||
throw new PermissionDeniedException( "Access Denied - only the owner can turn on versioing on a bucket" );
|
||||
|
||||
S3PolicyContext context = new S3PolicyContext( PolicyActions.PutBucketVersioning, bucketName );
|
||||
if (PolicyAccess.DENY == S3Engine.verifyPolicy( context )) {
|
||||
response.setStatus(403);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (versioningStatus.equalsIgnoreCase( "Enabled" )) sbucket.setVersioningStatus( 1 );
|
||||
else if (versioningStatus.equalsIgnoreCase( "Suspended")) sbucket.setVersioningStatus( 2 );
|
||||
else {
|
||||
logger.error( "executePutBucketVersioning - unknown state: [" + versioningStatus + "]" );
|
||||
response.setStatus( 400 );
|
||||
return;
|
||||
}
|
||||
bucketDao.update( sbucket );
|
||||
|
||||
} catch( PermissionDeniedException e ) {
|
||||
logger.error( "executePutBucketVersioning - failed due to " + e.getMessage(), e);
|
||||
throw e;
|
||||
|
||||
} catch( Exception e ) {
|
||||
logger.error( "executePutBucketVersioning - failed due to " + e.getMessage(), e);
|
||||
response.setStatus(500);
|
||||
return;
|
||||
}
|
||||
response.setStatus(200);
|
||||
}
|
||||
|
||||
public void executePutBucketLogging(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
// TODO -- this is a S3 beta feature
|
||||
response.setStatus(501);
|
||||
}
|
||||
|
||||
public void executePutBucketWebsite(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
response.setStatus(501);
|
||||
}
|
||||
|
||||
public void executeDeleteBucket(HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
{
|
||||
S3DeleteBucketRequest engineRequest = new S3DeleteBucketRequest();
|
||||
engineRequest.setBucketName((String)request.getAttribute(S3Constants.BUCKET_ATTR_KEY));
|
||||
S3Response engineResponse = ServiceProvider.getInstance().getS3Engine().handleRequest(engineRequest);
|
||||
response.setStatus(engineResponse.getResultCode());
|
||||
response.flushBuffer();
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a very complex function with all the options defined by Amazon. Part of the functionality is
|
||||
* provided by the query done against the database. The CommonPrefixes functionality is done the same way
|
||||
* as done in the listBucketContents function (i.e., by iterating though the list to decide which output
|
||||
* element each key is placed).
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @throws IOException
|
||||
*/
|
||||
public void executeListMultipartUploads(HttpServletRequest request, HttpServletResponse response) throws IOException
|
||||
{
|
||||
// [A] Obtain parameters and do basic bucket verification
|
||||
String bucketName = (String)request.getAttribute(S3Constants.BUCKET_ATTR_KEY);
|
||||
String delimiter = request.getParameter("delimiter");
|
||||
String keyMarker = request.getParameter("key-marker");
|
||||
String prefix = request.getParameter("prefix");
|
||||
int maxUploads = 1000;
|
||||
int nextUploadId = 0;
|
||||
String nextKey = null;
|
||||
boolean isTruncated = false;
|
||||
S3MultipartUpload[] uploads = null;
|
||||
S3MultipartUpload onePart = null;
|
||||
|
||||
String temp = request.getParameter("max-uploads");
|
||||
if (null != temp) {
|
||||
maxUploads = Integer.parseInt( temp );
|
||||
if (maxUploads > 1000 || maxUploads < 0) maxUploads = 1000;
|
||||
}
|
||||
|
||||
// -> upload-id-marker is ignored unless key-marker is also specified
|
||||
String uploadIdMarker = request.getParameter("upload-id-marker");
|
||||
if (null == keyMarker) uploadIdMarker = null;
|
||||
|
||||
// -> does the bucket exist, we may need it to verify access permissions
|
||||
SBucketDao bucketDao = new SBucketDao();
|
||||
SBucket bucket = bucketDao.getByName(bucketName);
|
||||
if (bucket == null) {
|
||||
logger.error( "listMultipartUpload failed since " + bucketName + " does not exist" );
|
||||
response.setStatus(404);
|
||||
return;
|
||||
}
|
||||
|
||||
S3PolicyContext context = new S3PolicyContext( PolicyActions.ListBucketMultipartUploads, bucketName );
|
||||
context.setEvalParam( ConditionKeys.Prefix, prefix );
|
||||
context.setEvalParam( ConditionKeys.Delimiter, delimiter );
|
||||
S3Engine.verifyAccess( context, "SBucket", bucket.getId(), SAcl.PERMISSION_READ );
|
||||
|
||||
|
||||
// [B] Query the multipart table to get the list of current uploads
|
||||
try {
|
||||
MultipartLoadDao uploadDao = new MultipartLoadDao();
|
||||
Tuple<S3MultipartUpload[],Boolean> result = uploadDao.getInitiatedUploads( bucketName, maxUploads, prefix, keyMarker, uploadIdMarker );
|
||||
uploads = result.getFirst();
|
||||
isTruncated = result.getSecond().booleanValue();
|
||||
}
|
||||
catch( Exception e ) {
|
||||
logger.error("List Multipart Uploads failed due to " + e.getMessage(), e);
|
||||
response.setStatus(500);
|
||||
}
|
||||
|
||||
StringBuffer xml = new StringBuffer();
|
||||
xml.append( "<?xml version=\"1.0\" encoding=\"utf-8\"?>" );
|
||||
xml.append( "<ListMultipartUploadsResult xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\">" );
|
||||
xml.append( "<Bucket>" ).append( bucketName ).append( "</Bucket>" );
|
||||
xml.append( "<KeyMarker>").append((null == keyMarker ? "" : keyMarker)).append( "</KeyMarker>" );
|
||||
xml.append( "<UploadIdMarker>").append((null == uploadIdMarker ? "" : uploadIdMarker)).append( "</UploadIdMarker>" );
|
||||
|
||||
|
||||
// [C] Construct the contents of the <Upload> element
|
||||
StringBuffer partsList = new StringBuffer();
|
||||
for( int i=0; i < uploads.length; i++ )
|
||||
{
|
||||
onePart = uploads[i];
|
||||
if (null == onePart) break;
|
||||
|
||||
if (delimiter != null && !delimiter.isEmpty())
|
||||
{
|
||||
// -> is this available only in the CommonPrefixes element?
|
||||
if (StringHelper.substringInBetween(onePart.getKey(), prefix, delimiter) != null)
|
||||
continue;
|
||||
}
|
||||
|
||||
nextKey = onePart.getKey();
|
||||
nextUploadId = onePart.getId();
|
||||
partsList.append( "<Upload>" );
|
||||
partsList.append( "<Key>" ).append( nextKey ).append( "</Key>" );
|
||||
partsList.append( "<UploadId>" ).append( nextUploadId ).append( "</UploadId>" );
|
||||
partsList.append( "<Initiator>" );
|
||||
partsList.append( "<ID>" ).append( onePart.getAccessKey()).append( "</ID>" );
|
||||
partsList.append( "<DisplayName></DisplayName>" );
|
||||
partsList.append( "</Initiator>" );
|
||||
partsList.append( "<Owner>" );
|
||||
partsList.append( "<ID>" ).append( onePart.getAccessKey()).append( "</ID>" );
|
||||
partsList.append( "<DisplayName></DisplayName>" );
|
||||
partsList.append( "</Owner>" );
|
||||
partsList.append( "<StorageClass>STANDARD</StorageClass>" );
|
||||
partsList.append( "<Initiated>" ).append( DatatypeConverter.printDateTime( onePart.getLastModified())).append( "</Initiated>" );
|
||||
partsList.append( "</Upload>" );
|
||||
}
|
||||
|
||||
// [D] Construct the contents of the <CommonPrefixes> elements (if any)
|
||||
for( int i=0; i < uploads.length; i++ )
|
||||
{
|
||||
onePart = uploads[i];
|
||||
if (null == onePart) break;
|
||||
|
||||
if (delimiter != null && !delimiter.isEmpty())
|
||||
{
|
||||
String subName = StringHelper.substringInBetween(onePart.getKey(), prefix, delimiter);
|
||||
if (subName != null)
|
||||
{
|
||||
partsList.append( "<CommonPrefixes>" );
|
||||
partsList.append( "<Prefix>" );
|
||||
if ( prefix != null && prefix.length() > 0 )
|
||||
partsList.append( prefix + delimiter + subName );
|
||||
else partsList.append( subName );
|
||||
partsList.append( "</Prefix>" );
|
||||
partsList.append( "</CommonPrefixes>" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// [D] Finish off the response
|
||||
xml.append( "<NextKeyMarker>" ).append((null == nextKey ? "" : nextKey)).append( "</NextKeyMarker>" );
|
||||
xml.append( "<NextUploadIdMarker>" ).append((0 == nextUploadId ? "" : nextUploadId)).append( "</NextUploadIdMarker>" );
|
||||
xml.append( "<MaxUploads>" ).append( maxUploads ).append( "</MaxUploads>" );
|
||||
xml.append( "<IsTruncated>" ).append( isTruncated ).append( "</IsTruncated>" );
|
||||
|
||||
xml.append( partsList.toString());
|
||||
xml.append( "</ListMultipartUploadsResult>" );
|
||||
|
||||
response.setStatus(200);
|
||||
response.setContentType("text/xml; charset=UTF-8");
|
||||
S3RestServlet.endResponse(response, xml.toString());
|
||||
}
|
||||
|
||||
private String streamToString( InputStream is ) throws IOException
|
||||
{
|
||||
int n = 0;
|
||||
|
||||
if ( null != is )
|
||||
{
|
||||
Writer writer = new StringWriter();
|
||||
char[] buffer = new char[1024];
|
||||
try {
|
||||
Reader reader = new BufferedReader( new InputStreamReader(is, "UTF-8"));
|
||||
while ((n = reader.read(buffer)) != -1) writer.write(buffer, 0, n);
|
||||
}
|
||||
finally {
|
||||
is.close();
|
||||
}
|
||||
return writer.toString();
|
||||
}
|
||||
else return null;
|
||||
}
|
||||
}
|
||||
=======
|
||||
/*
|
||||
* Copyright (C) 2011 Citrix Systems, Inc. All rights reserved.
|
||||
*
|
||||
|
|
@ -1858,5 +942,4 @@ public class S3BucketAction implements ServletAction {
|
|||
}
|
||||
else return null;
|
||||
}
|
||||
}
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -44,12 +44,8 @@ public class EC2InstanceFilterSet {
|
|||
filterTypes.put( "instance-state-name", "string" );
|
||||
filterTypes.put( "ip-address", "string" );
|
||||
filterTypes.put( "owner-id", "string" );
|
||||
<<<<<<< HEAD
|
||||
filterTypes.put( "root-device-name", "string" );
|
||||
filterTypes.put( "private-ip-address", "string" );
|
||||
=======
|
||||
filterTypes.put( "root-device-name", "string" );
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -23,10 +23,7 @@ public class EC2RegisterImage {
|
|||
private String format;
|
||||
private String zoneName;
|
||||
private String osTypeName;
|
||||
<<<<<<< HEAD
|
||||
private String hypervisor;
|
||||
=======
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
|
||||
public EC2RegisterImage() {
|
||||
location = null;
|
||||
|
|
@ -63,11 +60,7 @@ public class EC2RegisterImage {
|
|||
|
||||
/**
|
||||
* We redefine the expected format of this field to be:
|
||||
<<<<<<< HEAD
|
||||
* "format:zonename:ostypename:hypervisor"
|
||||
=======
|
||||
* "format:zonename:ostypename"
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
*
|
||||
* @param param
|
||||
*/
|
||||
|
|
@ -78,10 +71,7 @@ public class EC2RegisterImage {
|
|||
format = parts[0];
|
||||
zoneName = parts[1];
|
||||
osTypeName = parts[2];
|
||||
<<<<<<< HEAD
|
||||
hypervisor = parts[3];
|
||||
=======
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -97,11 +87,8 @@ public class EC2RegisterImage {
|
|||
public String getOsTypeName() {
|
||||
return this.osTypeName;
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
|
||||
public String getHypervisor() {
|
||||
return hypervisor;
|
||||
}
|
||||
=======
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,11 +35,7 @@ public class EC2Snapshot {
|
|||
id = null;
|
||||
name = null;
|
||||
volumeId = null;
|
||||
<<<<<<< HEAD
|
||||
volumeSize = new Long(0);
|
||||
=======
|
||||
volumeSize = null;
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
type = null;
|
||||
state = null;
|
||||
created = null;
|
||||
|
|
@ -76,11 +72,7 @@ public class EC2Snapshot {
|
|||
}
|
||||
|
||||
public Long getVolumeSize() {
|
||||
<<<<<<< HEAD
|
||||
return this.volumeSize;
|
||||
=======
|
||||
return this.volumeSize;
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
}
|
||||
|
||||
public void setType( String type ) {
|
||||
|
|
|
|||
|
|
@ -118,11 +118,7 @@ public class EC2VolumeFilterSet {
|
|||
else if (filterName.equalsIgnoreCase( "size" ))
|
||||
return containsLong(vol.getSize(), valueSet );
|
||||
else if (filterName.equalsIgnoreCase( "snapshot-id" ))
|
||||
<<<<<<< HEAD
|
||||
return containsString(String.valueOf(vol.getSnapshotId()), valueSet );
|
||||
=======
|
||||
return containsString(vol.getSnapshotId().toString(), valueSet );
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
else if (filterName.equalsIgnoreCase( "status" ))
|
||||
return containsString(vol.getState(), valueSet );
|
||||
else if (filterName.equalsIgnoreCase( "volume-id" ))
|
||||
|
|
@ -132,11 +128,7 @@ public class EC2VolumeFilterSet {
|
|||
else if (filterName.equalsIgnoreCase( "attachment.device" ))
|
||||
return containsDevice(vol.getDeviceId(), valueSet );
|
||||
else if (filterName.equalsIgnoreCase( "attachment.instance-id" ))
|
||||
<<<<<<< HEAD
|
||||
return containsString(String.valueOf(vol.getInstanceId()), valueSet );
|
||||
=======
|
||||
return containsString(vol.getInstanceId().toString(), valueSet );
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
else return false;
|
||||
}
|
||||
|
||||
|
|
@ -175,11 +167,8 @@ public class EC2VolumeFilterSet {
|
|||
|
||||
private boolean containsDevice(String deviceId, String[] set )
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
if (deviceId == null)
|
||||
return false;
|
||||
=======
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
if (deviceId == null)
|
||||
return false;
|
||||
Integer devId = new Integer(deviceId);
|
||||
for (String s : set) {
|
||||
switch( devId ) {
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,96 +1,84 @@
|
|||
/*
|
||||
* Copyright (C) 2011 Citrix Systems, Inc. All rights reserved.
|
||||
*
|
||||
* Licensed 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.service.core.s3;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.cloud.bridge.model.SAcl;
|
||||
<<<<<<< HEAD
|
||||
|
||||
/**
|
||||
* @author Kelven Yang
|
||||
=======
|
||||
import com.cloud.bridge.model.SBucket;
|
||||
import com.cloud.bridge.service.exception.UnsupportedException;
|
||||
|
||||
/**
|
||||
* @author Kelven Yang, John Zucker
|
||||
* Each relation holds
|
||||
* a grantee - which is one of SAcl.GRANTEE_USER, SAcl.GRANTEE_ALLUSERS, SAcl.GRANTEE_AUTHENTICATED
|
||||
* 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
|
||||
* canonicalUserID
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
*/
|
||||
public class S3Grant {
|
||||
private int grantee; // SAcl.GRANTEE_USER etc
|
||||
private int permission; // SAcl.PERMISSION_READ etc
|
||||
private String canonicalUserID;
|
||||
|
||||
public S3Grant() {
|
||||
}
|
||||
|
||||
public int getGrantee() {
|
||||
return grantee;
|
||||
}
|
||||
|
||||
public void setGrantee(int grantee) {
|
||||
this.grantee = grantee;
|
||||
}
|
||||
|
||||
public int getPermission() {
|
||||
return permission;
|
||||
}
|
||||
|
||||
public void setPermission(int permission) {
|
||||
this.permission = permission;
|
||||
}
|
||||
|
||||
public String getCanonicalUserID() {
|
||||
return canonicalUserID;
|
||||
}
|
||||
|
||||
public void setCanonicalUserID(String canonicalUserID) {
|
||||
this.canonicalUserID = canonicalUserID;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
/* Return an array of S3Grants holding the permissions of grantees by grantee type and their canonicalUserIds.
|
||||
* Used by S3 engine to get ACL policy requests for buckets and objects.
|
||||
*/
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
public static S3Grant[] toGrants(List<SAcl> grants) {
|
||||
if(grants != null)
|
||||
{
|
||||
S3Grant[] entries = new S3Grant[grants.size()];
|
||||
int i = 0;
|
||||
for(SAcl acl: grants) {
|
||||
entries[i] = new S3Grant();
|
||||
entries[i].setGrantee(acl.getGranteeType());
|
||||
entries[i].setCanonicalUserID(acl.getGranteeCanonicalId());
|
||||
entries[i].setPermission(acl.getPermission());
|
||||
i++;
|
||||
}
|
||||
return entries;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2011 Citrix Systems, Inc. All rights reserved.
|
||||
*
|
||||
* Licensed 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.service.core.s3;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.cloud.bridge.model.SAcl;
|
||||
import com.cloud.bridge.model.SBucket;
|
||||
import com.cloud.bridge.service.exception.UnsupportedException;
|
||||
|
||||
/**
|
||||
* @author Kelven Yang, John Zucker
|
||||
* Each relation holds
|
||||
* a grantee - which is one of SAcl.GRANTEE_USER, SAcl.GRANTEE_ALLUSERS, SAcl.GRANTEE_AUTHENTICATED
|
||||
* 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
|
||||
* canonicalUserID
|
||||
*/
|
||||
public class S3Grant {
|
||||
private int grantee; // SAcl.GRANTEE_USER etc
|
||||
private int permission; // SAcl.PERMISSION_READ etc
|
||||
private String canonicalUserID;
|
||||
|
||||
public S3Grant() {
|
||||
}
|
||||
|
||||
public int getGrantee() {
|
||||
return grantee;
|
||||
}
|
||||
|
||||
public void setGrantee(int grantee) {
|
||||
this.grantee = grantee;
|
||||
}
|
||||
|
||||
public int getPermission() {
|
||||
return permission;
|
||||
}
|
||||
|
||||
public void setPermission(int permission) {
|
||||
this.permission = permission;
|
||||
}
|
||||
|
||||
public String getCanonicalUserID() {
|
||||
return canonicalUserID;
|
||||
}
|
||||
|
||||
public void setCanonicalUserID(String canonicalUserID) {
|
||||
this.canonicalUserID = canonicalUserID;
|
||||
}
|
||||
|
||||
/* Return an array of S3Grants holding the permissions of grantees by grantee type and their canonicalUserIds.
|
||||
* Used by S3 engine to get ACL policy requests for buckets and objects.
|
||||
*/
|
||||
public static S3Grant[] toGrants(List<SAcl> grants) {
|
||||
if(grants != null)
|
||||
{
|
||||
S3Grant[] entries = new S3Grant[grants.size()];
|
||||
int i = 0;
|
||||
for(SAcl acl: grants) {
|
||||
entries[i] = new S3Grant();
|
||||
entries[i].setGrantee(acl.getGranteeType());
|
||||
entries[i].setCanonicalUserID(acl.getGranteeCanonicalId());
|
||||
entries[i].setPermission(acl.getPermission());
|
||||
i++;
|
||||
}
|
||||
return entries;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,66 +1,58 @@
|
|||
/*
|
||||
* Copyright (C) 2011 Citrix Systems, Inc. All rights reserved.
|
||||
*
|
||||
* Licensed 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.service.core.s3;
|
||||
|
||||
import java.util.Calendar;
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
import java.util.TimeZone;
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
|
||||
/**
|
||||
* @author Kelven Yang
|
||||
*/
|
||||
public class S3ListAllMyBucketsEntry {
|
||||
private String name;
|
||||
private Calendar creationDate;
|
||||
|
||||
public S3ListAllMyBucketsEntry() {
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
public Calendar getCreationDate() {
|
||||
return creationDate;
|
||||
=======
|
||||
public Calendar getCreationDate() {
|
||||
|
||||
// cal.setTimeZone(TimeZone.getTimeZone("Z"));
|
||||
// java.util.Date d = cal.getTime();
|
||||
|
||||
// java.util.Date d = creationDate.getTime();
|
||||
// com.cloud.bridge.util.ISO8601SimpleDateTimeFormat sdf = new com.cloud.bridge.util.ISO8601SimpleDateTimeFormat();
|
||||
// sdf.format(d);
|
||||
// java.lang.StringBuffer b = com.cloud.bridge.util.ISO8601SimpleDateTimeFormat.format(d); return b;
|
||||
|
||||
return creationDate;
|
||||
|
||||
|
||||
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
}
|
||||
|
||||
public void setCreationDate(Calendar creationDate) {
|
||||
this.creationDate = creationDate;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2011 Citrix Systems, Inc. All rights reserved.
|
||||
*
|
||||
* Licensed 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.service.core.s3;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.TimeZone;
|
||||
|
||||
/**
|
||||
* @author Kelven Yang
|
||||
*/
|
||||
public class S3ListAllMyBucketsEntry {
|
||||
private String name;
|
||||
private Calendar creationDate;
|
||||
|
||||
public S3ListAllMyBucketsEntry() {
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Calendar getCreationDate() {
|
||||
|
||||
// cal.setTimeZone(TimeZone.getTimeZone("Z"));
|
||||
// java.util.Date d = cal.getTime();
|
||||
|
||||
// java.util.Date d = creationDate.getTime();
|
||||
// com.cloud.bridge.util.ISO8601SimpleDateTimeFormat sdf = new com.cloud.bridge.util.ISO8601SimpleDateTimeFormat();
|
||||
// sdf.format(d);
|
||||
// java.lang.StringBuffer b = com.cloud.bridge.util.ISO8601SimpleDateTimeFormat.format(d); return b;
|
||||
|
||||
return creationDate;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void setCreationDate(Calendar creationDate) {
|
||||
this.creationDate = creationDate;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,119 +1,111 @@
|
|||
/*
|
||||
* Copyright (C) 2011 Citrix Systems, Inc. All rights reserved.
|
||||
*
|
||||
* Licensed 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.service.core.s3;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import javax.activation.DataHandler;
|
||||
|
||||
/**
|
||||
<<<<<<< HEAD
|
||||
* @author Kelven Yang
|
||||
=======
|
||||
* @author Kelven Yang, John Zucker
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
*/
|
||||
public class S3PutObjectInlineRequest extends S3Request {
|
||||
protected String bucketName;
|
||||
protected String key;
|
||||
protected long contentLength;
|
||||
protected S3MetaDataEntry[] metaEntries;
|
||||
protected S3AccessControlList acl;
|
||||
<<<<<<< HEAD
|
||||
protected String cannedAccessPolicy; // -> REST only sets an acl with a simple keyword
|
||||
=======
|
||||
protected String cannedAccessPolicy; // Canned ACLs are public-read, public-read-write, private, authenticated-read or log-delivery-write
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
protected DataHandler data;
|
||||
protected String dataAsString;
|
||||
|
||||
public S3PutObjectInlineRequest() {
|
||||
super();
|
||||
data = null;
|
||||
}
|
||||
|
||||
public String getBucketName() {
|
||||
return bucketName;
|
||||
}
|
||||
|
||||
public void setBucketName(String bucketName) {
|
||||
this.bucketName = bucketName;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public long getContentLength() {
|
||||
return contentLength;
|
||||
}
|
||||
|
||||
public void setContentLength(long contentLength) {
|
||||
this.contentLength = contentLength;
|
||||
}
|
||||
|
||||
public S3MetaDataEntry[] getMetaEntries() {
|
||||
return metaEntries;
|
||||
}
|
||||
|
||||
public void setMetaEntries(S3MetaDataEntry[] metaEntries) {
|
||||
this.metaEntries = metaEntries;
|
||||
}
|
||||
|
||||
public S3AccessControlList getAcl() {
|
||||
return acl;
|
||||
}
|
||||
|
||||
public void setAcl(S3AccessControlList acl) {
|
||||
this.acl = acl;
|
||||
}
|
||||
|
||||
public String getCannedAccess() {
|
||||
return cannedAccessPolicy;
|
||||
}
|
||||
|
||||
public void setCannedAccess(String cannedAccessPolicy) {
|
||||
this.cannedAccessPolicy = cannedAccessPolicy;
|
||||
}
|
||||
|
||||
public DataHandler getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(DataHandler data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public void setDataAsString( String data ) {
|
||||
this.dataAsString = data;
|
||||
}
|
||||
|
||||
public InputStream getDataInputStream() throws IOException
|
||||
{
|
||||
if ( null == data )
|
||||
{
|
||||
ByteArrayInputStream bs = new ByteArrayInputStream( dataAsString.getBytes());
|
||||
return bs;
|
||||
}
|
||||
else return data.getInputStream();
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2011 Citrix Systems, Inc. All rights reserved.
|
||||
*
|
||||
* Licensed 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.service.core.s3;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import javax.activation.DataHandler;
|
||||
|
||||
/**
|
||||
* @author Kelven Yang, John Zucker
|
||||
*/
|
||||
public class S3PutObjectInlineRequest extends S3Request {
|
||||
protected String bucketName;
|
||||
protected String key;
|
||||
protected long contentLength;
|
||||
protected S3MetaDataEntry[] metaEntries;
|
||||
protected S3AccessControlList acl;
|
||||
protected String cannedAccessPolicy; // Canned ACLs are public-read, public-read-write, private, authenticated-read or log-delivery-write
|
||||
protected DataHandler data;
|
||||
protected String dataAsString;
|
||||
|
||||
public S3PutObjectInlineRequest() {
|
||||
super();
|
||||
data = null;
|
||||
}
|
||||
|
||||
public String getBucketName() {
|
||||
return bucketName;
|
||||
}
|
||||
|
||||
public void setBucketName(String bucketName) {
|
||||
this.bucketName = bucketName;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public long getContentLength() {
|
||||
return contentLength;
|
||||
}
|
||||
|
||||
public void setContentLength(long contentLength) {
|
||||
this.contentLength = contentLength;
|
||||
}
|
||||
|
||||
public S3MetaDataEntry[] getMetaEntries() {
|
||||
return metaEntries;
|
||||
}
|
||||
|
||||
public void setMetaEntries(S3MetaDataEntry[] metaEntries) {
|
||||
this.metaEntries = metaEntries;
|
||||
}
|
||||
|
||||
public S3AccessControlList getAcl() {
|
||||
return acl;
|
||||
}
|
||||
|
||||
public void setAcl(S3AccessControlList acl) {
|
||||
this.acl = acl;
|
||||
}
|
||||
|
||||
public String getCannedAccess() {
|
||||
return cannedAccessPolicy;
|
||||
}
|
||||
|
||||
public void setCannedAccess(String cannedAccessPolicy) {
|
||||
this.cannedAccessPolicy = cannedAccessPolicy;
|
||||
}
|
||||
|
||||
public DataHandler getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(DataHandler data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public void setDataAsString( String data ) {
|
||||
this.dataAsString = data;
|
||||
}
|
||||
|
||||
public InputStream getDataInputStream() throws IOException
|
||||
{
|
||||
if ( null == data )
|
||||
{
|
||||
ByteArrayInputStream bs = new ByteArrayInputStream( dataAsString.getBytes());
|
||||
return bs;
|
||||
}
|
||||
else return data.getInputStream();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,74 +1,67 @@
|
|||
/*
|
||||
* Copyright (C) 2011 Citrix Systems, Inc. All rights reserved.
|
||||
*
|
||||
* Licensed 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.service.core.s3;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
/**
|
||||
<<<<<<< HEAD
|
||||
* @author Kelven Yang
|
||||
=======
|
||||
* @author Kelven Yang, John Zucker
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
*/
|
||||
public class S3PutObjectInlineResponse extends S3Response {
|
||||
protected String ETag;
|
||||
protected Calendar lastModified;
|
||||
protected String version;
|
||||
protected int uploadId;
|
||||
|
||||
public S3PutObjectInlineResponse() {
|
||||
super();
|
||||
uploadId = -1;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
// add ETag header computed as Base64 MD5 whenever object is uploaded or updated
|
||||
// the Base64 is represented in lowercase
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
public String getETag() {
|
||||
return ETag;
|
||||
}
|
||||
|
||||
public void setETag(String eTag) {
|
||||
this.ETag = eTag;
|
||||
}
|
||||
|
||||
public Calendar getLastModified() {
|
||||
return lastModified;
|
||||
}
|
||||
|
||||
public void setLastModified(Calendar lastModified) {
|
||||
this.lastModified = lastModified;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public int getUploadId() {
|
||||
return uploadId;
|
||||
}
|
||||
|
||||
public void setUploadId(int uploadId) {
|
||||
this.uploadId = uploadId;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2011 Citrix Systems, Inc. All rights reserved.
|
||||
*
|
||||
* Licensed 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.service.core.s3;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
/**
|
||||
* @author Kelven Yang, John Zucker
|
||||
*/
|
||||
public class S3PutObjectInlineResponse extends S3Response {
|
||||
protected String ETag;
|
||||
protected Calendar lastModified;
|
||||
protected String version;
|
||||
protected int uploadId;
|
||||
|
||||
public S3PutObjectInlineResponse() {
|
||||
super();
|
||||
uploadId = -1;
|
||||
}
|
||||
|
||||
// add ETag header computed as Base64 MD5 whenever object is uploaded or updated
|
||||
// the Base64 is represented in lowercase
|
||||
public String getETag() {
|
||||
return ETag;
|
||||
}
|
||||
|
||||
public void setETag(String eTag) {
|
||||
this.ETag = eTag;
|
||||
}
|
||||
|
||||
public Calendar getLastModified() {
|
||||
return lastModified;
|
||||
}
|
||||
|
||||
public void setLastModified(Calendar lastModified) {
|
||||
this.lastModified = lastModified;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public int getUploadId() {
|
||||
return uploadId;
|
||||
}
|
||||
|
||||
public void setUploadId(int uploadId) {
|
||||
this.uploadId = uploadId;
|
||||
}
|
||||
}
|
||||
|
|
@ -16,41 +16,30 @@
|
|||
package com.cloud.bridge.util;
|
||||
|
||||
import java.io.File;
|
||||
<<<<<<< HEAD
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
=======
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.cfg.Configuration;
|
||||
<<<<<<< HEAD
|
||||
import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;
|
||||
import org.jasypt.properties.EncryptableProperties;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
=======
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
|
||||
/**
|
||||
* @author Kelven Yang
|
||||
*/
|
||||
public class CloudSessionFactory {
|
||||
private static CloudSessionFactory instance;
|
||||
<<<<<<< HEAD
|
||||
public static final Logger logger = Logger.getLogger(CloudSessionFactory.class);
|
||||
=======
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
|
||||
private SessionFactory factory;
|
||||
|
||||
private CloudSessionFactory() {
|
||||
Configuration cfg = new Configuration();
|
||||
File file = ConfigurationHelper.findConfigurationFile("hibernate.cfg.xml");
|
||||
<<<<<<< HEAD
|
||||
|
||||
File propertiesFile = ConfigurationHelper.findConfigurationFile("db.properties");
|
||||
Properties dbProp = null;
|
||||
|
|
@ -80,15 +69,10 @@ public class CloudSessionFactory {
|
|||
|
||||
|
||||
//
|
||||
=======
|
||||
|
||||
//
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
// we are packaging hibernate mapping files along with the class files,
|
||||
// make sure class loader use the same class path when initializing hibernate mapping.
|
||||
// This is important when we are deploying and testing at different environment (Tomcat/JUnit test runner)
|
||||
//
|
||||
<<<<<<< HEAD
|
||||
if(file != null && dbProp != null){
|
||||
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
|
||||
cfg.configure(file);
|
||||
|
|
@ -109,10 +93,6 @@ public class CloudSessionFactory {
|
|||
logger.warn("Unable to open load db configuration");
|
||||
throw new RuntimeException("nable to open load db configuration");
|
||||
}
|
||||
=======
|
||||
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
|
||||
factory = cfg.configure(file).buildSessionFactory();
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
}
|
||||
|
||||
public synchronized static CloudSessionFactory getInstance() {
|
||||
|
|
|
|||
|
|
@ -5,23 +5,16 @@ public class HeaderParam {
|
|||
protected String name;
|
||||
protected String value;
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
public HeaderParam() {
|
||||
name = null;
|
||||
value = null;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
public HeaderParam (String name, String value) {
|
||||
this.name = name;
|
||||
this.name = value;
|
||||
}
|
||||
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
public void setName( String name ) {
|
||||
this.name = name;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
<<<<<<< HEAD
|
||||
/*
|
||||
* Copyright (C) 2011 Citrix Systems, Inc. All rights reserved.
|
||||
*
|
||||
|
|
@ -358,407 +357,3 @@ public class RestAuth {
|
|||
return result.trim();
|
||||
}
|
||||
}
|
||||
=======
|
||||
/*
|
||||
* Copyright (C) 2011 Citrix Systems, Inc. All rights reserved.
|
||||
*
|
||||
* Licensed 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.util;
|
||||
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.SignatureException;
|
||||
import java.util.*;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
|
||||
import javax.crypto.Mac;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
|
||||
/**
|
||||
* This class expects that the caller pulls the required headers from the standard
|
||||
* HTTPServeletRequest structure. This class is responsible for providing the
|
||||
* RFC2104 calculation to ensure that the signature is valid for the signing string.
|
||||
* The signing string is a representation of the request.
|
||||
* Notes are given below on what values are expected.
|
||||
* This class is used for the Authentication check for REST requests and Query String
|
||||
* Authentication requests.
|
||||
*
|
||||
* @author Kelven Yang, John Zucker, Salvatore Orlando
|
||||
*/
|
||||
|
||||
public class RestAuth {
|
||||
protected final static Logger logger = Logger.getLogger(RestAuth.class);
|
||||
|
||||
// TreeMap: used when constructing the CanonicalizedAmzHeaders Element of the StringToSign
|
||||
protected TreeMap<String, String> AmazonHeaders = null; // not always present
|
||||
protected String bucketName = null; // not always present
|
||||
protected String queryString = null; // for CanonicalizedResource - only interested in a string starting with particular values
|
||||
protected String uriPath = null; // only interested in the resource path
|
||||
protected String date = null; // only if x-amz-date is not set
|
||||
protected String contentType = null; // not always present
|
||||
protected String contentMD5 = null; // not always present
|
||||
protected boolean amzDateSet = false;
|
||||
protected boolean useSubDomain = false;
|
||||
|
||||
protected Set<String> allowedQueryParams;
|
||||
|
||||
public RestAuth() {
|
||||
// these must be lexicographically sorted
|
||||
AmazonHeaders = new TreeMap<String, String>();
|
||||
allowedQueryParams = new HashSet<String>() {{
|
||||
add("acl");
|
||||
add("lifecycle");
|
||||
add("location");
|
||||
add("logging");
|
||||
add("notification");
|
||||
add("partNumber");
|
||||
add("policy");
|
||||
add("requestPayment");
|
||||
add("torrent");
|
||||
add("uploadId");
|
||||
add("uploads");
|
||||
add("versionId");
|
||||
add("versioning");
|
||||
add("versions");
|
||||
add("website");
|
||||
}};
|
||||
}
|
||||
|
||||
public RestAuth(boolean useSubDomain) {
|
||||
//invoke the other constructor
|
||||
this();
|
||||
this.useSubDomain = useSubDomain;
|
||||
}
|
||||
|
||||
public void setUseSubDomain(boolean value) {
|
||||
useSubDomain = value;
|
||||
}
|
||||
|
||||
public boolean getUseSubDomain() {
|
||||
return useSubDomain;
|
||||
}
|
||||
|
||||
/**
|
||||
* This header is used iff the "x-amz-date:" header is not defined.
|
||||
* Value is used in constructing the StringToSign for signature verification.
|
||||
*
|
||||
* @param date - the contents of the "Date:" header, skipping the 'Date:' preamble.
|
||||
* OR pass in the value of the "Expires=" query string parameter passed in
|
||||
* for "Query String Authentication".
|
||||
*/
|
||||
public void setDateHeader( String date ) {
|
||||
if (this.amzDateSet) return;
|
||||
if (null != date) date = date.trim();
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Value is used in constructing the StringToSign for signature verification.
|
||||
*
|
||||
* @param type - the contents of the "Content-Type:" header, skipping the 'Content-Type:' preamble.
|
||||
*/
|
||||
public void setContentTypeHeader( String type ) {
|
||||
if (null != type) type = type.trim();
|
||||
this.contentType = type;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Value is used in constructing the StringToSign for signature verification.
|
||||
* @param type - the contents of the "Content-MD5:" header, skipping the 'Content-MD5:' preamble.
|
||||
*/
|
||||
public void setContentMD5Header( String md5 ) {
|
||||
if (null != md5) md5 = md5.trim();
|
||||
this.contentMD5 = md5;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The bucket name can be in the "Host:" header but it does not have to be. It can
|
||||
* instead be in the uriPath as the first step in the path.
|
||||
*
|
||||
* Used as part of the CanonalizedResource element of the StringToSign.
|
||||
* If we get "Host: static.johnsmith.net:8080", then the bucket name is "static.johnsmith.net"
|
||||
*
|
||||
* @param header - contents of the "Host:" header, skipping the 'Host:' preamble.
|
||||
*/
|
||||
public void setHostHeader( String header ) {
|
||||
if (null == header) {
|
||||
this.bucketName = null;
|
||||
return;
|
||||
}
|
||||
|
||||
// -> is there a port on the name?
|
||||
header = header.trim();
|
||||
int offset = header.indexOf( ":" );
|
||||
if (-1 != offset) header = header.substring( 0, offset );
|
||||
this.bucketName = header;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Used as part of the CanonalizedResource element of the StringToSign.
|
||||
* CanonicalizedResource = [ "/" + Bucket ] +
|
||||
* <HTTP-Request-URI, from the protocol name up to the query string> + [sub-resource]
|
||||
* The list of sub-resources that must be included when constructing the CanonicalizedResource Element are: acl, lifecycle, location,
|
||||
* logging, notification, partNumber, policy, requestPayment, torrent, uploadId, uploads, versionId, versioning, versions and website.
|
||||
* (http://docs.amazonwebservices.com/AmazonS3/latest/dev/RESTAuthentication.html)
|
||||
* @param query - results from calling "HttpServletRequest req.getQueryString()"
|
||||
*/
|
||||
public void setQueryString( String query ) {
|
||||
if (null == query) {
|
||||
this.queryString = null;
|
||||
return;
|
||||
}
|
||||
|
||||
// Sub-resources (i.e.: query params) must be lex sorted
|
||||
Set<String> subResources = new TreeSet<String>();
|
||||
|
||||
String [] queryParams = query.split("&");
|
||||
StringBuffer builtQuery= new StringBuffer();
|
||||
for (String queryParam:queryParams) {
|
||||
// lookup parameter name
|
||||
String paramName = queryParam.split("=")[0];
|
||||
if (allowedQueryParams.contains(paramName)) {
|
||||
subResources.add(queryParam);
|
||||
}
|
||||
}
|
||||
for (String subResource:subResources) {
|
||||
builtQuery.append(subResource + "&");
|
||||
}
|
||||
// If anything inside the string buffer, add a "?" at the beginning,
|
||||
// and then remove the last '&'
|
||||
if (builtQuery.length() > 0) {
|
||||
builtQuery.insert(0, "?");
|
||||
builtQuery.deleteCharAt(builtQuery.length()-1);
|
||||
}
|
||||
this.queryString = builtQuery.toString();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Used as part of the CanonalizedResource element of the StringToSign.
|
||||
* Append the path part of the un-decoded HTTP Request-URI, up-to but not including the query string.
|
||||
*
|
||||
* @param path - - results from calling "HttpServletRequest req.getPathInfo()"
|
||||
*/
|
||||
public void addUriPath( String path ) {
|
||||
if (null != path) path = path.trim();
|
||||
this.uriPath = path;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Pass in each complete Amazon header found in the HTTP request one at a time.
|
||||
* Each Amazon header added will become part of the signature calculation.
|
||||
* We are using a TreeMap here because of the S3 definition:
|
||||
* "Sort the collection of headers lexicographically by header name."
|
||||
*
|
||||
* @param headerAndValue - needs to be the complete amazon header (i.e., starts with "x-amz").
|
||||
*/
|
||||
public void addAmazonHeader( String headerAndValue ) {
|
||||
if (null == headerAndValue) return;
|
||||
|
||||
String canonicalized = null;
|
||||
|
||||
// [A] First Canonicalize the header and its value
|
||||
// -> we use the header 'name' as the key since we have to sort on that
|
||||
int offset = headerAndValue.indexOf( ":" );
|
||||
String header = headerAndValue.substring( 0, offset+1 ).toLowerCase();
|
||||
String value = headerAndValue.substring( offset+1 ).trim();
|
||||
|
||||
// -> RFC 2616, Section 4.2: unfold the header's value by replacing linear white space with a single space character
|
||||
// -> does the HTTPServeletReq already do this for us?
|
||||
value = value.replaceAll( " ", " " ); // -> multiple spaces to one space
|
||||
value = value.replaceAll( "(\r\n|\t|\n)", " " ); // -> CRLF, tab, and LF to one space
|
||||
|
||||
|
||||
// [B] Does this header already exist?
|
||||
if ( AmazonHeaders.containsKey( header )) {
|
||||
// -> combine header fields with the same name into one "header-name:comma-separated-value-list" pair as prescribed by RFC 2616, section 4.2, without any white-space between values.
|
||||
canonicalized = AmazonHeaders.get( header );
|
||||
canonicalized = new String( canonicalized + "," + value + "\n" );
|
||||
canonicalized = canonicalized.replaceAll( "\n,", "," ); // remove the '\n' from the first stored value
|
||||
}
|
||||
else canonicalized = new String( header + value + "\n" ); // -> as per spec, no space between header and its value
|
||||
|
||||
AmazonHeaders.put( header, canonicalized );
|
||||
|
||||
// [C] "x-amz-date:" takes precedence over the "Date:" header
|
||||
if (header.equals( "x-amz-date:" )) {
|
||||
this.amzDateSet = true;
|
||||
if (null != this.date) this.date = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The request is authenticated if we can regenerate the same signature given
|
||||
* on the request. Before calling this function make sure to set the header values
|
||||
* defined by the public values above.
|
||||
*
|
||||
* @param httpVerb - the type of HTTP request (e.g., GET, PUT)
|
||||
* @param secretKey - value obtained from the AWSAccessKeyId
|
||||
* @param signature - the signature we are trying to recreate, note can be URL-encoded
|
||||
*
|
||||
* @throws SignatureException
|
||||
*
|
||||
* @return true if request has been authenticated, false otherwise
|
||||
* @throws UnsupportedEncodingException
|
||||
*/
|
||||
|
||||
public boolean verifySignature( String httpVerb, String secretKey, String signature )
|
||||
throws SignatureException, UnsupportedEncodingException {
|
||||
|
||||
if (null == httpVerb || null == secretKey || null == signature) return false;
|
||||
|
||||
httpVerb = httpVerb.trim();
|
||||
secretKey = secretKey.trim();
|
||||
signature = signature.trim();
|
||||
|
||||
// First calculate the StringToSign after the caller has initialized all the header values
|
||||
String StringToSign = genStringToSign( httpVerb );
|
||||
String calSig = calculateRFC2104HMAC( StringToSign, secretKey );
|
||||
// Was the passed in signature URL encoded? (it must be base64 encoded)
|
||||
int offset = signature.indexOf( "%" );
|
||||
if (-1 != offset) signature = URLDecoder.decode( signature, "UTF-8" );
|
||||
|
||||
boolean match = signature.equals( calSig );
|
||||
if (!match)
|
||||
logger.error( "Signature mismatch, [" + signature + "] [" + calSig + "] over [" + StringToSign + "]" );
|
||||
|
||||
return match;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function generates the single string that will be used to sign with a users
|
||||
* secret key.
|
||||
*
|
||||
* StringToSign = HTTP-Verb + "\n" +
|
||||
* Content-MD5 + "\n" +
|
||||
* Content-Type + "\n" +
|
||||
* Date + "\n" +
|
||||
* CanonicalizedAmzHeaders +
|
||||
* CanonicalizedResource;
|
||||
*
|
||||
* @return The single StringToSign or null.
|
||||
*/
|
||||
private String genStringToSign( String httpVerb ) {
|
||||
StringBuffer canonicalized = new StringBuffer();
|
||||
String temp = null;
|
||||
String canonicalizedResourceElement = genCanonicalizedResourceElement();
|
||||
canonicalized.append( httpVerb ).append( "\n" );
|
||||
if ( (null != this.contentMD5) )
|
||||
canonicalized.append( this.contentMD5 );
|
||||
canonicalized.append( "\n" );
|
||||
|
||||
if ( (null != this.contentType) )
|
||||
canonicalized.append( this.contentType );
|
||||
canonicalized.append( "\n" );
|
||||
|
||||
if (null != this.date)
|
||||
canonicalized.append( this.date );
|
||||
|
||||
canonicalized.append( "\n" );
|
||||
|
||||
if (null != (temp = genCanonicalizedAmzHeadersElement())) canonicalized.append( temp );
|
||||
if (null != canonicalizedResourceElement) canonicalized.append( canonicalizedResourceElement );
|
||||
|
||||
if ( 0 == canonicalized.length())
|
||||
return null;
|
||||
|
||||
return canonicalized.toString();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* CanonicalizedResource represents the Amazon S3 resource targeted by the request.
|
||||
* CanonicalizedResource = [ "/" + Bucket ] +
|
||||
* <HTTP-Request-URI, from the protocol name up to the query string> +
|
||||
* [ sub-resource, if present. For example "?acl", "?location", "?logging", or "?torrent"];
|
||||
*
|
||||
* @return A single string representing CanonicalizedResource or null.
|
||||
*/
|
||||
private String genCanonicalizedResourceElement() {
|
||||
StringBuffer canonicalized = new StringBuffer();
|
||||
|
||||
if(this.useSubDomain && this.bucketName != null)
|
||||
canonicalized.append( "/" ).append( this.bucketName );
|
||||
|
||||
if (null != this.uriPath ) canonicalized.append( this.uriPath );
|
||||
if (null != this.queryString) canonicalized.append( this.queryString );
|
||||
|
||||
if ( 0 == canonicalized.length())
|
||||
return null;
|
||||
|
||||
return canonicalized.toString();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Construct the Canonicalized Amazon headers element of the StringToSign by
|
||||
* concatenating all headers in the TreeMap into a single string.
|
||||
*
|
||||
* @return A single string with all the Amazon headers glued together, or null
|
||||
* if no Amazon headers appeared in the request.
|
||||
*/
|
||||
private String genCanonicalizedAmzHeadersElement() {
|
||||
Collection<String> headers = AmazonHeaders.values();
|
||||
Iterator<String> itr = headers.iterator();
|
||||
StringBuffer canonicalized = new StringBuffer();
|
||||
|
||||
while( itr.hasNext())
|
||||
canonicalized.append( itr.next());
|
||||
|
||||
if ( 0 == canonicalized.length())
|
||||
return null;
|
||||
|
||||
return canonicalized.toString();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a signature by the following method:
|
||||
* new String( Base64( SHA1( key, byte array )))
|
||||
*
|
||||
* @param signIt - the data to generate a keyed HMAC over
|
||||
* @param secretKey - the user's unique key for the HMAC operation
|
||||
* @return String - the recalculated string
|
||||
* @throws SignatureException
|
||||
*/
|
||||
private String calculateRFC2104HMAC( String signIt, String secretKey )
|
||||
throws SignatureException {
|
||||
String result = null;
|
||||
try {
|
||||
SecretKeySpec key = new SecretKeySpec( secretKey.getBytes(), "HmacSHA1" );
|
||||
Mac hmacSha1 = Mac.getInstance( "HmacSHA1" );
|
||||
hmacSha1.init( key );
|
||||
byte [] rawHmac = hmacSha1.doFinal( signIt.getBytes());
|
||||
result = new String( Base64.encodeBase64( rawHmac ));
|
||||
}
|
||||
catch( InvalidKeyException e ) {
|
||||
throw new SignatureException( "Failed to generate keyed HMAC on REST request because key " + secretKey + " is invalid" + e.getMessage());
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new SignatureException( "Failed to generate keyed HMAC on REST request: " + e.getMessage());
|
||||
}
|
||||
return result.trim();
|
||||
}
|
||||
}
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
|
|
|
|||
|
|
@ -19,26 +19,13 @@ import java.io.IOException;
|
|||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
<<<<<<< HEAD
|
||||
* @author Kelven
|
||||
=======
|
||||
* @author Kelven, John Zucker
|
||||
* Provide converters for regexp (case independent tokens)
|
||||
* Also provide upper case or lower case (default) converters for byte array b[] to hex String
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
*/
|
||||
public class StringHelper {
|
||||
public static final String EMPTY_STRING = "";
|
||||
|
||||
<<<<<<< HEAD
|
||||
private static final char[] hexChars = { '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' };
|
||||
|
||||
public static String toHexString(byte[] b) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (int i = 0; i < b.length; i++) {
|
||||
sb.append(hexChars[ (int)(((int)b[i] >> 4) & 0x0f)]);
|
||||
sb.append(hexChars[ (int)(((int)b[i]) & 0x0f)]);
|
||||
=======
|
||||
private static final char[] hexCharsUpperCase = { '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' };
|
||||
|
||||
private static final char[] hexCharsLowerCase = { '0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f' };
|
||||
|
|
@ -61,7 +48,6 @@ public class StringHelper {
|
|||
for (int i = 0; i < b.length; i++) {
|
||||
sb.append(hexCharsLowerCase[ (int)(((int)b[i] >> 4) & 0x0f)]);
|
||||
sb.append(hexCharsLowerCase[ (int)(((int)b[i]) & 0x0f)]);
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1194,11 +1194,7 @@ public class CloudStackApi {
|
|||
CloudStackCommand cmd = new CloudStackCommand(ApiConstants.DELETE_SNAPSHOT);
|
||||
if (cmd != null)
|
||||
cmd.setParam(ApiConstants.ID, id);
|
||||
<<<<<<< HEAD
|
||||
return _client.call(cmd, apiKey, secretKey, true, ApiConstants.DELETE_SNAPSHOT_RESPONSE, null, CloudStackInfoResponse.class);
|
||||
=======
|
||||
return _client.call(cmd, apiKey, secretKey, true, ApiConstants.DELETE_SNAPSHOT_RESPONSE, ApiConstants.SNAPSHOT, CloudStackInfoResponse.class);
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1239,11 +1235,7 @@ public class CloudStackApi {
|
|||
if (id != null) cmd.setParam(ApiConstants.ID, id);
|
||||
if (ids != null) cmd.setParam(ApiConstants.IDS, ids);
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
return _client.call(cmd, apiKey, secretKey, false, ApiConstants.DELETE_SNAPSHOT_POLICIES_RESPONSE, null, CloudStackInfoResponse.class);
|
||||
=======
|
||||
return _client.call(cmd, apiKey, secretKey, false, ApiConstants.DELETE_SNAPSHOT_POLICIES_RESPONSE, ApiConstants.SNAPSHOT, CloudStackInfoResponse.class);
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1955,7 +1947,6 @@ public class CloudStackApi {
|
|||
* @param zoneId
|
||||
* @param account
|
||||
* @param domainId
|
||||
<<<<<<< HEAD
|
||||
* @param isDefault
|
||||
* @param startIp
|
||||
* @param endIp
|
||||
|
|
@ -1963,26 +1954,13 @@ public class CloudStackApi {
|
|||
* @param netmask
|
||||
* @param isShared
|
||||
* @param networkDomain
|
||||
=======
|
||||
* @param endIp
|
||||
* @param gateway
|
||||
* @param isDefault
|
||||
* @param isShared
|
||||
* @param netmask
|
||||
* @param networkDomain
|
||||
* @param startIp
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
* @param tags
|
||||
* @param vlan
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public CloudStackNetwork createNetwork(String displayText, String name, String networkOfferingId, String zoneId, String account, String domainId,
|
||||
<<<<<<< HEAD
|
||||
Boolean isDefault, String startIp, String endIp, String gateway, String netmask, Boolean isShared, String networkDomain, String tags,
|
||||
=======
|
||||
String endIp, String gateway, Boolean isDefault, Boolean isShared, String netmask, String networkDomain, String startIp, String tags,
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
String vlan) throws Exception {
|
||||
CloudStackCommand cmd = new CloudStackCommand(ApiConstants.CREATE_NETWORK);
|
||||
if (cmd != null) {
|
||||
|
|
|
|||
|
|
@ -283,11 +283,7 @@ public class ApiConstants {
|
|||
public static final String LIST_SNAPSHOT_POLICIES = "listSnapshotPolicies";
|
||||
public static final String LIST_SNAPSHOT_POLICIES_RESPONSE = "listsnapshotpoliciesresponse";
|
||||
public static final String LIST_SNAPSHOTS = "listSnapshots";
|
||||
<<<<<<< HEAD
|
||||
public static final String LIST_SNAPSHOTS_RESPONSE = "listsnapshotsresponse";
|
||||
=======
|
||||
public static final String LIST_SNAPSHOTS_RESPONSE = "listsnapshotsresponsee";
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
public static final String LIST_SSH_KEY_PAIRS = "listSSHKeyPairs";
|
||||
public static final String LIST_SSH_KEY_PAIRS_RESPONSE = "listsshkeypairsresponse";
|
||||
public static final String LIST_TEMPLATE_PERMISSIONS = "listTemplatePermissions";
|
||||
|
|
@ -386,11 +382,7 @@ public class ApiConstants {
|
|||
public static final String RESTART_NETWORK = "restartNetwork";
|
||||
public static final String RESTART_NETWORK_RESPONSE = "restartnetworkresponse";
|
||||
public static final String REVOKE_SECURITY_GROUP_INGRESS = "revokeSecurityGroupIngress";
|
||||
<<<<<<< HEAD
|
||||
public static final String REVOKE_SECURITY_GROUP_INGRESS_RESPONSE = "revokesecuritygroupingress";
|
||||
=======
|
||||
public static final String REVOKE_SECURITY_GROUP_INGRESS_RESPONSE = "revokesecuritygroupingressresponse";
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
public static final String ROOT_DEVICE_ID = "rootdeviceid";
|
||||
public static final String ROOT_DEVICE_TYPE = "rootdevicetype";
|
||||
public static final String RULE_ID = "ruleid";
|
||||
|
|
|
|||
|
|
@ -20,11 +20,7 @@ import com.google.gson.annotations.SerializedName;
|
|||
public class CloudStackIngressRule {
|
||||
|
||||
@SerializedName(ApiConstants.RULE_ID)
|
||||
<<<<<<< HEAD
|
||||
private String ruleId;
|
||||
=======
|
||||
private Long ruleId;
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
|
||||
@SerializedName(ApiConstants.PROTOCOL)
|
||||
private String protocol;
|
||||
|
|
@ -53,11 +49,7 @@ public class CloudStackIngressRule {
|
|||
public CloudStackIngressRule() {
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
public String getRuleId() {
|
||||
=======
|
||||
public Long getRuleId() {
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
return ruleId;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,11 +20,7 @@ import com.google.gson.annotations.SerializedName;
|
|||
public class CloudStackNic {
|
||||
|
||||
@SerializedName(ApiConstants.ID)
|
||||
<<<<<<< HEAD
|
||||
private String id;
|
||||
=======
|
||||
private Long id;
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
|
||||
@SerializedName(ApiConstants.BROADCAST_URI)
|
||||
private String broadcastUri;
|
||||
|
|
@ -48,11 +44,7 @@ public class CloudStackNic {
|
|||
private String netmask;
|
||||
|
||||
@SerializedName(ApiConstants.NETWORK_ID)
|
||||
<<<<<<< HEAD
|
||||
private String networkid;
|
||||
=======
|
||||
private Long networkid;
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
|
||||
@SerializedName(ApiConstants.TRAFFIC_TYPE)
|
||||
private String trafficType;
|
||||
|
|
@ -63,19 +55,11 @@ public class CloudStackNic {
|
|||
public CloudStackNic() {
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getNetworkid() {
|
||||
=======
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public Long getNetworkid() {
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
return networkid;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,11 +21,7 @@ public class CloudStackResourceLimit {
|
|||
@SerializedName(ApiConstants.ACCOUNT)
|
||||
private String accountName;
|
||||
@SerializedName(ApiConstants.DOMAIN_ID)
|
||||
<<<<<<< HEAD
|
||||
private String domainId;
|
||||
=======
|
||||
private Long domainId;
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
@SerializedName(ApiConstants.DOMAIN)
|
||||
private String domainName;
|
||||
@SerializedName(ApiConstants.RESOURCE_TYPE)
|
||||
|
|
@ -41,15 +37,9 @@ public class CloudStackResourceLimit {
|
|||
return accountName;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
public String getDomainId() {
|
||||
return domainId;
|
||||
}
|
||||
=======
|
||||
public Long getDomainId() {
|
||||
return domainId;
|
||||
}
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
|
||||
public String getDomainName() {
|
||||
return domainName;
|
||||
|
|
|
|||
|
|
@ -36,11 +36,7 @@ public class CloudStackSecurityGroupIngress {
|
|||
@SerializedName(ApiConstants.PROTOCOL)
|
||||
private String protocol;
|
||||
@SerializedName(ApiConstants.RULE_ID)
|
||||
<<<<<<< HEAD
|
||||
private String ruleId;
|
||||
=======
|
||||
private Long ruleId;
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
@SerializedName(ApiConstants.SECURITY_GROUP_NAME)
|
||||
private String securityGroupName;
|
||||
@SerializedName(ApiConstants.START_PORT)
|
||||
|
|
@ -106,11 +102,7 @@ public class CloudStackSecurityGroupIngress {
|
|||
/**
|
||||
* @return the ruleId
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
public String getRuleId() {
|
||||
=======
|
||||
public Long getRuleId() {
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
return ruleId;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,13 +23,8 @@ import com.google.gson.annotations.SerializedName;
|
|||
*
|
||||
*/
|
||||
public class CloudStackServiceOffering {
|
||||
<<<<<<< HEAD
|
||||
@SerializedName(ApiConstants.ID)
|
||||
private String id;
|
||||
=======
|
||||
@SerializedName(ApiConstants.ID)
|
||||
private Long id;
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
@SerializedName(ApiConstants.CPU_NUMBER)
|
||||
private Long cpuNumber;
|
||||
@SerializedName(ApiConstants.CPU_SPEED)
|
||||
|
|
@ -43,11 +38,7 @@ public class CloudStackServiceOffering {
|
|||
@SerializedName(ApiConstants.DOMAIN)
|
||||
private String domain;
|
||||
@SerializedName(ApiConstants.DOMAIN_ID)
|
||||
<<<<<<< HEAD
|
||||
private String domainId;
|
||||
=======
|
||||
private Long domainId;
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
@SerializedName(ApiConstants.HOST_TAGS)
|
||||
private String hostTags;
|
||||
@SerializedName(ApiConstants.IS_SYSTEM)
|
||||
|
|
@ -58,11 +49,7 @@ public class CloudStackServiceOffering {
|
|||
private Long memory;
|
||||
@SerializedName(ApiConstants.NAME)
|
||||
private String name;
|
||||
<<<<<<< HEAD
|
||||
@SerializedName(ApiConstants.OFFER_HA)
|
||||
=======
|
||||
@SerializedName(ApiConstants.OFFER_HA)
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
private Boolean offerHa;
|
||||
@SerializedName(ApiConstants.STORAGE_TYPE)
|
||||
private String storageType;
|
||||
|
|
@ -81,7 +68,6 @@ public class CloudStackServiceOffering {
|
|||
/**
|
||||
* @return the id
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
|
@ -89,11 +75,6 @@ public class CloudStackServiceOffering {
|
|||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
=======
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
|
||||
/**
|
||||
* @return the cpuNumber
|
||||
|
|
@ -140,7 +121,6 @@ public class CloudStackServiceOffering {
|
|||
/**
|
||||
* @return the domainId
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
public String getDomainId() {
|
||||
return domainId;
|
||||
}
|
||||
|
|
@ -150,13 +130,6 @@ public class CloudStackServiceOffering {
|
|||
}
|
||||
|
||||
/**
|
||||
=======
|
||||
public Long getDomainId() {
|
||||
return domainId;
|
||||
}
|
||||
|
||||
/**
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
* @return the hostTags
|
||||
*/
|
||||
public String getHostTags() {
|
||||
|
|
@ -190,15 +163,11 @@ public class CloudStackServiceOffering {
|
|||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
=======
|
||||
|
||||
>>>>>>> 6472e7b... Now really adding the renamed files!
|
||||
/**
|
||||
* @return the offerHa
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ public class CloudStackClientTestCase extends BaseTestCase {
|
|||
command.setParam("id", "246446");
|
||||
try {
|
||||
CloudStackUserVm vm = client.call(command, API_KEY, SECRET_KEY, true, "startvirtualmachineresponse", "virtualmachine", CloudStackUserVm.class);
|
||||
Assert.assertTrue(vm.getId() == 246446);
|
||||
Assert.assertTrue(vm.getId() == "246446");
|
||||
} catch(Exception e) {
|
||||
logger.error("Unexpected exception ", e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,5 +27,5 @@
|
|||
<import file="${base.dir}/build/package.xml" optional="true"/>
|
||||
<import file="${base.dir}/build/developer.xml" optional="true"/>
|
||||
<import file="${base.dir}/build/build-usage.xml" optional="false"/>
|
||||
<import file="${base.dir}/build/build-cloud-bridge.xml" optional="false"/>
|
||||
<import file="${base.dir}/build/build-aws-api.xml" optional="false"/>
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
company.major.version=1
|
||||
company.minor.version=0
|
||||
company.patch.version=2.RC4
|
||||
|
||||
target.compat.version=1.6
|
||||
source.compat.version=1.6
|
||||
|
||||
debug=true
|
||||
build.type=developer
|
||||
debuglevel=lines,source,vars
|
||||
deprecation=off
|
||||
|
||||
|
|
@ -1,433 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project name="CloudBridge" default="help" basedir=".">
|
||||
<target name="help">
|
||||
<echo level="info" message="Ant Build File for CloudBridge" />
|
||||
<echo level="info" message="Type 'ant -projecthelp' to get a list of targets and their descriptions." />
|
||||
</target>
|
||||
<target name="usage" depends="help" />
|
||||
<dirname property="base.dir" file="${ant.file.CloudBridge}/.." />
|
||||
<property environment="env" />
|
||||
<property name="axis2.home" value="${base.dir}" />
|
||||
<path id="axis2.class.path">
|
||||
<fileset dir="${axis2.home}">
|
||||
<include name="deps/cloudbridge-lib/*.jar" />
|
||||
</fileset>
|
||||
</path>
|
||||
<taskdef name="wsdl2code" classname="org.apache.axis2.tool.ant.AntCodegenTask" classpathref="axis2.class.path" />
|
||||
<!-- directories for build and distribution -->
|
||||
<!-- property name="env.CATALINA_HOME" value="${base.dir}/tomcat" / -->
|
||||
<property name="catalina.dir" value="${env.CATALINA_HOME}" />
|
||||
<property name="build.dir" location="${base.dir}/build" />
|
||||
<property name="buildnumber.dir" location="${build.dir}/" />
|
||||
<property name="target.dir" location="${base.dir}/target" />
|
||||
<property name="classes.dir" location="${target.dir}/classes" />
|
||||
<property name="dist.dir" location="${target.dir}/dist-files" />
|
||||
<property name="db.dir" location="${base.dir}/cloudbridge-setup/db/mysql" />
|
||||
<property name="jar.dir" location="${target.dir}/jar" />
|
||||
<property name="build.log" location="${target.dir}/ant_verbose.txt" />
|
||||
<property name="thirdparty.dir" location="${base.dir}/deps/cloudbridge-lib" />
|
||||
<property name="rampart.dir" location="${base.dir}/deps/cloudbridge-lib/rampart-lib" />
|
||||
<property file="${build.dir}/build-cloud-bridge.properties" />
|
||||
<property name="version" value="${company.major.version}.${company.minor.version}.${company.patch.version}" />
|
||||
<property name="tomcat.home" location="${catalina.dir}" />
|
||||
<property name="deploy.dir" location="${tomcat.home}" />
|
||||
<property name="rpm.install.dir" location="${base.dir}/../../../../../../packages/config/rpm/tmp/BUILD/cloud-bridge-${version}-1" />
|
||||
<property name="rpm.tomcat.dir" location="${rpm.install.dir}/usr/share/cloud/bridge" />
|
||||
<property name="debian.install.dir" location="${base.dir}/packages/config/debian/tmp" />
|
||||
<property name="debian.tomcat.dir" location="${debian.install.dir}/usr/share/cloud/bridge" />
|
||||
<echo level="info" message="deploy home: ${deploy.dir}" />
|
||||
<path id="thirdparty.classpath">
|
||||
<fileset dir="${thirdparty.dir}">
|
||||
<include name="*.jar" />
|
||||
</fileset>
|
||||
</path>
|
||||
<path id="rampart.classpath">
|
||||
<fileset dir="${rampart.dir}">
|
||||
<include name="*.jar" />
|
||||
</fileset>
|
||||
</path>
|
||||
<path id="dist.classpath">
|
||||
<fileset dir="${target.dir}">
|
||||
<include name="**/*.jar" />
|
||||
</fileset>
|
||||
</path>
|
||||
<target name="-init">
|
||||
<mkdir dir="${dist.dir}" />
|
||||
<mkdir dir="${target.dir}" />
|
||||
<record name="${build.log}" loglevel="verbose" action="start" />
|
||||
<!-- create a UTC build timestamp using ISO 8601 formatting -->
|
||||
<tstamp>
|
||||
<format property="utc.build.timestamp" pattern="yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" timezone="GMT" />
|
||||
</tstamp>
|
||||
<!-- remember who/where did the build -->
|
||||
<exec executable="hostname" outputproperty="host.name" />
|
||||
<property name="builder.at" value="${user.name} at ${host.name}" />
|
||||
<property name="builder.id" value="${builder.at}, on ${utc.build.timestamp}" />
|
||||
<property name="built.by" value="${builder.at}, ${utc.build.timestamp}" />
|
||||
<echo level="info" message="builder: ${builder.id}" />
|
||||
<!-- set build.number property, stored in eponymous file -->
|
||||
<buildnumber file="${buildnumber.dir}/build.number" />
|
||||
<condition property="impl.version" value="${version}.${build.number}" else="${version}">
|
||||
<and>
|
||||
<isset property="update.build.number" />
|
||||
</and>
|
||||
</condition>
|
||||
<echo message="Build number is ${impl.version}" />
|
||||
<!-- Create the build directory structure used by compile -->
|
||||
<mkdir dir="${jar.dir}" />
|
||||
<mkdir dir="${dep.cache.dir}" />
|
||||
<record name="${build.log}" action="stop" />
|
||||
</target>
|
||||
<target name="clean" description="clean up files generated by the build">
|
||||
<delete file="${build.log}" />
|
||||
<delete dir="${classes.dir}" />
|
||||
<delete dir="${jar.dir}" />
|
||||
<delete dir="${dist.dir}" />
|
||||
<delete dir="${target.dir}" />
|
||||
</target>
|
||||
<target name="clean-cloudbridge-tomcat">
|
||||
<delete dir="${tomcat.home}/webapps/bridge" />
|
||||
</target>
|
||||
<path id="cloud-bridge.classpath">
|
||||
<path refid="thirdparty.classpath" />
|
||||
<path refid="rampart.classpath" />
|
||||
<path refid="dist.classpath" />
|
||||
</path>
|
||||
<target name="compile-cloud-bridge" depends="-init" description="Compile Cloud.com Simple Storage Service">
|
||||
<compile-java jar.name="cloud-bridge.jar" top.dir="${base.dir}/cloudbridge" classpath="cloud-bridge.classpath">
|
||||
<include-files>
|
||||
<fileset dir="${base.dir}/cloudbridge/src">
|
||||
<include name="**/*.hbm.xml" />
|
||||
</fileset>
|
||||
</include-files>
|
||||
</compile-java>
|
||||
</target>
|
||||
<target name="build-cloud-bridge-jar" depends="-init, compile-cloud-bridge" description="Builds cloud-bridge jar file.">
|
||||
<jar jarfile="${dist.dir}/cloud-bridge.jar" basedir="${target.dir}/classes/cloud-bridge.jar" excludes="**/client/*">
|
||||
<fileset dir="${base.dir}/cloudbridge/src">
|
||||
<include name="**/*.hbm.xml" />
|
||||
</fileset>
|
||||
</jar>
|
||||
</target>
|
||||
<target name="build-cloud-bridge-s3" depends="-init, compile-cloud-bridge" description="Builds cloud-bridge S3 AAR file.">
|
||||
<jar jarfile="${dist.dir}/cloud-s3.aar" basedir="${target.dir}/classes/cloud-bridge.jar" excludes="**/*">
|
||||
<!--
|
||||
<metainf dir="${base.dir}/resource/AmazonS3">
|
||||
<include name="services.xml" />
|
||||
<include name="AmazonS3.wsdl" />
|
||||
</metainf>
|
||||
-->
|
||||
</jar>
|
||||
</target>
|
||||
<target name="build-cloud-auth-s3" depends="-init, compile-cloud-bridge" description="Builds cloud-bridge S3 auth MAR file.">
|
||||
<jar jarfile="${dist.dir}/cloud-auth-s3.mar" basedir="${target.dir}/classes/cloud-bridge.jar" excludes="**/*">
|
||||
<fileset dir="${target.dir}/classes/cloud-bridge.jar">
|
||||
<include name="**/auth/s3/*.class" />
|
||||
</fileset>
|
||||
<metainf dir="${base.dir}/src/com/cloud/bridge/auth/s3">
|
||||
<include name="module.xml" />
|
||||
</metainf>
|
||||
</jar>
|
||||
</target>
|
||||
<target name="build-cloud-bridge-ec2" depends="-init, compile-cloud-bridge" description="Builds cloud-bridge EC2 AAR file.">
|
||||
<jar jarfile="${dist.dir}/cloud-ec2.aar" basedir="${target.dir}/classes/cloud-bridge.jar" excludes="**/*">
|
||||
<metainf dir="${base.dir}/cloudbridge/resource/AmazonEC2">
|
||||
<include name="services.xml" />
|
||||
<include name="AmazonEC2.wsdl" />
|
||||
</metainf>
|
||||
</jar>
|
||||
</target>
|
||||
<target name="build-cloud-auth-ec2" depends="-init, compile-cloud-bridge" description="Builds cloud-bridge EC2 auth MAR file.">
|
||||
<jar jarfile="${dist.dir}/cloud-auth-ec2.mar" basedir="${target.dir}/classes/cloud-bridge.jar" excludes="**/*">
|
||||
<fileset dir="${target.dir}/classes/cloud-bridge.jar">
|
||||
<include name="**/auth/ec2/*.class" />
|
||||
</fileset>
|
||||
<metainf dir="${base.dir}/cloudbridge/src/com/cloud/bridge/auth/ec2">
|
||||
<include name="module.xml" />
|
||||
</metainf>
|
||||
</jar>
|
||||
</target>
|
||||
<target name="deploy-axis" depends="-init">
|
||||
<unwar overwrite="true" src="${base.dir}/deps/cloudbridge-lib/axis2.war" dest="${server.deploy.to.dir}/webapps/bridge" />
|
||||
</target>
|
||||
<condition property="access_key.private.notpresent">
|
||||
<not>
|
||||
<available file="${base.dir}/cloudbridge/cloud_private_key.pem" type="file" property="access_key.private.notpresent"/>
|
||||
</not>
|
||||
</condition>
|
||||
<!-- Dev Environment ONLY -->
|
||||
<target name="generate-cloud-access-keys" if="access_key.private.notpresent">
|
||||
<exec executable="openssl" searchpath="true">
|
||||
<arg line="req -x509 -nodes -days 365 -newkey rsa:2048 -subj '/C=US/ST=California/L=Cupertino/O=cloud.com/CN=cloudbridge-test' -keyout ${base.dir}/cloud_private_key.pem -out ${base.dir}/cloud_cert.pem"/>
|
||||
</exec>
|
||||
</target>
|
||||
<!-- Dev Environment ONLY - this assumes EC2_ACCESS_KEY, EC2_SECRET_KEY and EC2_URL have already been defined...-->
|
||||
<target name="register-cloud-bridge" description="Register with cloud-bridge (For Dev environments only)" depends="generate-cloud-access-keys">
|
||||
<exec executable="${base.dir}/dist/cloudbridge/setup/cloud-bridge-register">
|
||||
<arg value="--apikey=${env.EC2_ACCESS_KEY}" />
|
||||
<arg value="--secretkey=${env.EC2_SECRET_KEY}" />
|
||||
<arg value="--cert=${base.dir}/cloud_cert.pem" />
|
||||
<arg value="--url=${env.EC2_URL}" />
|
||||
</exec>
|
||||
</target>
|
||||
<target name="build-cloud-bridge" depends="build-cloud-bridge-jar,build-cloud-bridge-ec2,build-cloud-auth-ec2" description="Builds all of cloud-bridge">
|
||||
</target>
|
||||
<target name="deploy-cloud-bridge" depends="deploy-axis">
|
||||
<!--
|
||||
<copy todir="${deploy.dir}/webapps/bridge/WEB-INF/services">
|
||||
<fileset dir="${dist.dir}">
|
||||
<include name="cloud-s3.aar"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
-->
|
||||
<copy todir="${server.deploy.to.dir}/webapps/bridge/WEB-INF/services">
|
||||
<fileset dir="${dist.dir}">
|
||||
<include name="cloud-ec2.aar" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy todir="${server.deploy.to.dir}/webapps/bridge/WEB-INF/modules">
|
||||
<fileset dir="${dist.dir}">
|
||||
<include name="cloud-auth-s3.mar" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy todir="${server.deploy.to.dir}/webapps/bridge/WEB-INF/modules">
|
||||
<fileset dir="${dist.dir}">
|
||||
<include name="cloud-auth-ec2.mar" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy todir="${server.deploy.to.dir}/webapps/bridge/WEB-INF/lib">
|
||||
<fileset dir="${jar.dir}">
|
||||
<include name="cloud-bridge.jar" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy todir="${server.deploy.to.dir}/webapps/bridge/WEB-INF/lib">
|
||||
<fileset dir="${base.dir}/deps/cloudbridge-lib">
|
||||
<include name="*.jar" />
|
||||
<exclude name="mysql-connector-java-5.1.7-bin.jar" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy todir="${server.deploy.to.dir}/lib">
|
||||
<fileset dir="${base.dir}/deps/cloudbridge-lib">
|
||||
<include name="mysql-connector-java-5.1.7-bin.jar" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy overwrite="false" todir="${server.deploy.to.dir}/conf">
|
||||
<fileset dir="${base.dir}/cloudbridge/conf/">
|
||||
<include name="**/*" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy overwrite="true" todir="${server.deploy.to.dir}/webapps/bridge/WEB-INF/conf">
|
||||
<fileset dir="${base.dir}/cloudbridge/resource/Axis2/">
|
||||
<include name="axis2.xml" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy overwrite="true" todir="${server.deploy.to.dir}/webapps/bridge/WEB-INF">
|
||||
<fileset dir="${base.dir}/cloudbridge/web/">
|
||||
<include name="web.xml" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<!-- rampart lib goes where the axis lib files go -->
|
||||
<copy todir="${server.deploy.to.dir}/webapps/bridge/WEB-INF/lib">
|
||||
<fileset dir="${base.dir}/deps/cloudbridge-lib/rampart-lib">
|
||||
<include name="*.jar" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<!-- copying over rampart mar files for WS-Security -->
|
||||
<copy todir="${server.deploy.to.dir}/webapps/bridge/WEB-INF/modules">
|
||||
<fileset dir="${base.dir}/cloudbridge/modules">
|
||||
<include name="*.mar" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<!-- WS-Security requires this keystore -->
|
||||
<copy todir="${server.deploy.to.dir}/webapps/bridge/WEB-INF/classes">
|
||||
<fileset dir="${base.dir}/cloudbridge/resource/AmazonEC2">
|
||||
<include name="crypto.properties" />
|
||||
<include name="xes.keystore" />
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
<target name="deploy-debian-install" depends="build-cloud-bridge-jar, build-cloud-bridge">
|
||||
<copy todir="${debian.tomcat.dir}/webapps/bridge/WEB-INF/services">
|
||||
<fileset dir="${dist.dir}">
|
||||
<!--
|
||||
<include name="cloud-s3.aar"/>
|
||||
-->
|
||||
<include name="cloud-ec2.aar" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy todir="${debian.tomcat.dir}/webapps/bridge/WEB-INF/modules">
|
||||
<fileset dir="${dist.dir}">
|
||||
<include name="cloud-auth-s3.mar" />
|
||||
<include name="cloud-auth-ec2.mar" />
|
||||
</fileset>
|
||||
<fileset dir="${base.dir}/modules">
|
||||
<include name="*.mar" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy todir="${debian.tomcat.dir}/webapps/bridge/WEB-INF/lib">
|
||||
<fileset dir="${base.dir}/rampart-lib">
|
||||
<include name="*.jar" />
|
||||
</fileset>
|
||||
<fileset dir="${jar.dir}">
|
||||
<include name="cloud-bridge.jar" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy todir="${debian.tomcat.dir}/lib">
|
||||
<fileset dir="${base.dir}/lib">
|
||||
<include name="*.jar" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy todir="${debian.tomcat.dir}/webapps/bridge/WEB-INF/classes">
|
||||
<fileset dir="${base.dir}/resource/AmazonEC2">
|
||||
<include name="crypto.properties" />
|
||||
<include name="xes.keystore" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy overwrite="true" todir="${debian.tomcat.dir}/conf">
|
||||
<fileset dir="${base.dir}/cloudbridge/conf/">
|
||||
<include name="**/*" />
|
||||
</fileset>
|
||||
<fileset dir="${base.dir}/cloudbridge-setup/tomcat">
|
||||
<include name="**/*" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy overwrite="true" todir="${debian.tomcat.dir}/webapps/bridge/WEB-INF/conf">
|
||||
<fileset dir="${base.dir}/cloudbridge/resource/Axis2/">
|
||||
<include name="axis2.xml" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy overwrite="true" todir="${debian.tomcat.dir}/webapps/bridge/WEB-INF">
|
||||
<fileset dir="${base.dir}/cloudbridge/web/">
|
||||
<include name="web.xml" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy overwrite="true" todir="${debian.install.dir}/usr/share/cloud/setup/bridge/db">
|
||||
<fileset dir="${base.dir}/db/mysql">
|
||||
<include name="*.sql" />
|
||||
<include name="*.sh" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy overwrite="true" todir="${debian.install.dir}/etc/init.d">
|
||||
<fileset dir="${base.dir}/cloudbridge-setup/init/debian/">
|
||||
<include name="cloud-bridge" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy overwrite="true" todir="${debian.install.dir}/usr/bin">
|
||||
<fileset dir="${base.dir}/cloudbridge-setup/setup">
|
||||
<include name="*" />
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
<target name="deploy-rpm-install" depends="build-cloud-bridge-jar, build-cloud-bridge">
|
||||
<copy todir="${rpm.tomcat.dir}/webapps/bridge/WEB-INF/services">
|
||||
<fileset dir="${dist.dir}">
|
||||
<!--
|
||||
<include name="cloud-s3.aar"/>
|
||||
-->
|
||||
<include name="cloud-ec2.aar" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy todir="${rpm.tomcat.dir}/webapps/bridge/WEB-INF/modules">
|
||||
<fileset dir="${dist.dir}">
|
||||
<include name="cloud-auth-s3.mar" />
|
||||
<include name="cloud-auth-ec2.mar" />
|
||||
</fileset>
|
||||
<fileset dir="${base.dir}/modules">
|
||||
<include name="*.mar" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy todir="${rpm.tomcat.dir}/webapps/bridge/WEB-INF/lib">
|
||||
<fileset dir="${base.dir}/rampart-lib">
|
||||
<include name="*.jar" />
|
||||
</fileset>
|
||||
<fileset dir="${jar.dir}">
|
||||
<include name="cloud-bridge.jar" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy todir="${rpm.tomcat.dir}/lib">
|
||||
<fileset dir="${base.dir}/lib">
|
||||
<include name="*.jar" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy todir="${rpm.tomcat.dir}/webapps/bridge/WEB-INF/classes">
|
||||
<fileset dir="${base.dir}/resource/AmazonEC2">
|
||||
<include name="crypto.properties" />
|
||||
<include name="xes.keystore" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy overwrite="false" todir="${rpm.tomcat.dir}/conf">
|
||||
<fileset dir="${base.dir}/cloudbridge/conf/">
|
||||
<include name="**/*" />
|
||||
</fileset>
|
||||
<fileset dir="${base.dir}/dist/cloudbridge/tomcat">
|
||||
<include name="**/*" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy overwrite="true" todir="${rpm.tomcat.dir}/webapps/bridge/WEB-INF/conf">
|
||||
<fileset dir="${base.dir}/cloudbridge/resource/Axis2/">
|
||||
<include name="axis2.xml" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy overwrite="true" todir="${rpm.tomcat.dir}/webapps/bridge/WEB-INF">
|
||||
<fileset dir="${base.dir}/cloudbridge/web/">
|
||||
<include name="web.xml" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy overwrite="true" todir="${rpm.install.dir}/usr/share/cloud/setup/bridge/db">
|
||||
<fileset dir="${base.dir}/cloudbridge-setup/db/mysql">
|
||||
<include name="*.sql" />
|
||||
<include name="*.sh" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy overwrite="true" todir="${rpm.install.dir}/etc/init.d">
|
||||
<fileset dir="${base.dir}/cloudbridge-setup/init/rpm/">
|
||||
<include name="cloud-bridge" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy overwrite="true" todir="${rpm.install.dir}/usr/bin">
|
||||
<fileset dir="${base.dir}/cloudbridge-setup/setup">
|
||||
<include name="*" />
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
<target name="deploy-cloudbridge-db">
|
||||
<echo message="deploy-cloudbridge-db" />
|
||||
<exec dir="${db.dir}" executable="bash">
|
||||
<arg value="deploy-db-bridge.sh" />
|
||||
<arg value="${DBROOTPW}" />
|
||||
</exec>
|
||||
</target>
|
||||
<target name="download-ELB-wsdl">
|
||||
<echo message="downloading ElasticLoadBalancing.wsdl..." />
|
||||
<get src="http://elasticloadbalancing.amazonaws.com/doc/2011-04-05/ElasticLoadBalancing.wsdl" dest="wsdl/" verbose="true" usetimestamp="true" overwrite="false"/>
|
||||
</target>
|
||||
<target name="codegen-server-s3">
|
||||
<wsdl2code
|
||||
wsdlfilename="${base.dir}/wsdl/cloud-AmazonS3.wsdl"
|
||||
serverside="true"
|
||||
generateservicexml="true"
|
||||
skipbuildxml="true"
|
||||
serversideinterface="true"
|
||||
namespacetopackages="http://s3.amazonaws.com/doc/2006-03-01/=com.amazon.s3"
|
||||
targetsourcefolderlocation="src"
|
||||
targetresourcesfolderlocation="resource/AmazonS3"
|
||||
overwrite="true"
|
||||
/>
|
||||
</target>
|
||||
<target name="codegen-server-ec2">
|
||||
<wsdl2code wsdlfilename="${base.dir}/wsdl/AmazonEC2.wsdl" serverside="true" generateservicexml="true" skipbuildxml="true" serversideinterface="true" namespacetopackages="http://ec2.amazonaws.com/doc/2010-11-15/=com.amazon.ec2"
|
||||
targetsourcefolderlocation="src" targetresourcesfolderlocation="resource/AmazonEC2" overwrite="true" />
|
||||
</target>
|
||||
<target name="codegen-server-elb" depends="download-ELB-wsdl">
|
||||
<wsdl2code wsdlfilename="${base.dir}/wsdl/ElasticLoadBalancing.wsdl" serverside="true" generateservicexml="true" skipbuildxml="true" serversideinterface="true" namespacetopackages="http://elasticloadbalancing.amazonaws.com/doc/2011-04-05/=com.amazon.elb" targetsourcefolderlocation="src" targetresourcesfolderlocation="resource/AmazonELB" overwrite="true" />
|
||||
</target>
|
||||
<target name="codegen-client-s3">
|
||||
<wsdl2code wsdlfilename="${base.dir}/wsdl/cloud-AmazonS3.wsdl" serverside="false" generateservicexml="false" skipbuildxml="true" serversideinterface="false" namespacetopackages="http://s3.amazonaws.com/doc/2006-03-01/=com.amazon.s3.client" targetsourcefolderlocation="src" targetresourcesfolderlocation="resource/AmazonS3" overwrite="true" />
|
||||
</target>
|
||||
<target name="codegen-client-ec2">
|
||||
<wsdl2code wsdlfilename="${base.dir}/wsdl/AmazonEC2.wsdl" serverside="false" generateservicexml="false" skipbuildxml="true" serversideinterface="false" namespacetopackages="http://ec2.amazonaws.com/doc/2010-11-15/=com.amazon.ec2.clieent" targetsourcefolderlocation="src" targetresourcesfolderlocation="resource/AmazonEC2" overwrite="true" />
|
||||
</target>
|
||||
<target name="codegen-client-elb" depends="download-ELB-wsdl">
|
||||
<wsdl2code wsdlfilename="${base.dir}/wsdl/ElasticLoadBalancing.wsdl" serverside="false" generateservicexml="false" skipbuildxml="true" serversideinterface="false" namespacetopackages="http://elasticloadbalancing.amazonaws.com/doc/2011-04-05/=com.amazon.elb.client" targetsourcefolderlocation="src" targetresourcesfolderlocation="resource/AmazonELB" overwrite="true" />
|
||||
</target>
|
||||
</project>
|
||||
|
|
@ -154,7 +154,7 @@
|
|||
</copy>
|
||||
</target>
|
||||
|
||||
<target name="deploy-server" depends="deploy-common, deploy-ovm, deploy-cloud-bridge" >
|
||||
<target name="deploy-server" depends="deploy-common, deploy-ovm, deploy-awsapi" >
|
||||
<copy todir="${server.deploy.to.dir}/webapps/client/WEB-INF/lib/vms" file="${dist.dir}/systemvm.iso" />
|
||||
</target>
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -139,7 +139,7 @@
|
|||
</zip>
|
||||
</target>
|
||||
|
||||
<target name="build-all" depends="build-opensource, build-ui, build-war-oss, compile-testclient, compile-usage, build-cloud-bridge">
|
||||
<target name="build-all" depends="build-opensource, build-ui, build-war-oss, compile-testclient, compile-usage, build-awsapi">
|
||||
</target>
|
||||
|
||||
<target name="build-all-with-simulator" depends="build-all, compile-agent-simulator">
|
||||
|
|
|
|||
|
|
@ -3,9 +3,5 @@
|
|||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/deps"/>
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/console"/>
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@
|
|||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
|
||||
package com.cloud.consoleproxy.util;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
<<<<<<< HEAD
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
|
|
@ -11,15 +10,12 @@
|
|||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
=======
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
package com.cloud.consoleproxy.vnc;
|
||||
|
||||
import java.awt.Canvas;
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
<<<<<<< HEAD
|
||||
import java.awt.Image;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.image.BufferedImage;
|
||||
|
|
@ -28,19 +24,12 @@ import java.util.List;
|
|||
|
||||
import com.cloud.consoleproxy.util.ImageHelper;
|
||||
import com.cloud.consoleproxy.util.TileInfo;
|
||||
=======
|
||||
import java.awt.image.BufferedImage;
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
|
||||
/**
|
||||
* A <code>BuffereImageCanvas</code> component represents frame buffer image on the
|
||||
* screen. It also notifies its subscribers when screen is repainted.
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
public class BufferedImageCanvas extends Canvas implements FrameBufferCanvas {
|
||||
=======
|
||||
public class BufferedImageCanvas extends Canvas {
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// Offline screen buffer
|
||||
|
|
@ -82,14 +71,9 @@ public class BufferedImageCanvas extends Canvas {
|
|||
public void paint(Graphics g) {
|
||||
// Only part of image, requested with repaint(Rectangle), will be
|
||||
// painted on screen.
|
||||
<<<<<<< HEAD
|
||||
synchronized(offlineImage) {
|
||||
g.drawImage(offlineImage, 0, 0, this);
|
||||
}
|
||||
=======
|
||||
g.drawImage(offlineImage, 0, 0, this);
|
||||
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
// Notify server that update is painted on screen
|
||||
listener.imagePaintedOnScreen();
|
||||
}
|
||||
|
|
@ -101,7 +85,6 @@ public class BufferedImageCanvas extends Canvas {
|
|||
public Graphics2D getOfflineGraphics() {
|
||||
return graphics;
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
|
||||
public void copyTile(Graphics2D g, int x, int y, Rectangle rc) {
|
||||
synchronized(offlineImage) {
|
||||
|
|
@ -164,7 +147,4 @@ public class BufferedImageCanvas extends Canvas {
|
|||
}
|
||||
return imgBits;
|
||||
}
|
||||
=======
|
||||
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
}
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
<<<<<<< HEAD
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
|
|
@ -11,8 +10,6 @@
|
|||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
=======
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
package com.cloud.consoleproxy.vnc;
|
||||
|
||||
public interface FrameBufferUpdateListener {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
<<<<<<< HEAD
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
|
|
@ -11,8 +10,6 @@
|
|||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
=======
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
package com.cloud.consoleproxy.vnc;
|
||||
|
||||
public interface PaintNotificationListener {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
<<<<<<< HEAD
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
|
|
@ -11,8 +10,6 @@
|
|||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
=======
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
package com.cloud.consoleproxy.vnc;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
|
|
|
|||
|
|
@ -1,40 +0,0 @@
|
|||
package com.cloud.consoleproxy.vnc;
|
||||
|
||||
public class SimpleLogger {
|
||||
|
||||
public static void log(String message) {
|
||||
System.out.println(getPrefix(1) + " LOG: " + message);
|
||||
}
|
||||
|
||||
public static void log(int skipFrames, String message) {
|
||||
System.out.println(getPrefix(1+skipFrames) + " LOG: " + message);
|
||||
}
|
||||
|
||||
public static void debug(String message) {
|
||||
System.out.println(getPrefix(1) + " DEBUG: " + message);
|
||||
}
|
||||
|
||||
public static void info(String message) {
|
||||
System.out.println(getPrefix(1) + " INFO: " + message);
|
||||
}
|
||||
|
||||
public static void warn(String message) {
|
||||
System.err.println(getPrefix(1) + " WARN: " + message);
|
||||
}
|
||||
|
||||
public static void error(String message) {
|
||||
System.err.println(getPrefix(1) + " ERROR: " + message);
|
||||
}
|
||||
|
||||
private static String getPrefix(int skipFrames) {
|
||||
StackTraceElement frame;
|
||||
try {
|
||||
throw new RuntimeException();
|
||||
} catch (Exception e) {
|
||||
frame = e.getStackTrace()[1+skipFrames];
|
||||
}
|
||||
|
||||
return "(" + frame.getFileName() + ":" + frame.getLineNumber() + ") " + frame.getMethodName() + "()";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
<<<<<<< HEAD
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
|
|
@ -11,8 +10,6 @@
|
|||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
=======
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
package com.cloud.consoleproxy.vnc;
|
||||
|
||||
import java.awt.Frame;
|
||||
|
|
@ -31,7 +28,6 @@ import javax.crypto.SecretKey;
|
|||
import javax.crypto.SecretKeyFactory;
|
||||
import javax.crypto.spec.DESKeySpec;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.cloud.consoleproxy.ConsoleProxyClientListener;
|
||||
import com.cloud.consoleproxy.util.Logger;
|
||||
import com.cloud.consoleproxy.util.RawHTTP;
|
||||
|
|
@ -40,9 +36,6 @@ import com.cloud.consoleproxy.vnc.packet.client.MouseEventPacket;
|
|||
|
||||
public class VncClient {
|
||||
private static final Logger s_logger = Logger.getLogger(VncClient.class);
|
||||
=======
|
||||
public class VncClient {
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
|
||||
private Socket socket;
|
||||
private DataInputStream is;
|
||||
|
|
@ -52,12 +45,9 @@ public class VncClient {
|
|||
|
||||
private VncClientPacketSender sender;
|
||||
private VncServerPacketReceiver receiver;
|
||||
<<<<<<< HEAD
|
||||
|
||||
private boolean noUI = false;
|
||||
private ConsoleProxyClientListener clientListener = null;
|
||||
=======
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
|
||||
public static void main(String args[]) {
|
||||
if (args.length < 3) {
|
||||
|
|
@ -70,7 +60,6 @@ public class VncClient {
|
|||
String password = args[2];
|
||||
|
||||
try {
|
||||
<<<<<<< HEAD
|
||||
new VncClient(host, Integer.parseInt(port), password, false, null);
|
||||
} catch (NumberFormatException e) {
|
||||
s_logger.error("Incorrect VNC server port number: " + port + ".");
|
||||
|
|
@ -84,27 +73,11 @@ public class VncClient {
|
|||
} catch (Throwable e) {
|
||||
s_logger.error("An error happened: " + e.getMessage());
|
||||
System.exit(1);
|
||||
=======
|
||||
new VncClient(host, Integer.parseInt(port), password);
|
||||
} catch (NumberFormatException e) {
|
||||
SimpleLogger.error("Incorrect VNC server port number: " + port + ".");
|
||||
System.exit(1);
|
||||
} catch (UnknownHostException e) {
|
||||
SimpleLogger.error("Incorrect VNC server host name: " + host + ".");
|
||||
System.exit(1);
|
||||
} catch (IOException e) {
|
||||
SimpleLogger.error("Cannot communicate with VNC server: " + e.getMessage());
|
||||
System.exit(1);
|
||||
} catch (Throwable e) {
|
||||
SimpleLogger.error("An error happened: " + e.getMessage());
|
||||
System.exit(1);
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
}
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
private static void printHelpMessage() {
|
||||
<<<<<<< HEAD
|
||||
/* LOG */s_logger.info("Usage: HOST PORT PASSWORD.");
|
||||
}
|
||||
|
||||
|
|
@ -174,44 +147,6 @@ public class VncClient {
|
|||
}
|
||||
|
||||
private void doConnect(String password) throws IOException {
|
||||
=======
|
||||
/* LOG */SimpleLogger.info("Usage: HOST PORT PASSWORD.");
|
||||
}
|
||||
|
||||
public VncClient(String host, int port, String password) throws UnknownHostException, IOException {
|
||||
connectTo(host, port, password);
|
||||
}
|
||||
|
||||
void shutdown() {
|
||||
sender.closeConnection();
|
||||
receiver.closeConnection();
|
||||
|
||||
try {
|
||||
is.close();
|
||||
} catch (Throwable e) {
|
||||
}
|
||||
|
||||
try {
|
||||
os.close();
|
||||
} catch (Throwable e) {
|
||||
}
|
||||
|
||||
try {
|
||||
socket.close();
|
||||
} catch (Throwable e) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void connectTo(String host, int port, String password) throws UnknownHostException, IOException {
|
||||
// If port number is too small, then interpret it as display number.
|
||||
if (port < 100)
|
||||
port += 5900;
|
||||
|
||||
// Connect to server
|
||||
SimpleLogger.info("Connecting to VNC server " + host + ":" + port + "...");
|
||||
this.socket = new Socket(host, port);
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
is = new DataInputStream(socket.getInputStream());
|
||||
os = new DataOutputStream(socket.getOutputStream());
|
||||
|
||||
|
|
@ -231,18 +166,13 @@ public class VncClient {
|
|||
canvas.addMouseMotionListener(sender);
|
||||
canvas.addKeyListener(sender);
|
||||
|
||||
<<<<<<< HEAD
|
||||
Frame frame = null;
|
||||
if(!noUI)
|
||||
frame = createVncClientMainWindow(canvas, screen.getDesktopName());
|
||||
=======
|
||||
Frame frame = createVncClientMainWindow(canvas, screen.getDesktopName());
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
|
||||
new Thread(sender).start();
|
||||
|
||||
// Run server-to-client packet receiver
|
||||
<<<<<<< HEAD
|
||||
receiver = new VncServerPacketReceiver(is, canvas, screen, this, sender, clientListener);
|
||||
try {
|
||||
receiver.run();
|
||||
|
|
@ -253,17 +183,6 @@ public class VncClient {
|
|||
}
|
||||
this.shutdown();
|
||||
}
|
||||
=======
|
||||
receiver = new VncServerPacketReceiver(is, canvas, screen, this, sender);
|
||||
try {
|
||||
receiver.run();
|
||||
} finally {
|
||||
frame.setVisible(false);
|
||||
frame.dispose();
|
||||
this.shutdown();
|
||||
}
|
||||
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
}
|
||||
|
||||
private Frame createVncClientMainWindow(BufferedImageCanvas canvas, String title) {
|
||||
|
|
@ -452,11 +371,8 @@ public class VncClient {
|
|||
int framebufferWidth = is.readUnsignedShort();
|
||||
int framebufferHeight = is.readUnsignedShort();
|
||||
screen.setFramebufferSize(framebufferWidth, framebufferHeight);
|
||||
<<<<<<< HEAD
|
||||
if(clientListener != null)
|
||||
clientListener.onFramebufferSizeChange(framebufferWidth, framebufferHeight);
|
||||
=======
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
}
|
||||
|
||||
// Read pixel format
|
||||
|
|
@ -490,7 +406,6 @@ public class VncClient {
|
|||
screen.setDesktopName(desktopName);
|
||||
}
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
|
||||
public FrameBufferCanvas getFrameBufferCanvas() {
|
||||
if(receiver != null)
|
||||
|
|
@ -517,7 +432,4 @@ public class VncClient {
|
|||
public boolean isHostConnected() {
|
||||
return receiver != null && receiver.isConnectionAlive();
|
||||
}
|
||||
=======
|
||||
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
<<<<<<< HEAD
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
|
|
@ -11,8 +10,6 @@
|
|||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
=======
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
package com.cloud.consoleproxy.vnc;
|
||||
|
||||
import java.awt.event.KeyEvent;
|
||||
|
|
@ -55,13 +52,10 @@ public class VncClientPacketSender implements Runnable, PaintNotificationListene
|
|||
sendSetEncodings();
|
||||
requestFullScreenUpdate();
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
|
||||
public void sendClientPacket(ClientPacket packet) {
|
||||
queue.add(packet);
|
||||
}
|
||||
=======
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
<<<<<<< HEAD
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
|
|
@ -11,8 +10,6 @@
|
|||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
=======
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
package com.cloud.consoleproxy.vnc;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
<<<<<<< HEAD
|
||||
// Copyright 2012 Citrix Systems, Inc. Licensed under the
|
||||
// Apache License, Version 2.0 (the "License"); you may not use this
|
||||
// file except in compliance with the License. Citrix Systems, Inc.
|
||||
|
|
@ -11,8 +10,6 @@
|
|||
// limitations under the License.
|
||||
//
|
||||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
=======
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
package com.cloud.consoleproxy.vnc;
|
||||
|
||||
import java.awt.Toolkit;
|
||||
|
|
@ -20,19 +17,13 @@ import java.awt.datatransfer.StringSelection;
|
|||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.cloud.consoleproxy.ConsoleProxyClientListener;
|
||||
import com.cloud.consoleproxy.util.Logger;
|
||||
=======
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
import com.cloud.consoleproxy.vnc.packet.server.FramebufferUpdatePacket;
|
||||
import com.cloud.consoleproxy.vnc.packet.server.ServerCutText;
|
||||
|
||||
public class VncServerPacketReceiver implements Runnable {
|
||||
<<<<<<< HEAD
|
||||
private static final Logger s_logger = Logger.getLogger(VncServerPacketReceiver.class);
|
||||
=======
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
|
||||
private final VncScreenDescription screen;
|
||||
private BufferedImageCanvas canvas;
|
||||
|
|
@ -41,29 +32,20 @@ public class VncServerPacketReceiver implements Runnable {
|
|||
private boolean connectionAlive = true;
|
||||
private VncClient vncConnection;
|
||||
private final FrameBufferUpdateListener fburListener;
|
||||
<<<<<<< HEAD
|
||||
private final ConsoleProxyClientListener clientListener;
|
||||
|
||||
public VncServerPacketReceiver(DataInputStream is, BufferedImageCanvas canvas, VncScreenDescription screen, VncClient vncConnection,
|
||||
FrameBufferUpdateListener fburListener, ConsoleProxyClientListener clientListener) {
|
||||
=======
|
||||
|
||||
public VncServerPacketReceiver(DataInputStream is, BufferedImageCanvas canvas, VncScreenDescription screen, VncClient vncConnection,
|
||||
FrameBufferUpdateListener fburListener) {
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
this.screen = screen;
|
||||
this.canvas = canvas;
|
||||
this.is = is;
|
||||
this.vncConnection = vncConnection;
|
||||
this.fburListener = fburListener;
|
||||
<<<<<<< HEAD
|
||||
this.clientListener = clientListener;
|
||||
}
|
||||
|
||||
public BufferedImageCanvas getCanvas() {
|
||||
return canvas;
|
||||
=======
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -82,11 +64,7 @@ public class VncServerPacketReceiver implements Runnable {
|
|||
// so it can send another frame buffer update request
|
||||
fburListener.frameBufferPacketReceived();
|
||||
// Handle frame buffer update
|
||||
<<<<<<< HEAD
|
||||
new FramebufferUpdatePacket(canvas, screen, is, clientListener);
|
||||
=======
|
||||
new FramebufferUpdatePacket(canvas, screen, is);
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -103,15 +81,9 @@ public class VncServerPacketReceiver implements Runnable {
|
|||
default:
|
||||
throw new RuntimeException("Unknown server packet type: " + messageType + ".");
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
|
||||
=======
|
||||
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
if (connectionAlive) {
|
||||
closeConnection();
|
||||
vncConnection.shutdown();
|
||||
|
|
@ -122,13 +94,10 @@ public class VncServerPacketReceiver implements Runnable {
|
|||
public void closeConnection() {
|
||||
connectionAlive = false;
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
|
||||
public boolean isConnectionAlive() {
|
||||
return connectionAlive;
|
||||
}
|
||||
=======
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
|
||||
/**
|
||||
* Handle server bell packet.
|
||||
|
|
@ -145,10 +114,6 @@ public class VncServerPacketReceiver implements Runnable {
|
|||
StringSelection contents = new StringSelection(clipboardContent.getContent());
|
||||
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(contents, null);
|
||||
|
||||
<<<<<<< HEAD
|
||||
s_logger.info("Server clipboard buffer: "+clipboardContent.getContent());
|
||||
=======
|
||||
SimpleLogger.info("Server clipboard buffer: "+clipboardContent.getContent());
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,10 +15,7 @@ package com.cloud.consoleproxy.vnc.packet.server;
|
|||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.cloud.consoleproxy.ConsoleProxyClientListener;
|
||||
=======
|
||||
>>>>>>> 52ebf15... Console proxy refactoring incremental check-in - new VNC protocol implementation
|
||||
import com.cloud.consoleproxy.vnc.BufferedImageCanvas;
|
||||
import com.cloud.consoleproxy.vnc.RfbConstants;
|
||||
import com.cloud.consoleproxy.vnc.VncScreenDescription;
|
||||
|
|
|
|||
|
|
@ -530,25 +530,14 @@ body.login {
|
|||
-webkit-box-shadow: 0px 4px 10px #B9B9B9;
|
||||
-o-box-shadow: 0px 4px 10px #B9B9B9;
|
||||
box-shadow: 0px 4px 10px #B9B9B9;
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
padding: 5px;
|
||||
=======
|
||||
padding: 0;
|
||||
>>>>>>> 6d8a11c... Complete localization for quick install wizard
|
||||
=======
|
||||
padding: 5px;
|
||||
>>>>>>> ccd7d8b... Install wizard: Conditionally load EULA
|
||||
/*+border-radius:4px;*/
|
||||
-moz-border-radius: 4px;
|
||||
-webkit-border-radius: 4px;
|
||||
-khtml-border-radius: 4px;
|
||||
border-radius: 4px 4px 4px 4px;
|
||||
overflow: auto;
|
||||
<<<<<<< HEAD
|
||||
overflow-x: hidden;
|
||||
=======
|
||||
>>>>>>> ccd7d8b... Install wizard: Conditionally load EULA
|
||||
}
|
||||
|
||||
.install-wizard .eula-copy p {
|
||||
|
|
@ -2857,7 +2846,6 @@ Dialogs*/
|
|||
-webkit-text-shadow: 0px 1px 1px #FFFFFF;
|
||||
-o-text-shadow: 0px 1px 1px #FFFFFF;
|
||||
text-shadow: 0px 1px 1px #FFFFFF;
|
||||
padding-bottom: 40px;
|
||||
}
|
||||
|
||||
.ui-dialog span.message ul {
|
||||
|
|
|
|||
350
ui/index.jsp
350
ui/index.jsp
|
|
@ -59,10 +59,7 @@
|
|||
<select name="language">
|
||||
<option value="en"><fmt:message key="label.lang.english"/></option>
|
||||
<option value="ja"><fmt:message key="label.lang.japanese"/></option>
|
||||
<<<<<<< HEAD
|
||||
<option value="zh_CN"><fmt:message key="label.lang.chinese"/></option>
|
||||
=======
|
||||
>>>>>>> d3cc43e... bug 13815
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -267,11 +264,7 @@
|
|||
|
||||
<!-- Service offering -->
|
||||
<div class="select-desc field service-offering hide-if-unselected">
|
||||
<<<<<<< HEAD
|
||||
<div class="name"><fmt:message key="label.network.offering"/></div>
|
||||
=======
|
||||
<div class="name"><fmt:message key="label.compute.offering"/></div>
|
||||
>>>>>>> 240dabe... Navigation organizational changes
|
||||
<div class="desc">
|
||||
<select name="new-network-networkofferingid">
|
||||
</select>
|
||||
|
|
@ -497,23 +490,11 @@
|
|||
zone-wizard-step-id="setupPhysicalNetwork"
|
||||
zone-wizard-prefilter="setupPhysicalNetwork">
|
||||
<ul class="subnav">
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
>>>>>>> 2f682ea... cloudstack 3.0 new UI - add zone wizard - localize text in html code.
|
||||
<li class="physical-network active"><fmt:message key="label.physical.network"/></li>
|
||||
<li class="public-network"><fmt:message key="label.public.traffic"/></li>
|
||||
<li class="pod"><fmt:message key="label.pod"/></li>
|
||||
<li class="guest-traffic"><fmt:message key="label.guest.traffic"/></li>
|
||||
<li class="conditional storage-traffic"><fmt:message key="label.storage.traffic"/></li>
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
<li class="physical-network active">Physical Network</li>
|
||||
<li class="public-network">Public traffic</li>
|
||||
<li class="pod">Pod</li>
|
||||
<li class="guest-traffic">Guest Traffic</li>
|
||||
<li class="conditional storage-traffic">Storage Traffic</li>
|
||||
>>>>>>> 5c06960... bug 13743: New zone wizard step -- configure storage traffic
|
||||
</ul>
|
||||
<div class="info-desc conditional advanced">
|
||||
<fmt:message key="message.setup.physical.network.during.zone.creation"/>
|
||||
|
|
@ -521,12 +502,6 @@
|
|||
<div class="info-desc conditional basic">
|
||||
<fmt:message key="message.setup.physical.network.during.zone.creation.basic"/>
|
||||
</div>
|
||||
=======
|
||||
</ul>
|
||||
<div class="info-desc">
|
||||
<fmt:message key="message.setup.physical.network.during.zone.creation"/>
|
||||
</div>
|
||||
>>>>>>> 2f682ea... cloudstack 3.0 new UI - add zone wizard - localize text in html code.
|
||||
<div class="button add new-physical-network"><span class="icon"> </span><span><fmt:message key="label.add.physical.network"/></span></div>
|
||||
|
||||
<!-- Traffic types drag area -->
|
||||
|
|
@ -616,26 +591,11 @@
|
|||
zone-wizard-form="basicPhysicalNetwork"
|
||||
zone-wizard-prefilter="addNetscalerDevice">
|
||||
<ul class="subnav">
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
<li class="conditional netscaler physical-network active"><fmt:message key="label.netScaler"/></li>
|
||||
=======
|
||||
<li class="conditional elb physical-network active"><fmt:message key="label.netScaler"/></li>
|
||||
>>>>>>> 2f682ea... cloudstack 3.0 new UI - add zone wizard - localize text in html code.
|
||||
<li class="public-network"><fmt:message key="label.public.traffic"/></li>
|
||||
<li class="pod"><fmt:message key="label.pod"/></li>
|
||||
<li class="guest-traffic"><fmt:message key="label.guest.traffic"/></li>
|
||||
<li class="conditional storage-traffic"><fmt:message key="label.storage.traffic"/></li>
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
<li class="conditional elb physical-network active">Netscaler</li>
|
||||
<li class="public-network">Public traffic</li>
|
||||
<li class="pod">Pod</li>
|
||||
<li class="guest-traffic">Guest Traffic</li>
|
||||
<li class="conditional storage-traffic">Storage Traffic</li>
|
||||
>>>>>>> 5c06960... bug 13743: New zone wizard step -- configure storage traffic
|
||||
=======
|
||||
>>>>>>> 2f682ea... cloudstack 3.0 new UI - add zone wizard - localize text in html code.
|
||||
</ul>
|
||||
|
||||
<div class="info-desc"><fmt:message key="label.please.specify.netscaler.info"/></div>
|
||||
|
|
@ -648,40 +608,16 @@
|
|||
<div class="setup-public-traffic" zone-wizard-prefilter="addPublicNetwork"
|
||||
zone-wizard-step-id="configurePublicTraffic">
|
||||
<ul class="subnav">
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
<li class="conditional netscaler physical-network"><fmt:message key="label.netScaler"/></li>
|
||||
=======
|
||||
<li class="conditional elb physical-network"><fmt:message key="label.netScaler"/></li>
|
||||
>>>>>>> 2f682ea... cloudstack 3.0 new UI - add zone wizard - localize text in html code.
|
||||
<li class="public-network active"><fmt:message key="label.public.traffic"/></li>
|
||||
<li class="pod"><fmt:message key="label.pod"/></li>
|
||||
<li class="guest-traffic"><fmt:message key="label.guest.traffic"/></li>
|
||||
<li class="conditional storage-traffic"><fmt:message key="label.storage.traffic"/></li>
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
<li class="conditional elb physical-network">Netscaler</li>
|
||||
<li class="public-network active">Public traffic</li>
|
||||
<li class="pod">Pod</li>
|
||||
<li class="guest-traffic">Guest Traffic</li>
|
||||
<li class="conditional storage-traffic">Storage Traffic</li>
|
||||
>>>>>>> 5c06960... bug 13743: New zone wizard step -- configure storage traffic
|
||||
</ul>
|
||||
|
||||
<div class="info-desc" id="add_zone_public_traffic_desc">
|
||||
<span id="for_basic_zone" style="display:none"><fmt:message key="message.public.traffic.in.basic.zone"/></span>
|
||||
<span id="for_advanced_zone" style="display:none"><fmt:message key="message.public.traffic.in.advanced.zone"/></span>
|
||||
=======
|
||||
</ul>
|
||||
|
||||
<div class="info-desc" id="add_zone_public_traffic_desc">
|
||||
<<<<<<< HEAD
|
||||
|
||||
>>>>>>> 2f682ea... cloudstack 3.0 new UI - add zone wizard - localize text in html code.
|
||||
=======
|
||||
<span id="for_basic_zone" style="display:none"><fmt:message key="message.public.traffic.in.basic.zone"/></span>
|
||||
<span id="for_advanced_zone" style="display:none"><fmt:message key="message.public.traffic.in.advanced.zone"/></span>
|
||||
>>>>>>> a56d465... cloudstack 3.0 new UI - add zone wizard - public traffic - show different description for basic zone and advanced zone.
|
||||
</div>
|
||||
<div ui-custom="publicTrafficIPRange"></div>
|
||||
</div>
|
||||
|
|
@ -690,26 +626,11 @@
|
|||
<div class="add-pod" zone-wizard-form="pod"
|
||||
zone-wizard-step-id="addPod">
|
||||
<ul class="subnav">
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
<li class="conditional netscaler physical-network"><fmt:message key="label.netScaler"/></li>
|
||||
=======
|
||||
<li class="conditional elb physical-network"><fmt:message key="label.netScaler"/></li>
|
||||
>>>>>>> 2f682ea... cloudstack 3.0 new UI - add zone wizard - localize text in html code.
|
||||
<li class="public-network"><fmt:message key="label.public.traffic"/></li>
|
||||
<li class="pod active"><fmt:message key="label.pod"/></li>
|
||||
<li class="guest-traffic"><fmt:message key="label.guest.traffic"/></li>
|
||||
<li class="conditional storage-traffic"><fmt:message key="label.storage.traffic"/></li>
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
<li class="conditional elb physical-network">Netscaler</li>
|
||||
<li class="public-network">Public traffic</li>
|
||||
<li class="pod active">Pod</li>
|
||||
<li class="guest-traffic">Guest Traffic</li>
|
||||
<li class="conditional storage-traffic">Storage Traffic</li>
|
||||
>>>>>>> 5c06960... bug 13743: New zone wizard step -- configure storage traffic
|
||||
=======
|
||||
>>>>>>> 2f682ea... cloudstack 3.0 new UI - add zone wizard - localize text in html code.
|
||||
</ul>
|
||||
|
||||
<div class="info-desc">
|
||||
|
|
@ -726,40 +647,16 @@
|
|||
zone-wizard-step-id="configureGuestTraffic"
|
||||
zone-wizard-prefilter="configureGuestTraffic">
|
||||
<ul class="subnav">
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
<li class="conditional netscaler physical-network"><fmt:message key="label.netScaler"/></li>
|
||||
=======
|
||||
<li class="conditional elb physical-network"><fmt:message key="label.netScaler"/></li>
|
||||
>>>>>>> 2f682ea... cloudstack 3.0 new UI - add zone wizard - localize text in html code.
|
||||
<li class="public-network"><fmt:message key="label.public.traffic"/></li>
|
||||
<li class="pod"><fmt:message key="label.pod"/></li>
|
||||
<li class="guest-traffic active"><fmt:message key="label.guest.traffic"/></li>
|
||||
<li class="conditional storage-traffic"><fmt:message key="label.storage.traffic"/></li>
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
<li class="conditional elb physical-network">Netscaler</li>
|
||||
<li class="public-network">Public traffic</li>
|
||||
<li class="pod">Pod</li>
|
||||
<li class="guest-traffic active">Guest Traffic</li>
|
||||
<li class="conditional storage-traffic">Storage Traffic</li>
|
||||
>>>>>>> 5c06960... bug 13743: New zone wizard step -- configure storage traffic
|
||||
</ul>
|
||||
|
||||
<div class="info-desc" id="add_zone_guest_traffic_desc">
|
||||
<span id="for_basic_zone" style="display:none"><fmt:message key="message.guest.traffic.in.basic.zone"/></span>
|
||||
<span id="for_advanced_zone" style="display:none"><fmt:message key="message.guest.traffic.in.advanced.zone"/></span>
|
||||
=======
|
||||
</ul>
|
||||
|
||||
<div class="info-desc" id="add_zone_guest_traffic_desc">
|
||||
<<<<<<< HEAD
|
||||
|
||||
>>>>>>> 2f682ea... cloudstack 3.0 new UI - add zone wizard - localize text in html code.
|
||||
=======
|
||||
<span id="for_basic_zone" style="display:none"><fmt:message key="message.guest.traffic.in.basic.zone"/></span>
|
||||
<span id="for_advanced_zone" style="display:none"><fmt:message key="message.guest.traffic.in.advanced.zone"/></span>
|
||||
>>>>>>> f0e3cad... cloudstack 3.0 new UI - add zone wizard - guest traffic - show different description for basic zone and advanced zone.
|
||||
</div>
|
||||
<div class="content input-area">
|
||||
<div class="select-container"></div>
|
||||
|
|
@ -770,38 +667,15 @@
|
|||
<div class="setup-storage-traffic" zone-wizard-prefilter="configureStorageTraffic"
|
||||
zone-wizard-step-id="configureStorageTraffic">
|
||||
<ul class="subnav">
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
<li class="conditional netscaler physical-network"><fmt:message key="label.netScaler"/></li>
|
||||
=======
|
||||
<li class="conditional elb physical-network"><fmt:message key="label.netScaler"/></li>
|
||||
>>>>>>> 2f682ea... cloudstack 3.0 new UI - add zone wizard - localize text in html code.
|
||||
<li class="public-network"><fmt:message key="label.public.traffic"/></li>
|
||||
<li class="pod"><fmt:message key="label.pod"/><</li>
|
||||
<li class="guest-traffic"><fmt:message key="label.guest.traffic"/></li>
|
||||
<li class="storage-traffic active"><fmt:message key="label.storage.traffic"/></li>
|
||||
<<<<<<< HEAD
|
||||
</ul>
|
||||
|
||||
<div class="info-desc">
|
||||
<fmt:message key="message.storage.traffic"/>
|
||||
=======
|
||||
<li class="conditional elb physical-network">Netscaler</li>
|
||||
<li class="public-network">Public traffic</li>
|
||||
<li class="pod">Pod</li>
|
||||
<li class="guest-traffic">Guest Traffic</li>
|
||||
<li class="storage-traffic active">Storage Traffic</li>
|
||||
</ul>
|
||||
|
||||
<div class="info-desc">
|
||||
Traffic between CloudStack's internal resources, including any components that communicate with the Management Server, such as hosts and CloudStack system VMs. Please configure storage traffic here.
|
||||
>>>>>>> 5c06960... bug 13743: New zone wizard step -- configure storage traffic
|
||||
=======
|
||||
</ul>
|
||||
|
||||
<div class="info-desc">
|
||||
<fmt:message key="message.storage.traffic"/>
|
||||
>>>>>>> 2f682ea... cloudstack 3.0 new UI - add zone wizard - localize text in html code.
|
||||
</div>
|
||||
<div ui-custom="storageTrafficIPRange"></div>
|
||||
</div>
|
||||
|
|
@ -877,11 +751,7 @@
|
|||
|
||||
<!-- Step 5: Launch -->
|
||||
<div class="review" zone-wizard-step-id="launch">
|
||||
<<<<<<< HEAD
|
||||
<div class="main-desc pre-setup"><fmt:message key="message.launch.zone"/></div>
|
||||
=======
|
||||
<div class="main-desc"><fmt:message key="label.launch.zone"/></div>
|
||||
>>>>>>> 2f682ea... cloudstack 3.0 new UI - add zone wizard - localize text in html code.
|
||||
<div class="main-desc launch" style="display:none;">
|
||||
<fmt:message key="message.please.wait.while.zone.is.being.created"/>
|
||||
</div>
|
||||
|
|
@ -928,12 +798,8 @@
|
|||
</li>
|
||||
<li class="firewall">
|
||||
<div class="name"><span><fmt:message key="label.firewall"/></span></div>
|
||||
<<<<<<< HEAD
|
||||
<!--<div class="view-details" net-target="staticNAT"><fmt:message key="label.view.all"/></div>-->
|
||||
<div class="view-details" net-target="firewall"><fmt:message key="label.view.all"/>
|
||||
=======
|
||||
<div class="view-details" net-target="staticNAT"><fmt:message key="label.view.all"/></div>
|
||||
>>>>>>> fab34ce... cloudstack 3.0 new UI - system - network chart - localize text in html code.
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
@ -1072,24 +938,18 @@
|
|||
<!-- System dashboard -->
|
||||
<div class="system-dashboard-view">
|
||||
<div class="toolbar">
|
||||
<<<<<<< HEAD
|
||||
<div class="button refresh" id="refresh_button">
|
||||
<span><fmt:message key="label.refresh"/></span>
|
||||
</div>
|
||||
<div id="update_ssl_button" class="button action main-action reduced-hide lock">
|
||||
<span class="icon"> </span>
|
||||
<span>Update SSL Certificate</span>
|
||||
=======
|
||||
<div class="button refresh">
|
||||
<span><fmt:message key="label.refresh"/></span>
|
||||
>>>>>>> fab34ce... cloudstack 3.0 new UI - system - network chart - localize text in html code.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Zone dashboard -->
|
||||
<div class="system-dashboard zone">
|
||||
<div class="head">
|
||||
<<<<<<< HEAD
|
||||
<span><fmt:message key="label.menu.infrastructure"/></span>
|
||||
<div class="view-all zones"
|
||||
view-all-title="Zones"
|
||||
|
|
@ -1098,53 +958,32 @@
|
|||
<ul class="status_box good">
|
||||
<li class="block">
|
||||
<span class="header"><fmt:message key="label.zones"/></span>
|
||||
=======
|
||||
<span><fmt:message key="label.zones"/></span>
|
||||
<div class="view-more"><span><fmt:message key="label.view.more"/></span></div>
|
||||
</div>
|
||||
<ul class="status_box good">
|
||||
<li class="block">
|
||||
<span class="header"><fmt:message key="label.number.of.zones"/></span>
|
||||
>>>>>>> fab34ce... cloudstack 3.0 new UI - system - network chart - localize text in html code.
|
||||
<span class="overview total" data-item="zoneCount"></span>
|
||||
<span class="button view-all zones"
|
||||
view-all-title="<fmt:message key="label.zones"/>"
|
||||
view-all-target="zones"><fmt:message key="label.view.all"/></span>
|
||||
</li>
|
||||
<li class="block">
|
||||
<<<<<<< HEAD
|
||||
<span class="header"><fmt:message key="label.pods"/></span>
|
||||
=======
|
||||
<span class="header"><fmt:message key="label.number.of.pods"/></span>
|
||||
>>>>>>> fab34ce... cloudstack 3.0 new UI - system - network chart - localize text in html code.
|
||||
<span class="overview total" data-item="podCount"></span>
|
||||
<span class="button view-all pods"
|
||||
view-all-title="<fmt:message key="label.pods"/>"
|
||||
view-all-target="pods"><fmt:message key="label.view.all"/></span>
|
||||
</li>
|
||||
<li class="block">
|
||||
<<<<<<< HEAD
|
||||
<span class="header"><fmt:message key="label.clusters"/></span>
|
||||
=======
|
||||
<span class="header"><fmt:message key="label.number.of.clusters"/></span>
|
||||
>>>>>>> fab34ce... cloudstack 3.0 new UI - system - network chart - localize text in html code.
|
||||
<span class="overview total" data-item="clusterCount"></span>
|
||||
<span class="button view-all clusters"
|
||||
view-all-title="<fmt:message key="label.clusters"/>"
|
||||
view-all-target="clusters"><fmt:message key="label.view.all"/></span>
|
||||
</li>
|
||||
<li class="block last">
|
||||
<<<<<<< HEAD
|
||||
<span class="header"><fmt:message key="label.hosts"/></span>
|
||||
=======
|
||||
<span class="header"><fmt:message key="label.number.of.hosts"/></span>
|
||||
>>>>>>> fab34ce... cloudstack 3.0 new UI - system - network chart - localize text in html code.
|
||||
<span class="overview total" data-item="hostCount"></span>
|
||||
<span class="button view-all hosts"
|
||||
view-all-title="<fmt:message key="label.hosts"/>"
|
||||
view-all-target="hosts"><fmt:message key="label.view.all"/></span>
|
||||
</li>
|
||||
<<<<<<< HEAD
|
||||
<li class="block">
|
||||
<span class="header"><fmt:message key="label.primary.storage"/></span>
|
||||
<span class="overview total" data-item="primaryStorageCount"></span>
|
||||
|
|
@ -1165,33 +1004,6 @@
|
|||
<span class="button view-all clusters"
|
||||
view-all-title="<fmt:message key="label.system.vms"/>"
|
||||
view-all-target="systemVms"><fmt:message key="label.view.all"/></span>
|
||||
=======
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- Host dashboard -->
|
||||
<div class="system-dashboard">
|
||||
<div class="head">
|
||||
<span<fmt:message key="label.hosts"/></span>
|
||||
<div class="view-more"><span><fmt:message key="label.view.more"/></span></div>
|
||||
</div>
|
||||
<ul class="status_box good">
|
||||
<li class="block">
|
||||
<span class="header"><fmt:message key="label.total.hosts"/></span>
|
||||
<span class="overview total" data-item="hostCount"></span>
|
||||
</li>
|
||||
<li class="block capacity">
|
||||
<span class="header"><fmt:message key="label.total.CPU"/></span>
|
||||
<span class="overview total" data-item="cpuCapacityTotal"></span>
|
||||
</li>
|
||||
<li class="block capacity">
|
||||
<span class="header"><fmt:message key="label.total.memory"/></span>
|
||||
<span class="overview total" data-item="memCapacityTotal"></span>
|
||||
</li>
|
||||
<li class="block last capacity">
|
||||
<span class="header"><fmt:message key="label.total.storage"/></span>
|
||||
<span class="overview total" data-item="storageCapacityTotal"></span>
|
||||
>>>>>>> fab34ce... cloudstack 3.0 new UI - system - network chart - localize text in html code.
|
||||
</li>
|
||||
<li class="block last">
|
||||
<span class="header"><fmt:message key="label.virtual.routers"/></span>
|
||||
|
|
@ -1859,9 +1671,6 @@
|
|||
|
||||
<script language="javascript">
|
||||
dictionary = {
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
'message.setup.physical.network.during.zone.creation.basic': '<fmt:message key="message.setup.physical.network.during.zone.creation.basic"/>',
|
||||
'label.traffic.label': '<fmt:message key="label.traffic.label"/>',
|
||||
'label.management.ips': '<fmt:message key="label.management.ips"/>',
|
||||
|
|
@ -1882,8 +1691,6 @@ dictionary = {
|
|||
'label.guest': '<fmt:message key="label.guest"/>',
|
||||
'label.network.service.providers': '<fmt:message key="label.network.service.providers"/>',
|
||||
'message.launch.zone': '<fmt:message key="message.launch.zone"/>',
|
||||
=======
|
||||
>>>>>>> 240dabe... Navigation organizational changes
|
||||
'label.compute.offering': '<fmt:message key="label.compute.offering"/>',
|
||||
'label.add.compute.offering': '<fmt:message key="label.add.compute.offering"/>',
|
||||
'label.compute.offerings': '<fmt:message key="label.compute.offerings"/>',
|
||||
|
|
@ -1913,17 +1720,10 @@ dictionary = {
|
|||
'label.nat.port.range': '<fmt:message key="label.nat.port.range"/>',
|
||||
'label.static.nat.vm.details': '<fmt:message key="label.static.nat.vm.details"/>',
|
||||
'label.edit.lb.rule': '<fmt:message key="label.edit.lb.rule"/>',
|
||||
=======
|
||||
>>>>>>> 4b2709c... Add missing localization for instances.js
|
||||
'message.migrate.instance.to.host': '<fmt:message key="message.migrate.instance.to.host"/>',
|
||||
'label.migrate.instance.to.host': '<fmt:message key="label.migrate.instance.to.host"/>',
|
||||
'message.migrate.instance.to.ps': '<fmt:message key="message.migrate.instance.to.ps"/>',
|
||||
'label.migrate.instance.to.ps': '<fmt:message key="label.migrate.instance.to.ps"/>',
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
>>>>>>> 6d8a11c... Complete localization for quick install wizard
|
||||
=======
|
||||
>>>>>>> 4b2709c... Add missing localization for instances.js
|
||||
'label.corrections.saved': '<fmt:message key="label.corrections.saved"/>',
|
||||
'message.installWizard.copy.whatIsSecondaryStorage': '<fmt:message key="message.installWizard.copy.whatIsSecondaryStorage"/>',
|
||||
'message.installWizard.copy.whatIsPrimaryStorage': '<fmt:message key="message.installWizard.copy.whatIsPrimaryStorage"/>',
|
||||
|
|
@ -2045,7 +1845,6 @@ dictionary = {
|
|||
'label.select.a.template': '<fmt:message key="label.select.a.template"/>',
|
||||
'label.setup': '<fmt:message key="label.setup"/>',
|
||||
'state.Allocated': '<fmt:message key="state.Allocated"/>',
|
||||
|
||||
'changed.item.properties': '<fmt:message key="changed.item.properties"/>',
|
||||
'label.apply': '<fmt:message key="label.apply"/>',
|
||||
'label.default': '<fmt:message key="label.default"/>',
|
||||
|
|
@ -3029,10 +2828,6 @@ dictionary = {
|
|||
'label.created.by.system': '<fmt:message key="label.created.by.system" />',
|
||||
'label.menu.system.service.offerings': '<fmt:message key="label.menu.system.service.offerings" />',
|
||||
'label.add.system.service.offering': '<fmt:message key="label.add.system.service.offering" />',
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
>>>>>>> 577f3a5... cloudstack 3.0 new UI - correct localization label format
|
||||
'label.redundant.router.capability': '<fmt:message key="label.redundant.router.capability" />',
|
||||
'label.supported.source.NAT.type': '<fmt:message key="label.supported.source.NAT.type" />',
|
||||
'label.elastic.LB': '<fmt:message key="label.elastic.LB" />',
|
||||
|
|
@ -3045,27 +2840,10 @@ dictionary = {
|
|||
'label.start.IP': '<fmt:message key="label.start.IP" />',
|
||||
'label.end.IP': '<fmt:message key="label.end.IP" />',
|
||||
'label.remove.ip.range': '<fmt:message key="label.remove.ip.range" />',
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
>>>>>>> e8c309b... cloudstack 3.0 new UI - add more localization labels.
|
||||
'label.ip.ranges': '<fmt:message key="label.ip.ranges" />',
|
||||
'label.start.vlan': '<fmt:message key="label.start.vlan" />',
|
||||
'label.end.vlan': '<fmt:message key="label.end.vlan" />',
|
||||
'label.broadcast.domain.range': '<fmt:message key="label.broadcast.domain.range" />',
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
'storage.traffic.type.is.updated': '<fmt:message key="storage.traffic.type.is.updated" />',
|
||||
'management.traffic.type.is.updated': '<fmt:message key="management.traffic.type.is.updated" />',
|
||||
'public.traffic.type.is.updated': '<fmt:message key="public.traffic.type.is.updated" />',
|
||||
'guest.traffic.type.is.updated': '<fmt:message key="guest.traffic.type.is.updated" />',
|
||||
'IP.ranges': '<fmt:message key="IP.ranges" />',
|
||||
'start.Vlan': '<fmt:message key="start.Vlan" />',
|
||||
'end.Vlan': '<fmt:message key="end.Vlan" />',
|
||||
'broadcast.domain.range': '<fmt:message key="broadcast.domain.range" />',
|
||||
>>>>>>> 577f3a5... cloudstack 3.0 new UI - correct localization label format
|
||||
=======
|
||||
>>>>>>> e8c309b... cloudstack 3.0 new UI - add more localization labels.
|
||||
'label.compute': '<fmt:message key="label.compute" />',
|
||||
'message.add.guest.network': '<fmt:message key="message.add.guest.network" />',
|
||||
'label.subdomain.access': '<fmt:message key="label.subdomain.access" />',
|
||||
|
|
@ -3080,10 +2858,6 @@ dictionary = {
|
|||
'label.change.service.offering': '<fmt:message key="label.change.service.offering" />',
|
||||
'label.view.console': '<fmt:message key="label.view.console" />',
|
||||
'label.redundant.state': '<fmt:message key="label.redundant.state" />',
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
>>>>>>> c3c5b65... cloudstack 3.0 new UI - add more localization labels.
|
||||
'label.enable.provider': '<fmt:message key="label.enable.provider" />',
|
||||
'message.confirm.enable.provider': '<fmt:message key="message.confirm.enable.provider" />',
|
||||
'label.disable.provider': '<fmt:message key="label.disable.provider" />',
|
||||
|
|
@ -3103,32 +2877,6 @@ dictionary = {
|
|||
'label.public.network': '<fmt:message key="label.public.network" />',
|
||||
'label.private.network': '<fmt:message key="label.private.network" />',
|
||||
'label.enable.swift': '<fmt:message key="label.enable.swift" />',
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
'enable.provider': '<fmt:message key="enable.provider" />',
|
||||
'confirm.enable.provider': '<fmt:message key="confirm.enable.provider" />',
|
||||
'disable.provider': '<fmt:message key="disable.provider" />',
|
||||
'confirm.disable.provider': '<fmt:message key="confirm.disable.provider" />',
|
||||
'shutdown.provider': '<fmt:message key="shutdown.provider" />',
|
||||
'confirm.shutdown.provider': '<fmt:message key="confirm.shutdown.provider" />',
|
||||
'NetScaler': '<fmt:message key="NetScaler" />',
|
||||
'add.new.NetScaler': '<fmt:message key="add.new.NetScaler" />',
|
||||
'number.of.retries': '<fmt:message key="number.of.retries" />',
|
||||
'capacity': '<fmt:message key="capacity" />',
|
||||
'dedicated': '<fmt:message key="dedicated" />',
|
||||
'F5': '<fmt:message key="F5" />',
|
||||
'add.new.F5': '<fmt:message key="add.new.F5" />',
|
||||
'SRX': '<fmt:message key="SRX" />',
|
||||
'providers': '<fmt:message key="providers" />',
|
||||
'add.new.SRX': '<fmt:message key="add.new.SRX" />',
|
||||
'timeout': '<fmt:message key="timeout" />',
|
||||
'public.network': '<fmt:message key="public.network" />',
|
||||
'private.network': '<fmt:message key="private.network" />',
|
||||
'public': '<fmt:message key="public" />',
|
||||
'enable.swift': '<fmt:message key="enable.swift" />',
|
||||
>>>>>>> e8c309b... cloudstack 3.0 new UI - add more localization labels.
|
||||
=======
|
||||
>>>>>>> c3c5b65... cloudstack 3.0 new UI - add more localization labels.
|
||||
'confirm.enable.swift': '<fmt:message key="confirm.enable.swift" />',
|
||||
'message.after.enable.swift': '<fmt:message key="message.after.enable.swift" />',
|
||||
'label.key': '<fmt:message key="label.key" />',
|
||||
|
|
@ -3139,16 +2887,11 @@ dictionary = {
|
|||
'label.delete.SRX': '<fmt:message key="label.delete.SRX" />',
|
||||
'message.confirm.delete.SRX': '<fmt:message key="message.confirm.delete.SRX" />',
|
||||
'label.pods': '<fmt:message key="label.pods" />',
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
>>>>>>> c3c5b65... cloudstack 3.0 new UI - add more localization labels.
|
||||
'label.pod.name': '<fmt:message key="label.pod.name" />',
|
||||
'label.reserved.system.gateway': '<fmt:message key="label.reserved.system.gateway" />',
|
||||
'label.reserved.system.netmask': '<fmt:message key="label.reserved.system.netmask" />',
|
||||
'label.start.reserved.system.IP': '<fmt:message key="label.start.reserved.system.IP" />',
|
||||
'label.end.reserved.system.IP': '<fmt:message key="label.end.reserved.system.IP" />',
|
||||
<<<<<<< HEAD
|
||||
'label.clusters': '<fmt:message key="label.clusters" />',
|
||||
'label.cluster.name': '<fmt:message key="label.cluster.name" />',
|
||||
'label.host.MAC': '<fmt:message key="label.host.MAC" />',
|
||||
|
|
@ -3213,98 +2956,5 @@ dictionary = {
|
|||
'label.action.register.template': '<fmt:message key="label.action.register.template" />',
|
||||
'label.action.register.iso': '<fmt:message key="label.action.register.iso" />',
|
||||
'label.isolation.method': '<fmt:message key="label.isolation.method" />'
|
||||
=======
|
||||
'pod.name': '<fmt:message key="pod.name" />',
|
||||
'reserved.system.gateway': '<fmt:message key="reserved.system.gateway" />',
|
||||
'reserved.system.netmask': '<fmt:message key="reserved.system.netmask" />',
|
||||
'start.reserved.system.IP': '<fmt:message key="start.reserved.system.IP" />',
|
||||
'end.reserved.system.IP': '<fmt:message key="end.reserved.system.IP" />',
|
||||
'label.clusters': '<fmt:message key="label.clusters" />',
|
||||
'cluster.name': '<fmt:message key="cluster.name" />',
|
||||
'host.MAC': '<fmt:message key="host.MAC" />',
|
||||
'agent.username': '<fmt:message key="agent.username" />',
|
||||
'agent.password': '<fmt:message key="agent.password" />',
|
||||
'confirm.action.force.reconnect': '<fmt:message key="confirm.action.force.reconnect" />',
|
||||
<<<<<<< HEAD
|
||||
'resource.state': '<fmt:message key="resource.state" />'
|
||||
>>>>>>> 3536a2e... cloudstack 3.0 new UI - system page - localize host section.
|
||||
=======
|
||||
'resource.state': '<fmt:message key="resource.state" />',
|
||||
<<<<<<< HEAD
|
||||
'LUN.number': '<fmt:message key="LUN.number" />'
|
||||
>>>>>>> 50fadb4... cloudstack 3.0 new UI - system page - localize primary storage section.
|
||||
=======
|
||||
'LUN.number': '<fmt:message key="LUN.number" />',
|
||||
<<<<<<< HEAD
|
||||
'confirm.remove.IP.range': '<fmt:message key="confirm.remove.IP.range" />'
|
||||
>>>>>>> 0341d00... cloudstack 3.0 new UI - system page - localize IP Ranges sections.
|
||||
=======
|
||||
'confirm.remove.IP.range': '<fmt:message key="confirm.remove.IP.range" />',
|
||||
=======
|
||||
'label.clusters': '<fmt:message key="label.clusters" />',
|
||||
'label.cluster.name': '<fmt:message key="label.cluster.name" />',
|
||||
'label.host.MAC': '<fmt:message key="label.host.MAC" />',
|
||||
'label.agent.username': '<fmt:message key="label.agent.username" />',
|
||||
'label.agent.password': '<fmt:message key="label.agent.password" />',
|
||||
'message.confirm.action.force.reconnect': '<fmt:message key="message.confirm.action.force.reconnect" />',
|
||||
'label.resource.state': '<fmt:message key="label.resource.state" />',
|
||||
'label.LUN.number': '<fmt:message key="label.LUN.number" />',
|
||||
'message.confirm.remove.IP.range': '<fmt:message key="message.confirm.remove.IP.range" />',
|
||||
<<<<<<< HEAD
|
||||
>>>>>>> c3c5b65... cloudstack 3.0 new UI - add more localization labels.
|
||||
'tooltip.zone.name': '<fmt:message key="tooltip.zone.name" />',
|
||||
'tooltip.dns.1': '<fmt:message key="tooltip.dns.1" />',
|
||||
'tooltip.dns.2': '<fmt:message key="tooltip.dns.2" />',
|
||||
'tooltip.internal.dns.1': '<fmt:message key="tooltip.internal.dns.1" />',
|
||||
'tooltip.internal.dns.2': '<fmt:message key="tooltip.internal.dns.2" />',
|
||||
'tooltip.network.domain': '<fmt:message key="tooltip.network.domain" />',
|
||||
'tooltip.pod.name': '<fmt:message key="tooltip.pod.name" />',
|
||||
'tooltip.reserved.system.gateway': '<fmt:message key="tooltip.reserved.system.gateway" />',
|
||||
'tooltip.reserved.system.netmask': '<fmt:message key="tooltip.reserved.system.netmask" />',
|
||||
'creating.zone': '<fmt:message key="creating.zone" />',
|
||||
'creating.physical.networks': '<fmt:message key="creating.physical.networks" />',
|
||||
'configuring.physical.networks': '<fmt:message key="configuring.physical.networks" />',
|
||||
'adding.Netscaler.device': '<fmt:message key="adding.Netscaler.device" />',
|
||||
'creating.pod': '<fmt:message key="creating.pod" />',
|
||||
'configuring.public.traffic': '<fmt:message key="configuring.public.traffic" />',
|
||||
'configuring.storage.traffic': '<fmt:message key="configuring.storage.traffic" />',
|
||||
'configuring.guest.traffic': '<fmt:message key="configuring.guest.traffic" />',
|
||||
'creating.cluster': '<fmt:message key="creating.cluster" />',
|
||||
'adding.host': '<fmt:message key="adding.host" />',
|
||||
'creating.primary.storage': '<fmt:message key="creating.primary.storage" />',
|
||||
'creating.secondary.storage': '<fmt:message key="creating.secondary.storage" />',
|
||||
'Zone.creation.complete': '<fmt:message key="Zone.creation.complete" />',
|
||||
=======
|
||||
'message.tooltip.zone.name': '<fmt:message key="message.tooltip.zone.name" />',
|
||||
'message.tooltip.dns.1': '<fmt:message key="message.tooltip.dns.1" />',
|
||||
'message.tooltip.dns.2': '<fmt:message key="message.tooltip.dns.2" />',
|
||||
'message.tooltip.internal.dns.1': '<fmt:message key="message.tooltip.internal.dns.1" />',
|
||||
'message.tooltip.internal.dns.2': '<fmt:message key="message.tooltip.internal.dns.2" />',
|
||||
'message.tooltip.network.domain': '<fmt:message key="message.tooltip.network.domain" />',
|
||||
'message.tooltip.pod.name': '<fmt:message key="message.tooltip.pod.name" />',
|
||||
'message.tooltip.reserved.system.gateway': '<fmt:message key="message.tooltip.reserved.system.gateway" />',
|
||||
'message.tooltip.reserved.system.netmask': '<fmt:message key="message.tooltip.reserved.system.netmask" />',
|
||||
'message.creating.zone': '<fmt:message key="message.creating.zone" />',
|
||||
'message.creating.physical.networks': '<fmt:message key="message.creating.physical.networks" />',
|
||||
'message.configuring.physical.networks': '<fmt:message key="message.configuring.physical.networks" />',
|
||||
'message.adding.Netscaler.device': '<fmt:message key="message.adding.Netscaler.device" />',
|
||||
'message.creating.pod': '<fmt:message key="message.creating.pod" />',
|
||||
'message.configuring.public.traffic': '<fmt:message key="message.configuring.public.traffic" />',
|
||||
'message.configuring.storage.traffic': '<fmt:message key="message.configuring.storage.traffic" />',
|
||||
'message.configuring.guest.traffic': '<fmt:message key="message.configuring.guest.traffic" />',
|
||||
'message.creating.cluster': '<fmt:message key="message.creating.cluster" />',
|
||||
'message.adding.host': '<fmt:message key="message.adding.host" />',
|
||||
'message.creating.primary.storage': '<fmt:message key="message.creating.primary.storage" />',
|
||||
'message.creating.secondary.storage': '<fmt:message key="message.creating.secondary.storage" />',
|
||||
'message.Zone.creation.complete': '<fmt:message key="message.Zone.creation.complete" />',
|
||||
>>>>>>> 9f86abc... cloudstack 3.0 new UI - add more localization labels.
|
||||
'message.enabling.zone': '<fmt:message key="message.enabling.zone" />',
|
||||
'error.something.went.wrong.please.correct.the.following': '<fmt:message key="error.something.went.wrong.please.correct.the.following" />',
|
||||
'error.could.not.enable.zone': '<fmt:message key="error.could.not.enable.zone" />',
|
||||
'message.zone.creation.complete.would.you.like.to.enable.this.zone': '<fmt:message key="message.zone.creation.complete.would.you.like.to.enable.this.zone" />',
|
||||
'message.please.add.at.lease.one.traffic.range': '<fmt:message key="message.please.add.at.lease.one.traffic.range" />',
|
||||
'message.you.must.have.at.least.one.physical.network': '<fmt:message key="message.you.must.have.at.least.one.physical.network" />',
|
||||
'message.please.select.a.different.public.and.management.network.before.removing': '<fmt:message key="message.please.select.a.different.public.and.management.network.before.removing" />'
|
||||
>>>>>>> 68f12d9... cloudstack 3.0 new UI - localize messages during zone creation.
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -1,233 +0,0 @@
|
|||
/**
|
||||
* QUnit v1.4.0pre - A JavaScript Unit Testing Framework
|
||||
*
|
||||
* http://docs.jquery.com/QUnit
|
||||
*
|
||||
* Copyright (c) 2012 John Resig, Jörn Zaefferer
|
||||
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
||||
* or GPL (GPL-LICENSE.txt) licenses.
|
||||
*/
|
||||
|
||||
/** Font Family and Sizes */
|
||||
|
||||
#qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult {
|
||||
font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
#qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; }
|
||||
#qunit-tests { font-size: smaller; }
|
||||
|
||||
|
||||
/** Resets */
|
||||
|
||||
#qunit-tests, #qunit-tests ol, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
|
||||
/** Header */
|
||||
|
||||
#qunit-header {
|
||||
padding: 0.5em 0 0.5em 1em;
|
||||
|
||||
color: #8699a4;
|
||||
background-color: #0d3349;
|
||||
|
||||
font-size: 1.5em;
|
||||
line-height: 1em;
|
||||
font-weight: normal;
|
||||
|
||||
border-radius: 15px 15px 0 0;
|
||||
-moz-border-radius: 15px 15px 0 0;
|
||||
-webkit-border-top-right-radius: 15px;
|
||||
-webkit-border-top-left-radius: 15px;
|
||||
}
|
||||
|
||||
#qunit-header a {
|
||||
text-decoration: none;
|
||||
color: #c2ccd1;
|
||||
}
|
||||
|
||||
#qunit-header a:hover,
|
||||
#qunit-header a:focus {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
#qunit-header label {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
#qunit-banner {
|
||||
height: 5px;
|
||||
}
|
||||
|
||||
#qunit-testrunner-toolbar {
|
||||
padding: 0.5em 0 0.5em 2em;
|
||||
color: #5E740B;
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
#qunit-userAgent {
|
||||
padding: 0.5em 0 0.5em 2.5em;
|
||||
background-color: #2b81af;
|
||||
color: #fff;
|
||||
text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;
|
||||
}
|
||||
|
||||
|
||||
/** Tests: Pass/Fail */
|
||||
|
||||
#qunit-tests {
|
||||
list-style-position: inside;
|
||||
}
|
||||
|
||||
#qunit-tests li {
|
||||
padding: 0.4em 0.5em 0.4em 2.5em;
|
||||
border-bottom: 1px solid #fff;
|
||||
list-style-position: inside;
|
||||
}
|
||||
|
||||
#qunit-tests.hidepass li.pass, #qunit-tests.hidepass li.running {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#qunit-tests li strong {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#qunit-tests li a {
|
||||
padding: 0.5em;
|
||||
color: #c2ccd1;
|
||||
text-decoration: none;
|
||||
}
|
||||
#qunit-tests li a:hover,
|
||||
#qunit-tests li a:focus {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
#qunit-tests ol {
|
||||
margin-top: 0.5em;
|
||||
padding: 0.5em;
|
||||
|
||||
background-color: #fff;
|
||||
|
||||
border-radius: 15px;
|
||||
-moz-border-radius: 15px;
|
||||
-webkit-border-radius: 15px;
|
||||
|
||||
box-shadow: inset 0px 2px 13px #999;
|
||||
-moz-box-shadow: inset 0px 2px 13px #999;
|
||||
-webkit-box-shadow: inset 0px 2px 13px #999;
|
||||
}
|
||||
|
||||
#qunit-tests table {
|
||||
border-collapse: collapse;
|
||||
margin-top: .2em;
|
||||
}
|
||||
|
||||
#qunit-tests th {
|
||||
text-align: right;
|
||||
vertical-align: top;
|
||||
padding: 0 .5em 0 0;
|
||||
}
|
||||
|
||||
#qunit-tests td {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
#qunit-tests pre {
|
||||
margin: 0;
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
#qunit-tests del {
|
||||
background-color: #e0f2be;
|
||||
color: #374e0c;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#qunit-tests ins {
|
||||
background-color: #ffcaca;
|
||||
color: #500;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/*** Test Counts */
|
||||
|
||||
#qunit-tests b.counts { color: black; }
|
||||
#qunit-tests b.passed { color: #5E740B; }
|
||||
#qunit-tests b.failed { color: #710909; }
|
||||
|
||||
#qunit-tests li li {
|
||||
margin: 0.5em;
|
||||
padding: 0.4em 0.5em 0.4em 0.5em;
|
||||
background-color: #fff;
|
||||
border-bottom: none;
|
||||
list-style-position: inside;
|
||||
}
|
||||
|
||||
/*** Passing Styles */
|
||||
|
||||
#qunit-tests li li.pass {
|
||||
color: #5E740B;
|
||||
background-color: #fff;
|
||||
border-left: 26px solid #C6E746;
|
||||
}
|
||||
|
||||
#qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; }
|
||||
#qunit-tests .pass .test-name { color: #366097; }
|
||||
|
||||
#qunit-tests .pass .test-actual,
|
||||
#qunit-tests .pass .test-expected { color: #999999; }
|
||||
|
||||
#qunit-banner.qunit-pass { background-color: #C6E746; }
|
||||
|
||||
/*** Failing Styles */
|
||||
|
||||
#qunit-tests li li.fail {
|
||||
color: #710909;
|
||||
background-color: #fff;
|
||||
border-left: 26px solid #EE5757;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
#qunit-tests > li:last-child {
|
||||
border-radius: 0 0 15px 15px;
|
||||
-moz-border-radius: 0 0 15px 15px;
|
||||
-webkit-border-bottom-right-radius: 15px;
|
||||
-webkit-border-bottom-left-radius: 15px;
|
||||
}
|
||||
|
||||
#qunit-tests .fail { color: #000000; background-color: #EE5757; }
|
||||
#qunit-tests .fail .test-name,
|
||||
#qunit-tests .fail .module-name { color: #000000; }
|
||||
|
||||
#qunit-tests .fail .test-actual { color: #EE5757; }
|
||||
#qunit-tests .fail .test-expected { color: green; }
|
||||
|
||||
#qunit-banner.qunit-fail { background-color: #EE5757; }
|
||||
|
||||
|
||||
/** Result */
|
||||
|
||||
#qunit-testresult {
|
||||
padding: 0.5em 0.5em 0.5em 2.5em;
|
||||
|
||||
color: #2b81af;
|
||||
background-color: #D2E0E6;
|
||||
|
||||
border-bottom: 1px solid white;
|
||||
}
|
||||
|
||||
/** Fixture */
|
||||
|
||||
#qunit-fixture {
|
||||
position: absolute;
|
||||
top: -10000px;
|
||||
left: -10000px;
|
||||
width: 1000px;
|
||||
height: 1000px;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -347,11 +347,7 @@
|
|||
context: context,
|
||||
response: {
|
||||
success: function(args) {
|
||||
<<<<<<< HEAD
|
||||
if (args.doInstall && isAdmin()) {
|
||||
=======
|
||||
if (args.doInstall && cloudStack.context.users[0].role == 'admin') {
|
||||
>>>>>>> ccd7d8b... Install wizard: Conditionally load EULA
|
||||
var initInstallWizard = function(eulaHTML) {
|
||||
cloudStack.uiCustom.installWizard({
|
||||
$container: $container,
|
||||
|
|
@ -359,34 +355,12 @@
|
|||
eula: eulaHTML,
|
||||
complete: function() {
|
||||
// Show cloudStack main UI
|
||||
<<<<<<< HEAD
|
||||
$container.cloudStack($.extend(cloudStackArgs, { hasLogo: loginArgs.eula }));
|
||||
=======
|
||||
$container.cloudStack(cloudStackArgs);
|
||||
>>>>>>> ccd7d8b... Install wizard: Conditionally load EULA
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
initInstallWizard(loginArgs.eula);
|
||||
=======
|
||||
// EULA check
|
||||
$.ajax({
|
||||
url: 'eula.html',
|
||||
dataType: 'html',
|
||||
success: function(html) {
|
||||
initInstallWizard(html);
|
||||
},
|
||||
error: function() {
|
||||
initInstallWizard(null);
|
||||
}
|
||||
});
|
||||
>>>>>>> ccd7d8b... Install wizard: Conditionally load EULA
|
||||
=======
|
||||
initInstallWizard(loginArgs.eula);
|
||||
>>>>>>> 2e82439... Hide Citrix logo if no EULA is present (i.e., is OSS version)
|
||||
} else {
|
||||
// Show cloudStack main UI
|
||||
$container.cloudStack($.extend(cloudStackArgs, { hasLogo: loginArgs.eula }));
|
||||
|
|
@ -403,35 +377,20 @@
|
|||
});
|
||||
}
|
||||
};
|
||||
<<<<<<< HEAD
|
||||
|
||||
// EULA check
|
||||
$.ajax({
|
||||
url: 'eula.' + g_lang + '.html',
|
||||
=======
|
||||
|
||||
// EULA check
|
||||
$.ajax({
|
||||
<<<<<<< HEAD
|
||||
url: 'eula.html',
|
||||
>>>>>>> 2e82439... Hide Citrix logo if no EULA is present (i.e., is OSS version)
|
||||
=======
|
||||
url: 'eula.' + $.cookie('lang') + '.html',
|
||||
>>>>>>> 4f35fb7... Get EULA specific to selected language
|
||||
dataType: 'html',
|
||||
success: function(html) {
|
||||
cloudStack.uiCustom.login($.extend(loginArgs, { eula: html, hasLogo: true }));
|
||||
},
|
||||
error: function() {
|
||||
cloudStack.uiCustom.login(loginArgs);
|
||||
<<<<<<< HEAD
|
||||
},
|
||||
beforeSend : function(XMLHttpResponse) {
|
||||
return true;
|
||||
}
|
||||
=======
|
||||
}
|
||||
>>>>>>> 2e82439... Hide Citrix logo if no EULA is present (i.e., is OSS version)
|
||||
});
|
||||
|
||||
// Localization
|
||||
|
|
|
|||
|
|
@ -934,7 +934,6 @@
|
|||
}
|
||||
],
|
||||
|
||||
<<<<<<< HEAD
|
||||
dataProvider: function(args) {
|
||||
$.ajax({
|
||||
url: createURL("listDiskOfferings&id=" + args.context.diskOfferings[0].id),
|
||||
|
|
@ -948,111 +947,11 @@
|
|||
});
|
||||
}
|
||||
});
|
||||
=======
|
||||
dataProvider: function(args) {
|
||||
args.response.success(
|
||||
{
|
||||
actionFilter: diskOfferingActionfilter,
|
||||
data:args.context.diskOfferings[0]
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
},
|
||||
|
||||
hypervisorCapabilities: {
|
||||
type: 'select',
|
||||
title: 'label.hypervisor.capabilities',
|
||||
listView: {
|
||||
id: 'hypervisorCapabilities',
|
||||
label: 'label.hypervisor.capabilities',
|
||||
fields: {
|
||||
hypervisor: { label: 'label.hypervisor' },
|
||||
hypervisorversion: { label: 'label.hypervisor.version' },
|
||||
maxguestslimit: { label: 'label.max.guest.limit' }
|
||||
},
|
||||
dataProvider: function(args) {
|
||||
var array1 = [];
|
||||
if(args.filterBy != null) {
|
||||
if(args.filterBy.search != null && args.filterBy.search.by != null && args.filterBy.search.value != null) {
|
||||
switch(args.filterBy.search.by) {
|
||||
case "name":
|
||||
if(args.filterBy.search.value.length > 0)
|
||||
array1.push("&keyword=" + args.filterBy.search.value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: createURL("listHypervisorCapabilities&page=" + args.page + "&pagesize=" + pageSize + array1.join("")),
|
||||
dataType: "json",
|
||||
async: true,
|
||||
success: function(json) {
|
||||
var items = json.listhypervisorcapabilitiesresponse.hypervisorCapabilities;
|
||||
args.response.success({data:items});
|
||||
},
|
||||
error: function(data) {
|
||||
args.response.error(parseXMLHttpResponse(data));
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
detailView: {
|
||||
name: 'label.details',
|
||||
actions: {
|
||||
edit: {
|
||||
label: 'label.edit',
|
||||
action: function(args) {
|
||||
var array1 = [];
|
||||
array1.push("&maxguestslimit=" + todb(args.data.maxguestslimit));
|
||||
$.ajax({
|
||||
url: createURL("updateHypervisorCapabilities&id=" + args.context.hypervisorCapabilities[0].id + array1.join("")),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
var item = json.updatehypervisorcapabilitiesresponse['null'];
|
||||
args.response.success({data: item});
|
||||
},
|
||||
error: function(data) {
|
||||
args.response.error(parseXMLHttpResponse(data));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
tabs: {
|
||||
details: {
|
||||
title: 'label.details',
|
||||
fields: [
|
||||
{
|
||||
id: { label: 'label.id' },
|
||||
hypervisor: { label: 'label.hypervisor' },
|
||||
hypervisorversion: { label: 'label.hypervisor.version' },
|
||||
maxguestslimit: {
|
||||
label: 'label.max.guest.limit',
|
||||
isEditable: true
|
||||
}
|
||||
}
|
||||
],
|
||||
dataProvider: function(args) {
|
||||
args.response.success(
|
||||
{
|
||||
data:args.context.hypervisorCapabilities[0]
|
||||
}
|
||||
);
|
||||
>>>>>>> 577f3a5... cloudstack 3.0 new UI - correct localization label format
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
=======
|
||||
>>>>>>> 240dabe... Navigation organizational changes
|
||||
},
|
||||
|
||||
networkOfferings: {
|
||||
|
|
@ -1120,11 +1019,7 @@
|
|||
|
||||
createForm: {
|
||||
title: 'label.add.network.offering',
|
||||
<<<<<<< HEAD
|
||||
preFilter: function(args) {
|
||||
=======
|
||||
preFilter: function(args) {
|
||||
>>>>>>> 577f3a5... cloudstack 3.0 new UI - correct localization label format
|
||||
var $availability = args.$form.find('.form-item[rel=availability]');
|
||||
var $serviceOfferingId = args.$form.find('.form-item[rel=serviceOfferingId]');
|
||||
var hasAdvancedZones = false;
|
||||
|
|
@ -1132,7 +1027,6 @@
|
|||
// Check whether there are any advanced zones
|
||||
$.ajax({
|
||||
url: createURL('listZones'),
|
||||
<<<<<<< HEAD
|
||||
data: { listAll: true },
|
||||
async: false,
|
||||
success: function(json) {
|
||||
|
|
@ -1146,44 +1040,11 @@
|
|||
}
|
||||
});
|
||||
|
||||
=======
|
||||
data: { listAll: true, networktype: 'advanced' },
|
||||
async: false,
|
||||
success: function(json) {
|
||||
if (json.listzonesresponse.zone && json.listzonesresponse.zone.length) {
|
||||
hasAdvancedZones = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
>>>>>>> fb141dd... bug 14093
|
||||
args.$form.bind('change', function() { //when any field in the dialog is changed
|
||||
//check whether to show or hide availability field
|
||||
var $sourceNATField = args.$form.find('input[name=\"service.SourceNat.isEnabled\"]');
|
||||
var $guestTypeField = args.$form.find('select[name=guestIpType]');
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
var $basicSharedFields = args.$form.find('.form-item').filter(function() {
|
||||
var basicSharedFields = [
|
||||
'service.SourceNat.isEnabled',
|
||||
'service.StaticNat.isEnabled',
|
||||
'service.PortForwarding.isEnabled',
|
||||
'service.Lb.isEnabled'
|
||||
];
|
||||
|
||||
if ($.inArray($(this).attr('rel'), basicSharedFields) > -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($.inArray($(this).attr('depends-on'), basicSharedFields) > -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
>>>>>>> fb141dd... bug 14093
|
||||
if (!requiredNetworkOfferingExists &&
|
||||
$sourceNATField.is(':checked') &&
|
||||
$guestTypeField.val() == 'Isolated') {
|
||||
|
|
@ -1213,7 +1074,6 @@
|
|||
|
||||
$(':ui-dialog').dialog('option', 'position', 'center');
|
||||
|
||||
<<<<<<< HEAD
|
||||
|
||||
//hide/show service fields upon guestIpType(Shared/Isolated) and zoneType(Advanced/Basic) ***** (begin) *****
|
||||
var serviceFieldsToHide = [];
|
||||
|
|
@ -1296,24 +1156,6 @@
|
|||
args.$form.find('.form-item[rel=\"service.StaticNat.elasticIpCheckbox\"]').find('input[type=checkbox]').attr('checked', false);
|
||||
}
|
||||
|
||||
=======
|
||||
if (hasAdvancedZones && $guestTypeField.val() == 'Shared') {
|
||||
$basicSharedFields.hide();
|
||||
$basicSharedFields.find('input[type=checkbox]').attr('checked', false);
|
||||
} else {
|
||||
$basicSharedFields.each(function() {
|
||||
var $field = $(this);
|
||||
var $dependsOn = args.$form.find('.form-item').filter(function() {
|
||||
return $(this).attr('rel') == $field.attr('depends-on');
|
||||
});
|
||||
|
||||
if (!$field.attr('depends-on') ||
|
||||
$dependsOn.find('input[type=checkbox]').is(':checked')) {
|
||||
$field.css('display', 'inline-block');
|
||||
}
|
||||
});
|
||||
}
|
||||
>>>>>>> fb141dd... bug 14093
|
||||
});
|
||||
|
||||
args.$form.change();
|
||||
|
|
@ -1483,11 +1325,7 @@
|
|||
|
||||
//show or hide upon checked services and selected providers above (begin)
|
||||
serviceOfferingId: {
|
||||
<<<<<<< HEAD
|
||||
label: 'label.system.offering',
|
||||
=======
|
||||
label: 'label.compute.offering',
|
||||
>>>>>>> 240dabe... Navigation organizational changes
|
||||
select: function(args) {
|
||||
$.ajax({
|
||||
url: createURL('listServiceOfferings&issystem=true&systemvmtype=domainrouter'),
|
||||
|
|
@ -1540,22 +1378,12 @@
|
|||
},
|
||||
"service.Lb.elasticLbCheckbox" : {
|
||||
label: "label.elastic.LB",
|
||||
<<<<<<< HEAD
|
||||
isHidden: true,
|
||||
=======
|
||||
isHidden: true,
|
||||
dependsOn: 'service.Lb.isEnabled',
|
||||
>>>>>>> 577f3a5... cloudstack 3.0 new UI - correct localization label format
|
||||
isBoolean: true
|
||||
},
|
||||
"service.Lb.lbIsolationDropdown": {
|
||||
label: 'label.LB.isolation',
|
||||
<<<<<<< HEAD
|
||||
isHidden: true,
|
||||
=======
|
||||
isHidden: true,
|
||||
dependsOn: 'service.Lb.isEnabled',
|
||||
>>>>>>> 577f3a5... cloudstack 3.0 new UI - correct localization label format
|
||||
select: function(args) {
|
||||
args.response.success({
|
||||
data: [
|
||||
|
|
@ -1567,12 +1395,7 @@
|
|||
},
|
||||
"service.StaticNat.elasticIpCheckbox" : {
|
||||
label: "label.elastic.IP",
|
||||
<<<<<<< HEAD
|
||||
isHidden: true,
|
||||
=======
|
||||
isHidden: true,
|
||||
dependsOn: 'service.StaticNat.isEnabled',
|
||||
>>>>>>> 577f3a5... cloudstack 3.0 new UI - correct localization label format
|
||||
isBoolean: true
|
||||
},
|
||||
//show or hide upon checked services and selected providers above (end)
|
||||
|
|
|
|||
|
|
@ -29,8 +29,6 @@
|
|||
action: function(args) {
|
||||
var name = args.data.jsonObj.name;
|
||||
var value = args.data.value;
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
$.ajax({
|
||||
url: createURL(
|
||||
|
|
@ -64,40 +62,7 @@
|
|||
if (args.filterBy.search.value) {
|
||||
data.name = args.filterBy.search.value;
|
||||
}
|
||||
>>>>>>> 240dabe... Navigation organizational changes
|
||||
|
||||
$.ajax({
|
||||
url: createURL(
|
||||
'updateConfiguration&name=' + name + '&value=' + value
|
||||
),
|
||||
dataType: 'json',
|
||||
async: true,
|
||||
success: function(json) {
|
||||
var item = json.updateconfigurationresponse.configuration;
|
||||
cloudStack.dialog.notice({ message: _l('message.restart.mgmt.server') });
|
||||
args.response.success({data: item});
|
||||
},
|
||||
error: function(json) {
|
||||
args.response.error(parseXMLHttpResponse(json));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
fields: {
|
||||
name: { label: 'label.name', id: true },
|
||||
description: { label: 'label.description' },
|
||||
value: { label: 'label.value', editable: true }
|
||||
},
|
||||
dataProvider: function(args) {
|
||||
var data = {
|
||||
page: args.page,
|
||||
pagesize: pageSize
|
||||
};
|
||||
|
||||
if (args.filterBy.search.value) {
|
||||
data.name = args.filterBy.search.value;
|
||||
}
|
||||
$.ajax({
|
||||
url: createURL('listConfigurations'),
|
||||
data: data,
|
||||
|
|
|
|||
|
|
@ -315,62 +315,10 @@
|
|||
});
|
||||
|
||||
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
var apiCmd = "listNetworkOfferings&guestiptype=Isolated&supportedServices=sourceNat&state=Enabled&specifyvlan=false&zoneid=" + args.currentData.zoneid ;
|
||||
var array1 = [];
|
||||
var guestTrafficTypeTotal = 0;
|
||||
|
||||
=======
|
||||
//get network offerings (begin) ***
|
||||
if (isAdmin()) {
|
||||
$.ajax({
|
||||
url: createURL('listPhysicalNetworks'),
|
||||
data: {
|
||||
zoneid: args.currentData.zoneid
|
||||
},
|
||||
async: false,
|
||||
success: function(json) {
|
||||
physicalNetworkObjs = json.listphysicalnetworksresponse.physicalnetwork;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var apiCmd = "listNetworkOfferings&guestiptype=Isolated&supportedServices=sourceNat&state=Enabled&specifyvlan=false";
|
||||
var array1 = [];
|
||||
|
||||
if(physicalNetworkObjs != null && physicalNetworkObjs.length > 1) { //multiple physical networks
|
||||
var guestTrafficTypeTotal = 0;
|
||||
for(var i = 0; i < physicalNetworkObjs.length; i++) {
|
||||
if(guestTrafficTypeTotal > 1) //as long as guestTrafficTypeTotal > 1, break for loop, don't need to continue to count. It doesn't matter whether guestTrafficTypeTotal is 2 or 3 or 4 or 5 or more. We only care whether guestTrafficTypeTotal is greater than 1.
|
||||
break;
|
||||
$.ajax({
|
||||
url: createURL("listTrafficTypes&physicalnetworkid=" + physicalNetworkObjs[i].id),
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function(json) {
|
||||
var items = json.listtraffictypesresponse.traffictype;
|
||||
for(var k = 0; k < items.length; k++) {
|
||||
if(items[k].traffictype == "Guest") {
|
||||
guestTrafficTypeTotal++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if(guestTrafficTypeTotal > 1) {
|
||||
array1.push("&istagged=true");
|
||||
}
|
||||
}
|
||||
>>>>>>> ee6dc03... bug 13965
|
||||
=======
|
||||
var apiCmd = "listNetworkOfferings&guestiptype=Isolated&supportedServices=sourceNat&state=Enabled&specifyvlan=false";
|
||||
var array1 = [];
|
||||
var guestTrafficTypeTotal = 0;
|
||||
|
||||
>>>>>>> 3c61e20... bug 13965
|
||||
$.ajax({
|
||||
url: createURL(apiCmd + array1.join("")), //get the network offering for isolated network with sourceNat
|
||||
dataType: "json",
|
||||
|
|
@ -1627,20 +1575,10 @@
|
|||
}
|
||||
});
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
},
|
||||
|
||||
/*
|
||||
isoid: {
|
||||
=======
|
||||
},
|
||||
|
||||
serviceofferingname: { label: 'label.compute.offering', isEditable: false },
|
||||
group: { label: 'label.group', isEditable: true },
|
||||
hostname: { label: 'label.host', isEditable: false},
|
||||
haenable: { label: 'label.ha.enabled', isEditable: false, converter:cloudStack.converters.toBooleanText },
|
||||
isoid: {
|
||||
>>>>>>> 240dabe... Navigation organizational changes
|
||||
label: 'label.attached.iso',
|
||||
isEditable: false,
|
||||
converter: function(isoid) {
|
||||
|
|
|
|||
1004
ui/scripts/system.js
1004
ui/scripts/system.js
File diff suppressed because it is too large
Load Diff
|
|
@ -666,15 +666,9 @@
|
|||
launchInfo: function(args) {
|
||||
var $intro = $('<div></div>').addClass('intro');
|
||||
var $title = $('<div></div>').addClass('title')
|
||||
<<<<<<< HEAD
|
||||
.html(_l('label.congratulations'));
|
||||
var $subtitle = $('<div></div>').addClass('subtitle')
|
||||
.html(_l('label.installWizard.click.launch'));
|
||||
=======
|
||||
.html(_l('label.congratulations'));
|
||||
var $subtitle = $('<div></div>').addClass('subtitle')
|
||||
.html(_l('label.installWizard.click.launch'));
|
||||
>>>>>>> 6d8a11c... Complete localization for quick install wizard
|
||||
var $continue = elems.nextButton(_l('label.launch'));
|
||||
var $prev = elems.prevButton(_l('label.back'));
|
||||
|
||||
|
|
|
|||
|
|
@ -61,11 +61,7 @@
|
|||
|
||||
if (!args.hasLogo) $login.addClass('nologo');
|
||||
|
||||
<<<<<<< HEAD
|
||||
// Labels cause related input to be focused
|
||||
=======
|
||||
// Labels cause related input to be focused
|
||||
>>>>>>> 2e82439... Hide Citrix logo if no EULA is present (i.e., is OSS version)
|
||||
$login.find('label').click(function() {
|
||||
var $input = $inputs.filter('[name=' + $(this).attr('for') + ']');
|
||||
|
||||
|
|
@ -105,22 +101,12 @@
|
|||
$.cookie('lang', $(this).val());
|
||||
document.location.reload();
|
||||
});
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
>>>>>>> cebbce4... Make default language English, if no cookie set
|
||||
|
||||
// Set default language
|
||||
if (!$.cookie('lang')) {
|
||||
$.cookie('lang', 'en');
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
>>>>>>> d3cc43e... bug 13815
|
||||
=======
|
||||
|
||||
>>>>>>> cebbce4... Make default language English, if no cookie set
|
||||
$languageSelect.val($.cookie('lang'));
|
||||
};
|
||||
})(jQuery, cloudStack);
|
||||
|
|
|
|||
|
|
@ -121,10 +121,7 @@
|
|||
var $storageTrafficItem = $(storageTrafficItem);
|
||||
var storageTrafficData = {};
|
||||
var fields = [
|
||||
<<<<<<< HEAD
|
||||
'gateway',
|
||||
=======
|
||||
>>>>>>> 5c06960... bug 13743: New zone wizard step -- configure storage traffic
|
||||
'netmask',
|
||||
'vlanid',
|
||||
'startip',
|
||||
|
|
@ -651,18 +648,7 @@
|
|||
|
||||
// Remove network action
|
||||
$physicalNetworkItem.find('.button.remove.physical-network').click(function() {
|
||||
<<<<<<< HEAD
|
||||
physicalNetwork.remove($physicalNetworkItem);
|
||||
=======
|
||||
$physicalNetworkItem.find('li.traffic-type-draggable').each(function() {
|
||||
var trafficTypeID = $(this).attr('traffic-type-id');
|
||||
|
||||
physicalNetwork.assignTrafficType(trafficTypeID, $physicalNetworkItem.prev());
|
||||
});
|
||||
|
||||
$physicalNetworkItem.find('li.traffic-type-draggable.clone').remove();
|
||||
physicalNetwork.update($physicalNetworkItem.parent().find('.multi'));
|
||||
>>>>>>> 5c06960... bug 13743: New zone wizard step -- configure storage traffic
|
||||
});
|
||||
|
||||
$physicalNetworkItem.addClass('disabled'); // Since there are no traffic types yet
|
||||
|
|
@ -679,30 +665,8 @@
|
|||
var $container = $physicalNetworkItem.closest('.setup-physical-network .content.input-area form');
|
||||
var $trafficTypes = $physicalNetworkItem.find('li.traffic-type-draggable');
|
||||
|
||||
<<<<<<< HEAD
|
||||
$trafficTypes.each(function() {
|
||||
var trafficTypeID = $(this).attr('traffic-type-id');
|
||||
=======
|
||||
if (!$item.siblings().size()) {
|
||||
cloudStack.dialog.notice({
|
||||
message: dictionary['message.you.must.have.at.least.one.physical.network']
|
||||
});
|
||||
} else if ($item.find('input[type=radio]:checked').size()) {
|
||||
cloudStack.dialog.notice({
|
||||
message: dictionary['message.please.select.a.different.public.and.management.network.before.removing']
|
||||
});
|
||||
} else {
|
||||
// Put any traffic type symbols back in original container
|
||||
$item.find('li.traffic-type-draggable').each(function() {
|
||||
var $draggable = $(this);
|
||||
var $originalContainer = $('.traffic-types-drag-area:visible > ul > li')
|
||||
.filter(function() {
|
||||
return $(this).hasClass($draggable.attr('traffic-type-id'));
|
||||
});
|
||||
|
||||
$draggable.appendTo($item.prev());
|
||||
});
|
||||
>>>>>>> 68f12d9... cloudstack 3.0 new UI - localize messages during zone creation.
|
||||
|
||||
physicalNetwork.assignTrafficType(
|
||||
trafficTypeID,
|
||||
|
|
@ -867,19 +831,11 @@
|
|||
|
||||
var makeMessage = function(message, isError) {
|
||||
var $li = $('<li>')
|
||||
<<<<<<< HEAD
|
||||
.addClass(!isError ? 'loading' : 'info')
|
||||
.append(
|
||||
$('<span>').addClass('icon').html(' '),
|
||||
$('<span>').addClass('text').html(message)
|
||||
);
|
||||
=======
|
||||
.addClass(!isError ? 'loading' : 'info')
|
||||
.append(
|
||||
$('<span>').addClass('icon').html(' '),
|
||||
$('<span>').addClass('text').html(message)
|
||||
);
|
||||
>>>>>>> 5c06960... bug 13743: New zone wizard step -- configure storage traffic
|
||||
var $launchContainer = $launchStep.find('.launch-container');
|
||||
|
||||
$launchStep.find('ul').append($li);
|
||||
|
|
@ -889,11 +845,7 @@
|
|||
if (isError) {
|
||||
$li.prev().addClass('error');
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
|
||||
>>>>>>> 5c06960... bug 13743: New zone wizard step -- configure storage traffic
|
||||
};
|
||||
|
||||
args.action({
|
||||
|
|
@ -1255,22 +1207,6 @@
|
|||
drop: function(event, ui) {
|
||||
physicalNetwork.unassignTrafficType(ui.draggable);
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
if (!physicalNetwork.isTrafficTypeClone(ui.draggable)) {
|
||||
if ($.inArray(trafficTypeID, physicalNetwork.requiredTrafficTypes) == -1) {
|
||||
physicalNetwork.unassignTrafficType(trafficTypeID, $wizard);
|
||||
} else {
|
||||
physicalNetwork.assignTrafficType(
|
||||
trafficTypeID,
|
||||
$wizard.find('.select-container.multi:first')
|
||||
);
|
||||
}
|
||||
} else if (!ui.draggable.closest('.traffic-types-drag-area').size()) {
|
||||
ui.draggable.remove();
|
||||
}
|
||||
|
||||
>>>>>>> 5c06960... bug 13743: New zone wizard step -- configure storage traffic
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -64,7 +64,8 @@
|
|||
* @param sectionID Section's ID to show
|
||||
* @param args CloudStack3 configuration
|
||||
*/
|
||||
var showSection = function(sectionID, args, $browser) {
|
||||
var showSection = function(sectionID, args) {
|
||||
var $browser = $('#browser div.container');
|
||||
var $navItem = $('#navigation').find('li').filter(function() {
|
||||
return $(this).hasClass(sectionID);
|
||||
});
|
||||
|
|
@ -255,7 +256,7 @@
|
|||
|
||||
// User options
|
||||
var $options = $('<div>').attr({ id: 'user-options' })
|
||||
.appendTo($container.find('#header'));
|
||||
.appendTo($('#header'));
|
||||
$(['label.logout', 'label.help']).each(function() {
|
||||
var $link = $('<a>')
|
||||
.attr({ href: '#' })
|
||||
|
|
@ -274,8 +275,8 @@
|
|||
});
|
||||
|
||||
// Initialize browser
|
||||
$container.find('#browser div.container').cloudBrowser();
|
||||
$container.find('#navigation li')
|
||||
$('#browser div.container').cloudBrowser();
|
||||
$('#navigation li')
|
||||
.filter(function() {
|
||||
return $(this).hasClass(args.home);
|
||||
})
|
||||
|
|
@ -299,11 +300,7 @@
|
|||
response: {
|
||||
success: function(args) {
|
||||
if (!args.data.length) return;
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
|
||||
>>>>>>> 6d9928b... Only show invitations if projects UI is initialized
|
||||
var projectList = $.map(args.data, function(invitation) {
|
||||
return '<li>' + invitation.project + '</li>';
|
||||
}).join('');
|
||||
|
|
@ -315,26 +312,12 @@
|
|||
});
|
||||
}
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
});
|
||||
}
|
||||
|
||||
// Hide logo conditionally
|
||||
if (!args.hasLogo) $('#header .controls').addClass('nologo');
|
||||
|
||||
=======
|
||||
}
|
||||
});
|
||||
=======
|
||||
});
|
||||
}
|
||||
>>>>>>> 6d9928b... Only show invitations if projects UI is initialized
|
||||
|
||||
// Hide logo conditionally
|
||||
if (!args.hasLogo) $('#header .controls').addClass('nologo');
|
||||
|
||||
>>>>>>> 2e82439... Hide Citrix logo if no EULA is present (i.e., is OSS version)
|
||||
return this;
|
||||
};
|
||||
|
||||
|
|
@ -354,7 +337,6 @@
|
|||
var $target = $(event.target);
|
||||
var $container = $target.closest('[cloudStack-container]');
|
||||
var args = $container.data('cloudStack-args');
|
||||
var $browser = $container.find('#browser .container');
|
||||
|
||||
if (!$container.size()) return true;
|
||||
|
||||
|
|
@ -363,14 +345,14 @@
|
|||
var $navItem = $target.closest('li.navigation-item');
|
||||
|
||||
if ($navItem.is('.disabled')) return false;
|
||||
showSection($navItem.data('cloudStack-section-id'), args, $browser);
|
||||
showSection($navItem.data('cloudStack-section-id'), args);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Browser expand
|
||||
if ($target.hasClass('control expand') && $target.closest('div.panel div.toolbar').size()) {
|
||||
$browser.cloudBrowser('toggleMaximizePanel', {
|
||||
$('#browser div.container').cloudBrowser('toggleMaximizePanel', {
|
||||
panel: $target.closest('div.panel')
|
||||
});
|
||||
|
||||
|
|
@ -379,7 +361,7 @@
|
|||
|
||||
// Home breadcrumb
|
||||
if ($target.is('#breadcrumbs div.home')) {
|
||||
showSection(args.home, args, $browser);
|
||||
showSection(args.home, args);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -369,7 +369,6 @@
|
|||
* Clear all panels
|
||||
*/
|
||||
removeAllPanels: function(args) {
|
||||
$('div.panel').stop(); // Prevent destroyed panels from animating
|
||||
this.element.find('div.panel').remove();
|
||||
$('#breadcrumbs').find('ul li').remove();
|
||||
$('#breadcrumbs').find('ul div.end').remove();
|
||||
|
|
|
|||
|
|
@ -287,7 +287,6 @@
|
|||
var $inputs = $detailView.find('input, select');
|
||||
var action = args.actions[args.actionName];
|
||||
var id = $detailView.data('view-args').id;
|
||||
|
||||
var $editButton = $('<div>').addClass('button done').html(_l('label.apply')).hide();
|
||||
var $cancelButton = $('<div>').addClass('button cancel').html(_l('label.cancel')).hide();
|
||||
|
||||
|
|
@ -310,10 +309,8 @@
|
|||
else if ($input.is('input[type=checkbox]')) {
|
||||
var val = $input.is(':checked');
|
||||
|
||||
|
||||
$value.data('detail-view-boolean-value', _s(val));
|
||||
$value.html(_s(val) ? _l('label.yes') : _l('label.no'));
|
||||
|
||||
}
|
||||
else if ($input.is('select')) {
|
||||
$value.html(_s(
|
||||
|
|
|
|||
|
|
@ -565,7 +565,7 @@
|
|||
if($.inArray(key, hiddenFields) != -1)
|
||||
return true;
|
||||
var field = this;
|
||||
var $th = $('<th>').addClass(key).appendTo($thead.find('tr'));
|
||||
var $th = $('<th>').appendTo($thead.find('tr'));
|
||||
|
||||
if ($th.index()) $th.addClass('reduced-hide');
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,83 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>CloudStack UI Tests</title>
|
||||
<link rel="stylesheet" href="../lib/qunit/qunit.css" type="text/css" media="screen" />
|
||||
<link rel="stylesheet" href="../css/cloudStack3.css" type="text/css" media="screen" />
|
||||
</head>
|
||||
<body>
|
||||
<h1 id="qunit-header">CloudStack UI Tests</h1>
|
||||
<h2 id="qunit-banner"></h2>
|
||||
<div id="qunit-testrunner-toolbar"></div>
|
||||
<h2 id="qunit-userAgent"></h2>
|
||||
<ol id="qunit-tests"></ol>
|
||||
<div id="qunit-fixture">test markup, will be hidden</div>
|
||||
|
||||
<!-- jQuery -->
|
||||
<script src="../lib/jquery.js" type="text/javascript"></script>
|
||||
<script src="../lib/jquery.easing.js" type="text/javascript"></script>
|
||||
<script src="../lib/jquery.validate.js" type="text/javascript"></script>
|
||||
<script src="../lib/jquery-ui/js/jquery-ui.js" type="text/javascript"></script>
|
||||
|
||||
<!-- Flot -->
|
||||
<script src="../lib/excanvas.js"></script>
|
||||
<script src="../lib/flot/jquery.flot.js" type="text/javascript"></script>
|
||||
<script src="../lib/flot/jquery.colorhelpers.js" type="text/javascript"></script>
|
||||
<script src="../lib/flot/jquery.flot.crosshair.js" type="text/javascript"></script>
|
||||
<script src="../lib/flot/jquery.flot.fillbetween.js" type="text/javascript"></script>
|
||||
<script src="../lib/flot/jquery.flot.image.js" type="text/javascript"></script>
|
||||
<script src="../lib/flot/jquery.flot.navigate.js" type="text/javascript"></script>
|
||||
<script src="../lib/flot/jquery.flot.pie.js" type="text/javascript"></script>
|
||||
<script src="../lib/flot/jquery.flot.resize.js" type="text/javascript"></script>
|
||||
<script src="../lib/flot/jquery.flot.selection.js" type="text/javascript"></script>
|
||||
<script src="../lib/flot/jquery.flot.stack.js" type="text/javascript"></script>
|
||||
<script src="../lib/flot/jquery.flot.symbol.js" type="text/javascript"></script>
|
||||
<script src="../lib/flot/jquery.flot.threshold.js" type="text/javascript"></script>
|
||||
|
||||
<!-- UI -->
|
||||
<script src="../scripts/ui/core.js" type="text/javascript"></script>
|
||||
<script src="../scripts/ui/utils.js" type="text/javascript"></script>
|
||||
<script src="../scripts/ui/events.js" type="text/javascript"></script>
|
||||
<script src="../scripts/ui/dialog.js" type="text/javascript"></script>
|
||||
|
||||
<!-- UI - Widgets -->
|
||||
<script src="../scripts/ui/widgets/multiEdit.js" type="text/javascript"></script>
|
||||
<script src="../scripts/ui/widgets/overlay.js" type="text/javascript"></script>
|
||||
<script src="../scripts/ui/widgets/dataTable.js" type="text/javascript"></script>
|
||||
<script src="../scripts/ui/widgets/cloudBrowser.js" type="text/javascript"></script>
|
||||
<script src="../scripts/ui/widgets/listView.js" type="text/javascript"></script>
|
||||
<script src="../scripts/ui/widgets/detailView.js" type="text/javascript"></script>
|
||||
<script src="../scripts/ui/widgets/treeView.js" type="text/javascript"></script>
|
||||
<script src="../scripts/ui/widgets/notifications.js" type="text/javascript"></script>
|
||||
|
||||
<!-- Common libraries -->
|
||||
<script src="../lib/date.js" type="text/javascript"></script>
|
||||
<script src="../lib/jquery.cookies.js" type="text/javascript"></script>
|
||||
<script src="../lib/jquery.timers.js" type="text/javascript"></script>
|
||||
<script src="../lib/jquery.md5.js" type="text/javascript" ></script>
|
||||
|
||||
<!-- CloudStack -->
|
||||
<script src="../scripts/ui-custom/login.js" type="text/javascript"></script>
|
||||
<script src="../scripts/ui-custom/projects.js" type="text/javascript"></script>
|
||||
<script src="../scripts/ui-custom/zoneChart.js" type="text/javascript"></script>
|
||||
<script src="../scripts/ui-custom/dashboard.js" type="text/javascript"></script>
|
||||
<script src="../scripts/ui-custom/installWizard.js" type="text/javascript"></script>
|
||||
<script src="../scripts/ui-custom/instanceWizard.js" type="text/javascript"></script>
|
||||
<script src="../scripts/ui-custom/ipRules.js" type="text/javascript"></script>
|
||||
<script src="../scripts/ui-custom/enableStaticNAT.js" type="text/javascript"></script>
|
||||
<script src="../scripts/ui-custom/securityRules.js" type="text/javascript"></script>
|
||||
<script src="../scripts/ui-custom/recurringSnapshots.js" type="text/javascript"></script>
|
||||
<script src="../scripts/ui-custom/physicalResources.js" type="text/javascript"></script>
|
||||
<script src="../scripts/ui-custom/zoneWizard.js" type="text/javascript"></script>
|
||||
|
||||
<!-- qunit -->
|
||||
<script src="../lib/qunit/qunit.js" type="text/javascript"></script>
|
||||
|
||||
<!-- Tests -->
|
||||
<script src="test.core.js" type="text/javascript"></script>
|
||||
<script src="test.cloudBrowser.js" type="text/javascript"></script>
|
||||
<script src="test.notifications.js" type="text/javascript"></script>
|
||||
<script src="test.listView.js" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,84 +0,0 @@
|
|||
(function($) {
|
||||
var $browser, $breadcrumbs, $browserContainer;
|
||||
|
||||
module('Browser', {
|
||||
setup: function() {
|
||||
$.fx.off = true;
|
||||
$browser = $('<div>').addClass('browser-test').appendTo('#qunit-fixture');
|
||||
$breadcrumbs = $('<div>').attr('id', 'breadcrumbs').appendTo($browser);
|
||||
$browserContainer = $('<div>').addClass('container').appendTo($browser);
|
||||
ok($browserContainer.cloudBrowser(), 'Browser initialized');
|
||||
equal($breadcrumbs.find('ul').size(), 1, 'Breadcrumbs initialized');
|
||||
}
|
||||
});
|
||||
|
||||
// Browser tests
|
||||
test('Add panel', function() {
|
||||
ok($browserContainer.cloudBrowser('addPanel', { title: 'testPanel123' }), 'Add panel');
|
||||
equal($browser.find('.panel').size(), 1, 'Browser has 1 panel');
|
||||
equal($breadcrumbs.find('ul li').size(), 1, 'Browser has 1 breadcrumb');
|
||||
equal($breadcrumbs.find('ul li:first span').html(), 'testPanel123', 'Panel has correct title');
|
||||
});
|
||||
|
||||
test('Add a second panel', function() {
|
||||
ok($browserContainer.cloudBrowser('addPanel', { title: 'testPanel123' }), 'Add first panel');
|
||||
ok($browserContainer.cloudBrowser('addPanel', { title: 'testPanel456' }), 'Add second panel');
|
||||
equal($browser.find('.panel').size(), 2, 'Browser has 2 panels');
|
||||
equal($breadcrumbs.find('ul li').size(), 2, 'Browser has 2 breadcrumbs');
|
||||
equal($breadcrumbs.find('ul li:last span').html(), 'testPanel456', 'New panel has correct title');
|
||||
equal($breadcrumbs.find('ul li:first span').html(), 'testPanel123', 'First panel still has correct title');
|
||||
});
|
||||
|
||||
test('Select panel', function() {
|
||||
ok($browserContainer.cloudBrowser('addPanel', { title: 'testPanel123' }), 'Add first panel');
|
||||
ok($browserContainer.cloudBrowser('addPanel', { title: 'testPanel456' }), 'Add second panel');
|
||||
ok($browserContainer.cloudBrowser('addPanel', { title: 'testPanel789' }), 'Add third panel');
|
||||
|
||||
stop();
|
||||
$browserContainer.cloudBrowser('selectPanel', {
|
||||
panel: $browser.find('.panel:first').next(),
|
||||
complete: function() {
|
||||
start();
|
||||
ok(true, 'Select second panel');
|
||||
}
|
||||
});
|
||||
|
||||
equal($browser.find('.panel').size(), 2, 'Browser has 2 panels');
|
||||
equal($breadcrumbs.find('ul li:first span').html(), 'testPanel123', 'First panel still has correct title');
|
||||
equal($breadcrumbs.find('ul li:last span').html(), 'testPanel456', 'Second panel still has correct title');
|
||||
equal($breadcrumbs.find('ul li').size(), 2, 'Browser has 2 breadcrumbs');
|
||||
|
||||
stop();
|
||||
$browserContainer.cloudBrowser('selectPanel', {
|
||||
panel: $browser.find('.panel:first'),
|
||||
complete: function() {
|
||||
start();
|
||||
ok(true, 'Select first panel');
|
||||
}
|
||||
});
|
||||
|
||||
equal($browser.find('.panel').size(), 1, 'Browser has 1 panel');
|
||||
equal($breadcrumbs.find('ul li:first span').html(), 'testPanel123', 'First panel still has correct title');
|
||||
equal($breadcrumbs.find('ul li').size(), 1, 'Browser has 1 breadcrumb');
|
||||
});
|
||||
|
||||
test('Remove all panels', function() {
|
||||
ok($browserContainer.cloudBrowser('addPanel', { title: 'testPanel123' }), 'Add first panel');
|
||||
ok($browserContainer.cloudBrowser('addPanel', { title: 'testPanel456' }), 'Add second panel');
|
||||
ok($browserContainer.cloudBrowser('addPanel', { title: 'testPanel789' }), 'Add third panel');
|
||||
equal($browserContainer.find('.panel').size(), 3, 'Correct # of panels');
|
||||
ok($browserContainer.cloudBrowser('removeAllPanels'), 'Remove all panels');
|
||||
equal($browserContainer.find('.panel').size(), 0, 'All panels removed');
|
||||
ok($browserContainer.cloudBrowser('addPanel', { title: 'testPanel123' }), 'Add 1 panel');
|
||||
equal($browserContainer.find('.panel').size(), 1, 'Correct # of panels');
|
||||
});
|
||||
|
||||
test('Maximize panel', function() {
|
||||
ok($browserContainer.cloudBrowser('addPanel', { title: 'testPanel123' }), 'Add first panel');
|
||||
ok($browserContainer.cloudBrowser('addPanel', { title: 'testPanel456' }), 'Add second panel');
|
||||
equal($browserContainer.find('.panel').size(), 2, 'Correct # of panels');
|
||||
ok($browserContainer.cloudBrowser('toggleMaximizePanel', { panel: $browserContainer.find('.panel:first')}), 'Maximize first panel');
|
||||
ok($browserContainer.find('.panel:first').hasClass('maximized'), 'First panel has maximized style');
|
||||
ok(!$browserContainer.find('.panel:last').hasClass('maximized'), 'Last panel has correct style');
|
||||
});
|
||||
}(jQuery));
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
(function($) {
|
||||
var $cloudStack, cloudStack;
|
||||
|
||||
module('Core widget', {
|
||||
setup: function() {
|
||||
cloudStack = {
|
||||
sections: {
|
||||
home: {
|
||||
show: function() { return $('<div>').addClass('test123'); }
|
||||
},
|
||||
sectionA: {},
|
||||
sectionB: {},
|
||||
sectionC: {}
|
||||
},
|
||||
|
||||
home: 'home'
|
||||
};
|
||||
|
||||
$cloudStack = $('<div>');
|
||||
ok($cloudStack.cloudStack(cloudStack), 'Basic widget initialized');
|
||||
}
|
||||
});
|
||||
|
||||
test('Container/wrappers', function() {
|
||||
equal($cloudStack.find('[cloudStack-container]').size(), 1, 'Main sub-container present');
|
||||
equal($cloudStack.find('#main-area').size(), 1, 'Main area present');
|
||||
});
|
||||
|
||||
test('Header', function() {
|
||||
var $header = $cloudStack.find('#header');
|
||||
var $userOptions = $cloudStack.find('#user-options');
|
||||
var $notifications = $header.find('.button.notifications');
|
||||
var $notificationTotal = $notifications.find('.total span');
|
||||
var $viewSwitcher = $header.find('.button.view-switcher');
|
||||
|
||||
equal($header.size(), 1, 'Header present');
|
||||
equal($userOptions.size(), 1, 'User options present');
|
||||
equal($userOptions.find('a').size(), 2, 'User options has correct # of options');
|
||||
equal($notifications.size(), 1, 'Notifications present');
|
||||
equal($notificationTotal.html(), '0', 'Notifications initialized properly');
|
||||
equal($viewSwitcher.size(), 1, 'View switcher present');
|
||||
});
|
||||
|
||||
test('Navigation', function() {
|
||||
var $navigation = $cloudStack.find('#navigation');
|
||||
|
||||
equal($navigation.size(), 1, 'Navigation present');
|
||||
equal($navigation.find('li').size(), 4, 'Navigation has correct # of nav items');
|
||||
});
|
||||
|
||||
test('Browser / page generation', function() {
|
||||
var $browser = $cloudStack.find('#browser');
|
||||
var $browserContainer = $browser.find('.container');
|
||||
var $homePage = $browserContainer.find('.panel div.test123');
|
||||
var $breadcrumbs = $browser.find('#breadcrumbs li');
|
||||
var $homeBreadcrumb = $browser.find('#breadcrumbs .home');
|
||||
|
||||
equal($browser.size(), 1, 'Browser intialized');
|
||||
equal($homePage.size(), 1, 'Home page is visible');
|
||||
equal($breadcrumbs.size(), 0, 'No initial breadcrumbs');
|
||||
equal($homeBreadcrumb.size(), 1, 'Home breadcrumb active');
|
||||
});
|
||||
}(jQuery));
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
(function($) {
|
||||
module('List view', {
|
||||
setup: function() {
|
||||
$.fx.off = true;
|
||||
}
|
||||
});
|
||||
|
||||
test('Basic', function() {
|
||||
var listView = {
|
||||
listView: {
|
||||
section: 'test123',
|
||||
fields: {
|
||||
fieldA: { label: 'testFieldA' },
|
||||
fieldB: { label: 'testFieldB' }
|
||||
},
|
||||
dataProvider: function(args) {
|
||||
args.response.success({
|
||||
data: []
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
var $listView;
|
||||
|
||||
ok($listView = $('<div>').listView(listView), 'Initialize list view');
|
||||
equal($listView.find('.list-view').size(), 1, 'List view has container div');
|
||||
equal($listView.find('.list-view.test123').size(), 1, 'Container div has section ID as CSS class');
|
||||
equal($listView.find('.list-view table').size(), 2, 'List view has split tables');
|
||||
equal($listView.find('.list-view .fixed-header table thead tr').size(), 1, 'List view has fixed table header');
|
||||
equal($listView.find('.list-view .fixed-header table thead th').size(), 2, 'List view has correct column headers');
|
||||
equal($listView.find('.list-view .fixed-header table thead th:first').html(), 'testFieldA', 'First header has correct label');
|
||||
ok($listView.find('.list-view .fixed-header table thead th:first').hasClass('fieldA'), 'First header has correct class');
|
||||
ok($listView.find('.list-view .fixed-header table thead th:last').hasClass('fieldB'), 'First header has correct class');
|
||||
equal($listView.find('.list-view .fixed-header table thead th:last').html(), 'testFieldB', 'First header has correct label');
|
||||
equal($listView.find('.list-view table tbody tr').size(), 1, 'List view has table body');
|
||||
equal($listView.find('.toolbar').size(), 1, 'List view has toolbar');
|
||||
equal($listView.find('.toolbar .text-search .search-bar input[type=text]').size(), 1, 'Toolbar has search box');
|
||||
equal($listView.find('.toolbar .text-search .button.search').size(), 1, 'Toolbar has search button');
|
||||
});
|
||||
}(jQuery));
|
||||
|
|
@ -1,91 +0,0 @@
|
|||
(function($) {
|
||||
var $notifications, $notificationBox,
|
||||
$cloudStack, cloudStack;
|
||||
|
||||
module('Notifications', {
|
||||
setup: function() {
|
||||
$.fx.off = true;
|
||||
|
||||
cloudStack = {
|
||||
sections: {
|
||||
home: {
|
||||
show: function() { return $('<div>').addClass('test123'); }
|
||||
},
|
||||
sectionA: {
|
||||
show: function() { return $('<div>').addClass('notification123'); }
|
||||
}
|
||||
},
|
||||
|
||||
home: 'home'
|
||||
};
|
||||
|
||||
$cloudStack = $('<div>').appendTo($('#qunit-fixture'));
|
||||
ok($cloudStack.cloudStack(cloudStack), 'Basic widget initialized');
|
||||
|
||||
// Need to cleanup here -- not handled by widget
|
||||
$('.notification-box').remove();
|
||||
|
||||
$notifications = $('<div>').appendTo($cloudStack);
|
||||
ok($notifications.notifications(), 'Initialize notifications widget');
|
||||
$notificationBox = $('.notification-box');
|
||||
}
|
||||
});
|
||||
|
||||
test('Widget setup', function() {
|
||||
ok($notifications.hasClass('notifications'), 'Correct styling assigned');
|
||||
equal($notificationBox.size(), 1, 'Notification box present');
|
||||
});
|
||||
|
||||
test('Add notification via widget', function() {
|
||||
stop();
|
||||
$notifications.notifications('add', { // Basic notification
|
||||
desc: 'testNotification123',
|
||||
interval: 0,
|
||||
poll: function(args) {
|
||||
var $li = $notificationBox.find('li');
|
||||
|
||||
start();
|
||||
equal($li.size(), 1, 'Notification added to list');
|
||||
equal($li.find('span').html(), 'testNotification123', 'Notification description correct');
|
||||
ok($li.hasClass('pending'), 'Notification item has pending state');
|
||||
ok($notificationBox.find('.button.clear-list').click(), 'Clear list button click');
|
||||
equal($notificationBox.find('li').size(), 1, 'Notification list still has correct number of items');
|
||||
args.complete();
|
||||
ok(!$li.hasClass('pending'), 'Notification item has non-pending (complete) state');
|
||||
|
||||
stop();
|
||||
$notifications.notifications('add', { // More comprehensive notification
|
||||
desc: 'testNotification456',
|
||||
interval: 0,
|
||||
_custom: {
|
||||
attrA: '123',
|
||||
attrB: '456'
|
||||
},
|
||||
section: 'sectionA',
|
||||
poll: function(args) {
|
||||
var $li = $notificationBox.find('li');
|
||||
|
||||
start();
|
||||
equal($li.size(), 2, 'Notification list is correct');
|
||||
ok($.isPlainObject(args._custom), '_custom present');
|
||||
equal(args._custom.attrA, '123', '_custom attr A correct');
|
||||
equal(args._custom.attrB, '456', '_custom attr B correct');
|
||||
ok($li.filter(':last').hasClass('pending'), 'New notification item has pending state');
|
||||
ok(!$li.filter(':first').hasClass('pending'), 'First notification item still has non-pending (complete) state');
|
||||
ok($notificationBox.find('.button.clear-list').click(), 'Clear list button click');
|
||||
ok(!$notificationBox.find('li:first').is(':visible'), 'First (completed) notification item cleared');
|
||||
args.complete();
|
||||
ok(!$li.hasClass('pending'), 'All notifications item has non-pending (complete) state');
|
||||
equal($li.filter(':last').data('notification-section'), 'sectionA', 'Section data is correct in last notification');
|
||||
equal($li.filter(':first').find('span').html(), 'testNotification123', 'First notification description correct');
|
||||
equal($li.filter(':last').find('span').html(), 'testNotification456', 'Second notification description correct');
|
||||
$li.filter(':last').find('span').click();
|
||||
equal($cloudStack.find('.notification123').size(), 1, 'Notification item text goes to correct section on click');
|
||||
ok($li.filter(':last').find('.remove').click(), 'Remove first item');
|
||||
equal($notificationBox.find('li').size(), 0, 'Notification list has no items anymore');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}(jQuery));
|
||||
2
wscript
2
wscript
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
# the following two variables are used by the target "waf dist"
|
||||
# if you change 'em here, you need to change it also in cloud.spec, add a %changelog entry there, and add an entry in debian/changelog
|
||||
VERSION = '3.0.1.2012-04-18T22:05:29Z'
|
||||
VERSION = '3.0.3.2012-05-01T14:07:52Z'
|
||||
APPNAME = 'cloud'
|
||||
|
||||
import shutil,os
|
||||
|
|
|
|||
Loading…
Reference in New Issue