Skip to content

Commit

Permalink
Merge pull request Azure#20 from gcheng/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Albert Cheng committed Oct 4, 2012
2 parents 87d3da5 + 3f29fc3 commit 05da773
Show file tree
Hide file tree
Showing 114 changed files with 8,902 additions and 1,087 deletions.
11 changes: 11 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
2012.09.11 Version 0.3.1
* Added Javadocs to 1.7 Storage Support from 0.3.0 release
* Fixed bug where getqueue for an invalid queue returns 200 and the exception is not wrapped in a ServiceException
* Fixed the error when deleting a blob snapshot in the Service Layer
* Changed the PageBlob length parameter from an int to a long
* Return an Etag for create and copy Blob in Service Layer
* Updated the BlobRestProxy.copyBlob to correctly honor source access conditions
* Updated the BlobRestProxy.getBlob to correctly honor setComputeRangeMD5 option
* Added international support for ServiceBus URIs
* Added encoding for special characters when serializing entity to XML in Table Service Layer

2012.06.02 Version 0.3.0
* Added 1.7 Storage Support
* Added Javadocs for com.microsoft.windowsazure.services.table
Expand Down
111 changes: 56 additions & 55 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ within your project you can also have them installed by the Java package manager
<dependency>
<groupId>com.microsoft.windowsazure</groupId>
<artifactId>microsoft-windowsazure-api</artifactId>
<version>0.3.0</version>
<version>0.3.1</version>
</dependency>

##Minimum Requirements
Expand All @@ -62,61 +62,62 @@ deployment tools.
The following is a quick example on how to set up a Azure blob using the API
and uploading a file to it. For additional information on using the client libraries to access Azure services see the How To guides listed [here](http://www.windowsazure.com/en-us/develop/java/).

import com.microsoft.windowsazure.services.core.storage.*;
import com.microsoft.windowsazure.services.blob.client.*;

public class BlobSample {

public static final String storageConnectionString =
"DefaultEndpointsProtocol=http;" +
"AccountName=your_account_name;" +
"AccountKey= your_account_name";

public static void main(String[] args)
{
try
{
CloudStorageAccount account;
CloudBlobClient serviceClient;
CloudBlobContainer container;
CloudBlockBlob blob;
account = CloudStorageAccount.parse(storageConnectionString);
serviceClient = account.createCloudBlobClient();
// Container name must be lower case.
container = serviceClient.getContainerReference("blobsample");
container.createIfNotExist();
// Set anonymous access on the container.
BlobContainerPermissions containerPermissions;
containerPermissions = new BlobContainerPermissions();

// Upload an image file.
blob = container.getBlockBlobReference("image1.jpg");
File fileReference = new File ("c:\\myimages\\image1.jpg");
blob.upload(new FileInputStream(fileReference), fileReference.length());
}
catch (FileNotFoundException fileNotFoundException)
{
System.out.print("FileNotFoundException encountered: ");
System.out.println(fileNotFoundException.getMessage());
System.exit(-1);
}
catch (StorageException storageException)
{
System.out.print("StorageException encountered: ");
System.out.println(storageException.getMessage());
System.exit(-1);
}
catch (Exception e)
{
System.out.print("Exception encountered: ");
System.out.println(e.getMessage());
System.exit(-1);
}

import com.microsoft.windowsazure.services.core.storage.*;
import com.microsoft.windowsazure.services.blob.client.*;

public class BlobSample {
public static final String storageConnectionString =
"DefaultEndpointsProtocol=http;" +
"AccountName=your_account_name;" +
"AccountKey= your_account_name";

public static void main(String[] args)
{
try
{
CloudStorageAccount account;
CloudBlobClient serviceClient;
CloudBlobContainer container;
CloudBlockBlob blob;
}
}
account = CloudStorageAccount.parse(storageConnectionString);
serviceClient = account.createCloudBlobClient();
// Container name must be lower case.
container = serviceClient.getContainerReference("blobsample");
container.createIfNotExist();
// Set anonymous access on the container.
BlobContainerPermissions containerPermissions;
containerPermissions = new BlobContainerPermissions();

// Upload an image file.
blob = container.getBlockBlobReference("image1.jpg");
File fileReference = new File ("c:\\myimages\\image1.jpg");
blob.upload(new FileInputStream(fileReference), fileReference.length());
}
catch (FileNotFoundException fileNotFoundException)
{
System.out.print("FileNotFoundException encountered: ");
System.out.println(fileNotFoundException.getMessage());
System.exit(-1);
}
catch (StorageException storageException)
{
System.out.print("StorageException encountered: ");
System.out.println(storageException.getMessage());
System.exit(-1);
}
catch (Exception e)
{
System.out.print("Exception encountered: ");
System.out.println(e.getMessage());
System.exit(-1);
}

}
}


#Need Help?

Expand Down
2 changes: 1 addition & 1 deletion microsoft-azure-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.microsoft.windowsazure</groupId>
<artifactId>microsoft-windowsazure-api</artifactId>
<version>0.3.0</version>
<version>0.3.1</version>
<packaging>jar</packaging>

<name>Microsoft Windows Azure Client API</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,38 +44,74 @@ final class BlobAttributes {
public String snapshotID;

/**
* Holds the URI of the blob, Setting this is RESERVED for internal use.
* Holds the URI of the blob. RESERVED for internal use.
*/
protected URI uri;

/**
* Initializes a new instance of the BlobAttributes class
/**
* Initializes a new instance of the BlobAttributes class. RESERVED FOR INTERNAL USE.
*
* @param type
* The type of blob to set.
*/
public BlobAttributes(final BlobType type) {
this.setMetadata(new HashMap<String, String>());
this.setProperties(new BlobProperties(type));
}

/**
* Gets the metadata for the blob. RESERVED FOR INTERNAL USE.
*
* @return A <code>HashMap</code> object containing the metadata for the blob.
*/
public HashMap<String, String> getMetadata() {
return this.metadata;
}

/**
* Gets the copy state of the blob. RESERVED FOR INTERNAL USE.
*
* @return A <code>CopyState</code> object representing the copy state.
*/
public CopyState getCopyState() {
return this.copyState;
}

/**
* Gets the properties for the blob. RESERVED FOR INTERNAL USE.
*
* @return A <code>BlobProperties</code> object that represents the blob properties.
*/
public BlobProperties getProperties() {
return this.properties;
}

/**
* Sets the metadata for a blob. RESERVED FOR INTERNAL USE.
*
* @param metadata
* The blob meta data to set.
*/
protected void setMetadata(final HashMap<String, String> metadata) {
this.metadata = metadata;
}

/**
* Sets the properties for a blob. RESERVED FOR INTERNAL USE.
*
* @param properties
* The blob properties to set.
*/
protected void setProperties(final BlobProperties properties) {
this.properties = properties;
}

/**
* Sets the copy state for a blob. RESERVED FOR INTERNAL USE.
*
* @param copyState
* The blob copy state to set.
*/
public void setCopyState(final CopyState copyState) {
this.copyState = copyState;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,67 +72,77 @@ public Date getLastModified() {
}

/**
* @return the leaseStatus
* Gets the lease status of the container.
*
* @return The lease status as a <code>LeaseStatus</code> object.
*/
public LeaseStatus getLeaseStatus() {
return this.leaseStatus;
}

/**
* @return the leaseState
* Gets the lease state of the container.
*
* @return The lease state as a <code>LeaseState</code> object.
*/
public LeaseState getLeaseState() {
return this.leaseState;
}

/**
* @return the leaseDuration
* Gets the lease duration of the container.
*
* @return The lease duration as a <code>LeaseDuration</code> object.
*/
public LeaseDuration getLeaseDuration() {
return this.leaseDuration;
}

/**
* Sets the ETag value on the container.
*
* @param etag
* the etag to set
* The ETag value to set, as a string.
*/
public void setEtag(final String etag) {
this.etag = etag;
}

/**
* Sets the last modified time on the container.
*
* @param lastModified
* the lastModified to set
* The last modified time to set, as a <code>Date</code> object.
*/
public void setLastModified(final Date lastModified) {
this.lastModified = lastModified;
}

/**
* Reserved for internal use.
* Sets the lease status on the container. Reserved for internal use.
*
* @param leaseStatus
* the leaseStatus to set
* The lease status to set, as a <code>LeaseStatus</code> object.
*/
public void setLeaseStatus(final LeaseStatus leaseStatus) {
this.leaseStatus = leaseStatus;
}

/**
* Reserved for internal use.
* Sets the lease status on the container. Reserved for internal use.
*
* @param LeaseState
* the LeaseState to set
* The lease state to set, as a <code>LeaseState</code> object.
*/
public void setLeaseState(final LeaseState leaseState) {
this.leaseState = leaseState;
}

/**
* Reserved for internal use.
* Sets the lease duration on the container. Reserved for internal use.
*
* @param LeaseDuration
* the LeaseDuration to set
* The lease duration to set, as a <code>LeaseDuration</code> object.
*/
public void setLeaseDuration(final LeaseDuration leaseDuration) {
this.leaseDuration = leaseDuration;
Expand Down
Loading

0 comments on commit 05da773

Please sign in to comment.