diff --git a/ChangeLog.txt b/ChangeLog.txt
index 126f399..b86de01 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -1,4 +1,7 @@
-2014.12.22 Version 0.4.0
+2015.01 Version 0.4.1
+ * Fixed a bug for Android 5.0 only that caused auth failures on deletes.
+
+2014.12 Version 0.4.0
* Deprecated getSubDirectoryReference() for blob directories and file directories. Use getDirectoryReference() instead.
* Fixed a bug where maxResults was not verified to be positive for list operations.
* Deprecated AuthenticationScheme and its getter and setter. In the future only SharedKey will be used.
@@ -6,15 +9,15 @@
* Fixed a bug where high precision Date values stored on Table Entites were forced to fit into milliseconds resulting in inaccuracies. Precision is limited to 1 millisecond by the Android Date class. If greater precision is required, the String should be used directly.
* Added TableRequestOptions.dateBackwardCompatibility, which supports reading Date values on Table Entities written using versions of this library prior to 0.4.0. See http://go.microsoft.com/fwlink/?LinkId=523753 for more details.
-2014.10.10 Version 0.3.1
+2014.10 Version 0.3.1
* Fixed a bug where a NullPointerException was thrown instead of a NetworkOnMainThreadException if code was executed on the main thread.
-2014.08.01 Version 0.3.0
+2014.08 Version 0.3.0
* Added the NameValidator class which contains helpers that check to see if resource names are valid.
* Fixed a bug where the RequestUrl of a LogRecord was not correctly HTML4 decoded.
* Made FileRange class and ListFilesAndDirectories method in the CloudFileDirectory class public.
-2014.07.02 Version 0.2.0
+2014.07 Version 0.2.0
* Added File Service support. The File Service and the associated SDK APIs are in preview.
* Added CloudAnalyticsClient and related methods to simplify Storage Analytics logging and metrics use case scenarios.
* Fixed a bug where an empty file would be left over during the downloadToFile error case.
diff --git a/README.md b/README.md
index e716e8b..590a188 100644
--- a/README.md
+++ b/README.md
@@ -44,7 +44,7 @@ First, add mavenCentral to your repositories by adding the following to your gra
Then, add a dependency by adding the following to your gradle build file:
dependencies {
- compile 'com.microsoft.azure.android:azure-storage-android:0.3.0@aar'
+ compile 'com.microsoft.azure.android:azure-storage-android:0.4.1@aar'
}
###Option 4: aar via Maven
@@ -55,7 +55,7 @@ To get the binaries of this library as distributed by Microsoft, ready for use w
com.microsoft.azure.androidazure-storage-android
- 0.3.1
+ 0.4.1aar
```
@@ -77,63 +77,9 @@ Make sure the storage client library is added as a project dependency. If using
If using Maven or Gradle, Jackson-Core should be automatically added to the build path. Otherwise, please download the jar and add it to your build path. Also, please make sure that the jar will be added to your project's apk. To do this in Eclipse, right click your project, select "Build Path->Configure Build Path", navigate to the "Order and Export" tab and check the box next to the jackson-core jar.
-##Code Sample
-
-The following is a quick example on how to upload a file to azure blob and download it back. You may also download and view the samples in the microsoft-azure-storage-samples folder. For additional information on using the Android client library, the Java [general documentation](http://azure.microsoft.com/en-us/develop/java/) and Java How To guides for [blobs](http://azure.microsoft.com/en-us/documentation/articles/storage-java-how-to-use-blob-storage/), [queues](http://azure.microsoft.com/en-us/documentation/articles/storage-java-how-to-use-queue-storage/), [tables](http://azure.microsoft.com/en-us/documentation/articles/storage-java-how-to-use-table-storage/) may be helpful.
-
-```java
-import java.io.*;
-
-import com.microsoft.azure.storage.*;
-import com.microsoft.azure.storage.blob.*;
-
-public class BlobSample {
- public static final String storageConnectionString =
- "DefaultEndpointsProtocol=http;"
- + "AccountName=your_account_name;"
- + "AccountKey= your_account_key";
-
- public static void main(String[] args) {
- try {
- CloudStorageAccount account = CloudStorageAccount.parse(storageConnectionString);
- CloudBlobClient serviceClient = account.createCloudBlobClient();
-
- // Container name must be lower case.
- CloudBlobContainer container = serviceClient.getContainerReference("myimages");
- container.createIfNotExists();
-
- // Set anonymous read access on the container.
- BlobContainerPermissions containerPermissions = new BlobContainerPermissions();
- containerPermissions.setPublicAccess(BlobContainerPublicAccessType.CONTAINER);
- container.uploadPermissions(containerPermissions);
-
- // Upload an image file.
- CloudBlockBlob blob = container.getBlockBlobReference("image1.jpg");
- File sourceFile = new File("c:\\myimages\\image1.jpg");
- blob.upload(new FileInputStream(sourceFile), sourceFile.length());
-
- // Download the image file.
- File destinationFile = new File(sourceFile.getParentFile(), "image1Download.tmp");
- blob.downloadToFile(destinationFile.getAbsolutePath());
- }
- 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);
- }
- }
-}
-```
+##Code Samples
+
+Runnable samples for blob, queue, and table may be found in the microsoft-azure-storage-samples directory. To run these samples, specify a connection string in the MainActivity class and add a dependency on the Android client library. For additional information on using the Android client library, the Java [general documentation](http://azure.microsoft.com/en-us/develop/java/) and Java How To guides for [blobs](http://azure.microsoft.com/en-us/documentation/articles/storage-java-how-to-use-blob-storage/), [queues](http://azure.microsoft.com/en-us/documentation/articles/storage-java-how-to-use-queue-storage/), [tables](http://azure.microsoft.com/en-us/documentation/articles/storage-java-how-to-use-table-storage/) may be helpful.
#Need Help?
diff --git a/microsoft-azure-storage-samples/AndroidManifest.xml b/microsoft-azure-storage-samples/AndroidManifest.xml
index 37c8d4f..8bc8ff4 100644
--- a/microsoft-azure-storage-samples/AndroidManifest.xml
+++ b/microsoft-azure-storage-samples/AndroidManifest.xml
@@ -1,13 +1,28 @@
+ android:versionName="0.4.1" >
+ android:targetSdkVersion="21" />
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/microsoft-azure-storage-samples/res/drawable-hdpi/ic_launcher.png b/microsoft-azure-storage-samples/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 0000000..288b665
Binary files /dev/null and b/microsoft-azure-storage-samples/res/drawable-hdpi/ic_launcher.png differ
diff --git a/microsoft-azure-storage-samples/res/drawable-mdpi/ic_launcher.png b/microsoft-azure-storage-samples/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 0000000..6ae570b
Binary files /dev/null and b/microsoft-azure-storage-samples/res/drawable-mdpi/ic_launcher.png differ
diff --git a/microsoft-azure-storage-samples/res/drawable-xhdpi/ic_launcher.png b/microsoft-azure-storage-samples/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..d4fb7cd
Binary files /dev/null and b/microsoft-azure-storage-samples/res/drawable-xhdpi/ic_launcher.png differ
diff --git a/microsoft-azure-storage-samples/res/drawable-xxhdpi/ic_launcher.png b/microsoft-azure-storage-samples/res/drawable-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..85a6081
Binary files /dev/null and b/microsoft-azure-storage-samples/res/drawable-xxhdpi/ic_launcher.png differ
diff --git a/microsoft-azure-storage-samples/res/layout/activity_main.xml b/microsoft-azure-storage-samples/res/layout/activity_main.xml
new file mode 100644
index 0000000..25b5590
--- /dev/null
+++ b/microsoft-azure-storage-samples/res/layout/activity_main.xml
@@ -0,0 +1,8 @@
+
+
diff --git a/microsoft-azure-storage-samples/res/layout/fragment_main.xml b/microsoft-azure-storage-samples/res/layout/fragment_main.xml
new file mode 100644
index 0000000..fcba066
--- /dev/null
+++ b/microsoft-azure-storage-samples/res/layout/fragment_main.xml
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/microsoft-azure-storage-samples/res/menu/main.xml b/microsoft-azure-storage-samples/res/menu/main.xml
new file mode 100644
index 0000000..6deff26
--- /dev/null
+++ b/microsoft-azure-storage-samples/res/menu/main.xml
@@ -0,0 +1,11 @@
+
diff --git a/microsoft-azure-storage-samples/res/values-v11/styles.xml b/microsoft-azure-storage-samples/res/values-v11/styles.xml
new file mode 100644
index 0000000..3c02242
--- /dev/null
+++ b/microsoft-azure-storage-samples/res/values-v11/styles.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
diff --git a/microsoft-azure-storage-samples/res/values-v14/styles.xml b/microsoft-azure-storage-samples/res/values-v14/styles.xml
new file mode 100644
index 0000000..a91fd03
--- /dev/null
+++ b/microsoft-azure-storage-samples/res/values-v14/styles.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
diff --git a/microsoft-azure-storage-samples/res/values-w820dp/dimens.xml b/microsoft-azure-storage-samples/res/values-w820dp/dimens.xml
new file mode 100644
index 0000000..f3e7020
--- /dev/null
+++ b/microsoft-azure-storage-samples/res/values-w820dp/dimens.xml
@@ -0,0 +1,10 @@
+
+
+
+ 64dp
+
+
diff --git a/microsoft-azure-storage-samples/res/values/dimens.xml b/microsoft-azure-storage-samples/res/values/dimens.xml
new file mode 100644
index 0000000..55c1e59
--- /dev/null
+++ b/microsoft-azure-storage-samples/res/values/dimens.xml
@@ -0,0 +1,7 @@
+
+
+
+ 16dp
+ 16dp
+
+
diff --git a/microsoft-azure-storage-samples/res/values/strings.xml b/microsoft-azure-storage-samples/res/values/strings.xml
new file mode 100644
index 0000000..5da712d
--- /dev/null
+++ b/microsoft-azure-storage-samples/res/values/strings.xml
@@ -0,0 +1,11 @@
+
+
+
+ Azure Storage Samples
+ Blob Getting Started Sample
+ Queue Getting Started Sample
+ Table Getting Started Sample
+ Table Payload Format Sample
+ Settings
+
+
diff --git a/microsoft-azure-storage-samples/res/values/styles.xml b/microsoft-azure-storage-samples/res/values/styles.xml
new file mode 100644
index 0000000..6ce89c7
--- /dev/null
+++ b/microsoft-azure-storage-samples/res/values/styles.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
diff --git a/microsoft-azure-storage-samples/src/com/microsoft/azure/storage/blob/gettingstarted/BlobBasics.java b/microsoft-azure-storage-samples/src/com/microsoft/azure/storage/blob/gettingstarted/BlobBasics.java
deleted file mode 100644
index 61d2be5..0000000
--- a/microsoft-azure-storage-samples/src/com/microsoft/azure/storage/blob/gettingstarted/BlobBasics.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/**
- * Copyright Microsoft Corporation
- *
- * 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.microsoft.azure.storage.blob.gettingstarted;
-
-import java.net.URISyntaxException;
-import java.security.InvalidKeyException;
-
-import com.microsoft.azure.storage.CloudStorageAccount;
-import com.microsoft.azure.storage.blob.BlobContainerPermissions;
-import com.microsoft.azure.storage.blob.BlobContainerPublicAccessType;
-import com.microsoft.azure.storage.blob.CloudBlobClient;
-import com.microsoft.azure.storage.blob.CloudBlobContainer;
-import com.microsoft.azure.storage.blob.CloudBlockBlob;
-import com.microsoft.azure.storage.blob.ListBlobItem;
-import com.microsoft.azure.storage.util.Utility;
-
-/**
- * This sample illustrates basic usage of the various Blob Primitives provided
- * in the Storage Client Library including CloudBlobContainer, CloudBlockBlob
- * and CloudBlobClient.
- */
-public class BlobBasics {
-
- /**
- * Executes the sample.
- *
- * @param args
- * No input args are expected from users.
- * @throws URISyntaxException
- * @throws InvalidKeyException
- */
- public static void main(String[] args) throws InvalidKeyException, URISyntaxException {
- Utility.printSampleStartInfo("BlobBasics");
-
- // Setup the cloud storage account.
- CloudStorageAccount account = CloudStorageAccount.parse(Utility.storageConnectionString);
-
- // Create a blob service client
- CloudBlobClient blobClient = account.createCloudBlobClient();
-
- try {
- // Get a reference to a container
- // The container name must be lower case
- CloudBlobContainer container = blobClient.getContainerReference("blobbasicscontainer");
-
- // Create the container if it does not exist
- container.createIfNotExists();
-
- // Make the container public
- // Create a permissions object
- BlobContainerPermissions containerPermissions = new BlobContainerPermissions();
-
- // Include public access in the permissions object
- containerPermissions.setPublicAccess(BlobContainerPublicAccessType.CONTAINER);
-
- // Set the permissions on the container
- container.uploadPermissions(containerPermissions);
-
- // Upload 3 blobs
- // Get a reference to a blob in the container
- CloudBlockBlob blob1 = container.getBlockBlobReference("blobbasicsblob1");
-
- // Upload text to the blob
- blob1.uploadText("Hello, World1");
-
- // Get a reference to a blob in the container
- CloudBlockBlob blob2 = container.getBlockBlobReference("blobbasicsblob2");
-
- // Upload text to the blob
- blob2.uploadText("Hello, World2");
-
- // Get a reference to a blob in the container
- CloudBlockBlob blob3 = container.getBlockBlobReference("blobbasicsblob3");
-
- // Upload text to the blob
- blob3.uploadText("Hello, World3");
-
- // Download the blob
- // For each item in the container
- for (ListBlobItem blobItem : container.listBlobs()) {
- // If the item is a blob, not a virtual directory
- if (blobItem instanceof CloudBlockBlob) {
- // Download the text
- CloudBlockBlob retrievedBlob = (CloudBlockBlob) blobItem;
- System.out.println(retrievedBlob.downloadText());
- }
- }
-
- // List the blobs in a container, loop over them and
- // output the URI of each of them
- for (ListBlobItem blobItem : container.listBlobs()) {
- System.out.println(blobItem.getUri());
- }
-
- // Delete the blobs
- blob1.deleteIfExists();
- blob2.deleteIfExists();
- blob3.deleteIfExists();
-
- // Delete the container
- container.deleteIfExists();
- }
- catch (Throwable t) {
- Utility.printException(t);
- }
-
- Utility.printSampleCompleteInfo("BlobBasics");
- }
-}
diff --git a/microsoft-azure-storage-samples/src/com/microsoft/azure/storage/queue/gettingstarted/QueueBasics.java b/microsoft-azure-storage-samples/src/com/microsoft/azure/storage/queue/gettingstarted/QueueBasics.java
deleted file mode 100644
index 5aa6f11..0000000
--- a/microsoft-azure-storage-samples/src/com/microsoft/azure/storage/queue/gettingstarted/QueueBasics.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/**
- * Copyright Microsoft Corporation
- *
- * 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.microsoft.azure.storage.queue.gettingstarted;
-
-import java.net.URISyntaxException;
-import java.security.InvalidKeyException;
-import java.util.EnumSet;
-
-import com.microsoft.azure.storage.CloudStorageAccount;
-import com.microsoft.azure.storage.queue.CloudQueue;
-import com.microsoft.azure.storage.queue.CloudQueueClient;
-import com.microsoft.azure.storage.queue.CloudQueueMessage;
-import com.microsoft.azure.storage.queue.MessageUpdateFields;
-import com.microsoft.azure.storage.util.Utility;
-
-/**
- * This sample illustrates basic usage of the various Queue Primitives provided
- * in the Storage Client Library including CloudQueue, CloudQueueMessage
- * and CloudQueueClient.
- */
-public class QueueBasics {
-
- /**
- * Executes the sample.
- *
- * @param args
- * No input args are expected from users.
- * @throws URISyntaxException
- * @throws InvalidKeyException
- */
- public static void main(String[] args) throws InvalidKeyException, URISyntaxException {
- Utility.printSampleStartInfo("QueueBasics");
-
- // Setup the cloud storage account.
- CloudStorageAccount account = CloudStorageAccount.parse(Utility.storageConnectionString);
-
- // Create a queue service client
- CloudQueueClient queueClient = account.createCloudQueueClient();
-
- try {
- // Retrieve a reference to a queue
- CloudQueue queue = queueClient.getQueueReference("queuebasics");
-
- // Create the queue if it doesn't already exist
- queue.createIfNotExists();
-
- // Create messages and add it to the queue
- CloudQueueMessage message1 = new CloudQueueMessage("Hello, World1");
- queue.addMessage(message1);
-
- CloudQueueMessage message2 = new CloudQueueMessage("Hello, World2");
- queue.addMessage(message2);
-
- CloudQueueMessage message3 = new CloudQueueMessage("Hello, World3");
- queue.addMessage(message3);
-
- CloudQueueMessage message4 = new CloudQueueMessage("Hello, World4");
- queue.addMessage(message4);
-
- CloudQueueMessage message5 = new CloudQueueMessage("Hello, World5");
- queue.addMessage(message5);
-
- // Peek at the next message
- CloudQueueMessage peekedMessage = queue.peekMessage();
- System.out.println(String.format("Peeked Message : %s", peekedMessage.getMessageContentAsString()));
-
- // Modify the message content and set it to be visible immediately
- // Retrieve the first visible message in the queue
- CloudQueueMessage updateMessage = queue.retrieveMessage();
- updateMessage.setMessageContent("Updated contents.");
- EnumSet updateFields =
- EnumSet.of(MessageUpdateFields.CONTENT, MessageUpdateFields.VISIBILITY);
- queue.updateMessage(updateMessage, 0, updateFields, null, null);
-
- // Retrieve 3 messages from the queue with a visibility timeout of 1 second
- queue.retrieveMessages(3, 1, null, null);
-
- // Sleep for 2 seconds so the messages become visible and can be processed/deleted
- Thread.sleep(2000);
-
- // Retrieve the messages in the queue with a visibility timeout of 30 seconds and delete them
- CloudQueueMessage retrievedMessage;
- while((retrievedMessage = queue.retrieveMessage(30, null /*options*/, null /*opContext*/)) != null) {
- // Process the message in less than 30 seconds, and then delete the message.
- System.out.println(retrievedMessage.getMessageContentAsString());
- queue.deleteMessage(retrievedMessage);
- }
-
- // Delete a queue
- queue.deleteIfExists();
-
- }catch (Throwable t) {
- Utility.printException(t);
- }
-
- Utility.printSampleCompleteInfo("QueueBasics");
- }
-}
diff --git a/microsoft-azure-storage-samples/src/com/microsoft/azure/storage/samples/MainActivity.java b/microsoft-azure-storage-samples/src/com/microsoft/azure/storage/samples/MainActivity.java
new file mode 100644
index 0000000..716e09c
--- /dev/null
+++ b/microsoft-azure-storage-samples/src/com/microsoft/azure/storage/samples/MainActivity.java
@@ -0,0 +1,178 @@
+package com.microsoft.azure.storage.samples;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+import com.microsoft.azure.storage.samples.blob.BlobGettingStartedTask;
+import com.microsoft.azure.storage.samples.queue.QueueGettingStartedTask;
+import com.microsoft.azure.storage.samples.table.TableGettingStartedTask;
+import com.microsoft.azure.storage.samples.table.TablePayloadFormatTask;
+
+import android.app.Activity;
+import android.app.Fragment;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+public class MainActivity extends Activity {
+
+ /**
+ * MODIFY THIS!
+ *
+ * Stores the storage connection string.
+ */
+ public static final String storageConnectionString = "DefaultEndpointsProtocol=https;"
+ + "AccountName=[MY_ACCOUNT_NAME];"
+ + "AccountKey=[MY_ACCOUNT_KEY]";
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+
+ if (savedInstanceState == null) {
+ getFragmentManager().beginTransaction()
+ .add(R.id.container, new PlaceholderFragment()).commit();
+ }
+ }
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ // Inflate the menu; this adds items to the action bar if it is present.
+ getMenuInflater().inflate(R.menu.main, menu);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ // Handle action bar item clicks here. The action bar will
+ // automatically handle clicks on the Home/Up button, so long
+ // as you specify a parent activity in AndroidManifest.xml.
+ int id = item.getItemId();
+ if (id == R.id.action_settings) {
+ return true;
+ }
+ return super.onOptionsItemSelected(item);
+ }
+
+ /**
+ * Runs the blob getting started sample.
+ */
+ public void runBlobGettingStartedSample(View view) {
+ new BlobGettingStartedTask(this, (TextView) findViewById(R.id.textView))
+ .execute();
+ }
+
+ /**
+ * Runs the queue getting started sample.
+ */
+ public void runQueueGettingStartedSample(View view) {
+ new QueueGettingStartedTask(this,
+ (TextView) findViewById(R.id.textView)).execute();
+ }
+
+ /**
+ * Runs the table getting started sample.
+ */
+ public void runTableGettingStartedSample(View view) {
+ new TableGettingStartedTask(this,
+ (TextView) findViewById(R.id.textView)).execute();
+ }
+
+ /**
+ * Runs the table payload format sample.
+ */
+ public void runTablePayloadFormatSample(View view) {
+ new TablePayloadFormatTask(this, (TextView) findViewById(R.id.textView))
+ .execute();
+ }
+
+ /**
+ * A placeholder fragment containing a simple view.
+ */
+ public static class PlaceholderFragment extends Fragment {
+
+ public PlaceholderFragment() {
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ View rootView = inflater.inflate(R.layout.fragment_main, container,
+ false);
+ return rootView;
+ }
+ }
+
+ /**
+ * Prints the specified text value to the view and to LogCat.
+ *
+ * @param view
+ * The view to print to.
+ * @param value
+ * The value to print.
+ */
+ public void outputText(final TextView view, final String value) {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ view.append(value + "\n");
+ System.out.println(view);
+ }
+ });
+ }
+
+ /**
+ * Clears the text from the specified view.
+ *
+ * @param view
+ * The view to clear.
+ */
+ public void clearText(final TextView view) {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ view.setText("");
+ }
+ });
+ }
+
+ /**
+ * Prints out the exception information .
+ */
+ public void printException(Throwable t) {
+ StringWriter stringWriter = new StringWriter();
+ PrintWriter printWriter = new PrintWriter(stringWriter);
+ t.printStackTrace(printWriter);
+ outputText(
+ (TextView) findViewById(R.id.textView),
+ String.format(
+ "Got an exception from running samples. Exception details:\n%s\n",
+ stringWriter.toString()));
+ }
+
+ /**
+ * Prints out the sample start information .
+ */
+ public void printSampleStartInfo(String sampleName) {
+ TextView view = (TextView) findViewById(R.id.textView);
+ clearText(view);
+ outputText(view, String.format(
+ "The Azure storage client library sample %s is starting...",
+ sampleName));
+ }
+
+ /**
+ * Prints out the sample complete information .
+ */
+ public void printSampleCompleteInfo(String sampleName) {
+ outputText((TextView) findViewById(R.id.textView), String.format(
+ "The Azure storage client library sample %s completed.\n",
+ sampleName));
+ }
+
+}
diff --git a/microsoft-azure-storage-samples/src/com/microsoft/azure/storage/samples/blob/BlobGettingStartedTask.java b/microsoft-azure-storage-samples/src/com/microsoft/azure/storage/samples/blob/BlobGettingStartedTask.java
new file mode 100644
index 0000000..29e5374
--- /dev/null
+++ b/microsoft-azure-storage-samples/src/com/microsoft/azure/storage/samples/blob/BlobGettingStartedTask.java
@@ -0,0 +1,129 @@
+/**
+ * Copyright Microsoft Corporation
+ *
+ * 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.microsoft.azure.storage.samples.blob;
+
+import java.util.UUID;
+
+import android.os.AsyncTask;
+import android.widget.TextView;
+
+import com.microsoft.azure.storage.CloudStorageAccount;
+import com.microsoft.azure.storage.samples.MainActivity;
+import com.microsoft.azure.storage.blob.*;
+
+/**
+ * This sample illustrates basic usage of the various Blob Primitives provided
+ * in the Storage Client Library including CloudBlobContainer, CloudBlockBlob
+ * and CloudBlobClient.
+ */
+public class BlobGettingStartedTask extends AsyncTask {
+
+ private TextView view;
+ private MainActivity act;
+
+ public BlobGettingStartedTask(MainActivity act, TextView view) {
+ this.view = view;
+ this.act = act;
+ }
+
+ @Override
+ protected Void doInBackground(String... arg0) {
+
+ act.printSampleStartInfo("BlobBasics");
+
+ try {
+ // Setup the cloud storage account.
+ CloudStorageAccount account = CloudStorageAccount
+ .parse(MainActivity.storageConnectionString);
+
+ // Create a blob service client
+ CloudBlobClient blobClient = account.createCloudBlobClient();
+
+ // Get a reference to a container
+ // The container name must be lower case
+ // Append a random UUID to the end of the container name so that
+ // this sample can be run more than once in quick succession.
+ CloudBlobContainer container = blobClient.getContainerReference("blobbasicscontainer"
+ + UUID.randomUUID().toString().replace("-", ""));
+
+ // Create the container if it does not exist
+ container.createIfNotExists();
+
+ // Make the container public
+ // Create a permissions object
+ BlobContainerPermissions containerPermissions = new BlobContainerPermissions();
+
+ // Include public access in the permissions object
+ containerPermissions
+ .setPublicAccess(BlobContainerPublicAccessType.CONTAINER);
+
+ // Set the permissions on the container
+ container.uploadPermissions(containerPermissions);
+
+ // Upload 3 blobs
+ // Get a reference to a blob in the container
+ CloudBlockBlob blob1 = container
+ .getBlockBlobReference("blobbasicsblob1");
+
+ // Upload text to the blob
+ blob1.uploadText("Hello, World1");
+
+ // Get a reference to a blob in the container
+ CloudBlockBlob blob2 = container
+ .getBlockBlobReference("blobbasicsblob2");
+
+ // Upload text to the blob
+ blob2.uploadText("Hello, World2");
+
+ // Get a reference to a blob in the container
+ CloudBlockBlob blob3 = container
+ .getBlockBlobReference("blobbasicsblob3");
+
+ // Upload text to the blob
+ blob3.uploadText("Hello, World3");
+
+ // Download the blob
+ // For each item in the container
+ for (ListBlobItem blobItem : container.listBlobs()) {
+ // If the item is a blob, not a virtual directory
+ if (blobItem instanceof CloudBlockBlob) {
+ // Download the text
+ CloudBlockBlob retrievedBlob = (CloudBlockBlob) blobItem;
+ act.outputText(view, retrievedBlob.downloadText());
+ }
+ }
+
+ // List the blobs in a container, loop over them and
+ // output the URI of each of them
+ for (ListBlobItem blobItem : container.listBlobs()) {
+ act.outputText(view, blobItem.getUri().toString());
+ }
+
+ // Delete the blobs
+ blob1.deleteIfExists();
+ blob2.deleteIfExists();
+ blob3.deleteIfExists();
+
+ // Delete the container
+ container.deleteIfExists();
+ } catch (Throwable t) {
+ act.printException(t);
+ }
+
+ act.printSampleCompleteInfo("BlobBasics");
+
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/microsoft-azure-storage-samples/src/com/microsoft/azure/storage/samples/queue/QueueGettingStartedTask.java b/microsoft-azure-storage-samples/src/com/microsoft/azure/storage/samples/queue/QueueGettingStartedTask.java
new file mode 100644
index 0000000..e122235
--- /dev/null
+++ b/microsoft-azure-storage-samples/src/com/microsoft/azure/storage/samples/queue/QueueGettingStartedTask.java
@@ -0,0 +1,127 @@
+/**
+ * Copyright Microsoft Corporation
+ *
+ * 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.microsoft.azure.storage.samples.queue;
+
+import java.util.EnumSet;
+import java.util.UUID;
+
+import android.os.AsyncTask;
+import android.widget.TextView;
+
+import com.microsoft.azure.storage.CloudStorageAccount;
+import com.microsoft.azure.storage.queue.*;
+import com.microsoft.azure.storage.samples.MainActivity;
+
+/**
+ * This sample illustrates basic usage of the various Queue Primitives provided
+ * in the Storage Client Library including CloudQueue, CloudQueueMessage and
+ * CloudQueueClient.
+ */
+public class QueueGettingStartedTask extends AsyncTask {
+
+ private TextView view;
+ private MainActivity act;
+
+ public QueueGettingStartedTask(MainActivity act, TextView view) {
+ this.view = view;
+ this.act = act;
+ }
+
+ @Override
+ protected Void doInBackground(String... arg0) {
+
+ act.printSampleStartInfo("QueueBasics");
+
+ try {
+ // Setup the cloud storage account.
+ CloudStorageAccount account = CloudStorageAccount
+ .parse(MainActivity.storageConnectionString);
+
+ // Create a queue service client
+ CloudQueueClient queueClient = account.createCloudQueueClient();
+
+ // Retrieve a reference to a queue
+ // Append a random UUID to the end of the queue name so that this
+ // sample can be run more than once in quick succession.
+ CloudQueue queue = queueClient.getQueueReference("queuebasics"
+ + UUID.randomUUID().toString().replace("-", ""));
+
+ // Create the queue if it doesn't already exist
+ queue.createIfNotExists();
+
+ // Create messages and add it to the queue
+ CloudQueueMessage message1 = new CloudQueueMessage("Hello, World1");
+ queue.addMessage(message1);
+
+ CloudQueueMessage message2 = new CloudQueueMessage("Hello, World2");
+ queue.addMessage(message2);
+
+ CloudQueueMessage message3 = new CloudQueueMessage("Hello, World3");
+ queue.addMessage(message3);
+
+ CloudQueueMessage message4 = new CloudQueueMessage("Hello, World4");
+ queue.addMessage(message4);
+
+ CloudQueueMessage message5 = new CloudQueueMessage("Hello, World5");
+ queue.addMessage(message5);
+
+ // Peek at the next message
+ CloudQueueMessage peekedMessage = queue.peekMessage();
+ act.outputText(
+ view,
+ String.format("Peeked Message : %s",
+ peekedMessage.getMessageContentAsString()));
+
+ // Modify the message content and set it to be visible immediately
+ // Retrieve the first visible message in the queue
+ CloudQueueMessage updateMessage = queue.retrieveMessage();
+ updateMessage.setMessageContent("Updated contents.");
+ EnumSet updateFields = EnumSet
+ .of(MessageUpdateFields.CONTENT,
+ MessageUpdateFields.VISIBILITY);
+ queue.updateMessage(updateMessage, 0, updateFields, null, null);
+
+ // Retrieve 3 messages from the queue with a visibility timeout of 1
+ // second
+ queue.retrieveMessages(3, 1, null, null);
+
+ // Sleep for 2 seconds so the messages become visible and can be
+ // processed/deleted
+ Thread.sleep(2000);
+
+ // Retrieve the messages in the queue with a visibility timeout of
+ // 30 seconds and delete them
+ CloudQueueMessage retrievedMessage;
+ while ((retrievedMessage = queue.retrieveMessage(30,
+ null /* options */, null /* opContext */)) != null) {
+ // Process the message in less than 30 seconds, and then delete
+ // the message.
+ act.outputText(view,
+ retrievedMessage.getMessageContentAsString());
+ queue.deleteMessage(retrievedMessage);
+ }
+
+ // Delete a queue
+ queue.deleteIfExists();
+
+ } catch (Throwable t) {
+ act.printException(t);
+ }
+
+ act.printSampleCompleteInfo("QueueBasics");
+
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/microsoft-azure-storage-samples/src/com/microsoft/azure/storage/table/payloadformat/CustomerEntity.java b/microsoft-azure-storage-samples/src/com/microsoft/azure/storage/samples/table/CustomerEntity.java
similarity index 71%
rename from microsoft-azure-storage-samples/src/com/microsoft/azure/storage/table/payloadformat/CustomerEntity.java
rename to microsoft-azure-storage-samples/src/com/microsoft/azure/storage/samples/table/CustomerEntity.java
index 7a7e019..ddc745e 100644
--- a/microsoft-azure-storage-samples/src/com/microsoft/azure/storage/table/payloadformat/CustomerEntity.java
+++ b/microsoft-azure-storage-samples/src/com/microsoft/azure/storage/samples/table/CustomerEntity.java
@@ -12,22 +12,25 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.microsoft.azure.storage.table.payloadformat;
+package com.microsoft.azure.storage.samples.table;
import java.util.UUID;
import com.microsoft.azure.storage.table.TableServiceEntity;
public class CustomerEntity extends TableServiceEntity {
-
- // Note: An entity's partition and row key uniquely identify the entity in the table.
- // Entities with the same partition key can be queried faster than those with different partition keys.
- public CustomerEntity(String lastName, String firstName) {
+
+ // Note: An entity's partition and row key uniquely identify the entity in
+ // the table.
+ // Entities with the same partition key can be queried faster than those
+ // with different partition keys.
+ public CustomerEntity(String lastName, String firstName) {
this.partitionKey = lastName;
this.rowKey = firstName;
}
- public CustomerEntity() { }
+ public CustomerEntity() {
+ }
public String Email;
public String PhoneNumber;
@@ -48,12 +51,12 @@ public String getPhoneNumber() {
public void setPhoneNumber(String phoneNumber) {
this.PhoneNumber = phoneNumber;
}
-
- public UUID getId() {
- return this.Id;
- }
- public void setId(UUID id) {
- this.Id = id;
- }
+ public UUID getId() {
+ return this.Id;
+ }
+
+ public void setId(UUID id) {
+ this.Id = id;
+ }
}
diff --git a/microsoft-azure-storage-samples/src/com/microsoft/azure/storage/table/gettingtstarted/TableBasics.java b/microsoft-azure-storage-samples/src/com/microsoft/azure/storage/samples/table/TableGettingStartedTask.java
similarity index 69%
rename from microsoft-azure-storage-samples/src/com/microsoft/azure/storage/table/gettingtstarted/TableBasics.java
rename to microsoft-azure-storage-samples/src/com/microsoft/azure/storage/samples/table/TableGettingStartedTask.java
index b2a8347..23744b3 100644
--- a/microsoft-azure-storage-samples/src/com/microsoft/azure/storage/table/gettingtstarted/TableBasics.java
+++ b/microsoft-azure-storage-samples/src/com/microsoft/azure/storage/samples/table/TableGettingStartedTask.java
@@ -12,82 +12,88 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.microsoft.azure.storage.table.gettingtstarted;
+package com.microsoft.azure.storage.samples.table;
-import java.net.URISyntaxException;
-import java.security.InvalidKeyException;
+import java.util.UUID;
+
+import android.os.AsyncTask;
+import android.widget.TextView;
import com.microsoft.azure.storage.CloudStorageAccount;
+import com.microsoft.azure.storage.samples.MainActivity;
import com.microsoft.azure.storage.StorageException;
-import com.microsoft.azure.storage.table.CloudTable;
-import com.microsoft.azure.storage.table.CloudTableClient;
-import com.microsoft.azure.storage.table.TableBatchOperation;
-import com.microsoft.azure.storage.table.TableOperation;
-import com.microsoft.azure.storage.table.TableQuery;
+import com.microsoft.azure.storage.table.*;
import com.microsoft.azure.storage.table.TableQuery.QueryComparisons;
-import com.microsoft.azure.storage.util.Utility;
/**
* This sample illustrates basic usage of the various Table Primitives provided
* in the Storage Client Library including TableOperation, TableBatchOperation,
* and TableQuery.
*/
-public class TableBasics {
+public class TableGettingStartedTask extends AsyncTask {
+
protected static CloudTableClient tableClient;
protected static CloudTable table;
protected final static String tableName = "tablebasics";
- /**
- * Executes the sample.
- *
- * @param args
- * No input args are expected from users.
- * @throws URISyntaxException
- * @throws InvalidKeyException
- */
- public static void main(String[] args) throws InvalidKeyException, URISyntaxException {
- Utility.printSampleStartInfo("TableBasics");
+ private TextView view;
+ private MainActivity act;
- // Setup the cloud storage account.
- CloudStorageAccount account = CloudStorageAccount.parse(Utility.storageConnectionString);
+ public TableGettingStartedTask(MainActivity act, TextView view) {
+ this.view = view;
+ this.act = act;
+ }
- // Create a table service client.
- tableClient = account.createCloudTableClient();
+ @Override
+ protected Void doInBackground(String... arg0) {
+
+ act.printSampleStartInfo("TableBasics");
try {
+ // Setup the cloud storage account.
+ CloudStorageAccount account = CloudStorageAccount
+ .parse(MainActivity.storageConnectionString);
+
+ // Create a table service client.
+ tableClient = account.createCloudTableClient();
+
// Retrieve a reference to a table.
- table = tableClient.getTableReference(tableName);
+ // Append a random UUID to the end of the table name so that this
+ // sample can be run more than once in quick succession.
+ table = tableClient.getTableReference(tableName
+ + UUID.randomUUID().toString().replace("-", ""));
// Create the table if it doesn't already exist.
table.createIfNotExists();
// Illustrates how to list the tables.
- BasicListing();
+ this.BasicListing();
// Illustrates how to form and execute a single insert operation.
- BasicInsertEntity();
+ this.BasicInsertEntity();
// Illustrates how to form and execute a batch operation.
- BasicBatch();
+ this.BasicBatch();
// Illustrates how to form and execute a query operation.
- BasicQuery();
+ this.BasicQuery();
// Illustrates how to form and execute an upsert operation.
- BasicUpsert();
+ this.BasicUpsert();
// Illustrates how to form and execute an entity delete operation.
- BasicDeleteEntity();
+ this.BasicDeleteEntity();
// Delete the table.
table.deleteIfExists();
+ } catch (Throwable t) {
+ act.printException(t);
}
- catch (Throwable t) {
- Utility.printException(t);
- }
- Utility.printSampleCompleteInfo("TableBasics");
+ act.printSampleCompleteInfo("TableBasics");
+
+ return null;
}
/**
@@ -95,10 +101,11 @@ public static void main(String[] args) throws InvalidKeyException, URISyntaxExce
*
* @throws StorageException
*/
- public static void BasicInsertEntity() throws StorageException {
+ public void BasicInsertEntity() throws StorageException {
// Note: the limitations on an insert operation are
// - the serialized payload must be 1 MB or less
- // - up to 252 properties in addition to the partition key, row key and timestamp. 255 properties in total
+ // - up to 252 properties in addition to the partition key, row key and
+ // timestamp. 255 properties in total
// - the serialized payload of each property must be 64 KB or less
// Create a new customer entity.
@@ -118,7 +125,7 @@ public static void BasicInsertEntity() throws StorageException {
*
* @throws StorageException
*/
- public static void BasicBatch() throws StorageException {
+ public void BasicBatch() throws StorageException {
// Note: the limitations on a batch operation are
// - up to 100 operations
// - all operations must share the same PartitionKey
@@ -155,26 +162,35 @@ public static void BasicBatch() throws StorageException {
*
* @throws StorageException
*/
- public static void BasicQuery() throws StorageException {
+ public void BasicQuery() throws StorageException {
// Retrieve a single entity.
- // Retrieve the entity with partition key of "Smith" and row key of "Jeff".
- TableOperation retrieveSmithJeff = TableOperation.retrieve("Smith", "Jeff", CustomerEntity.class);
+ // Retrieve the entity with partition key of "Smith" and row key of
+ // "Jeff".
+ TableOperation retrieveSmithJeff = TableOperation.retrieve("Smith",
+ "Jeff", CustomerEntity.class);
- // Submit the operation to the table service and get the specific entity.
+ // Submit the operation to the table service and get the specific
+ // entity.
@SuppressWarnings("unused")
- CustomerEntity specificEntity = table.execute(retrieveSmithJeff).getResultAsType();
+ CustomerEntity specificEntity = table.execute(retrieveSmithJeff)
+ .getResultAsType();
// Retrieve all entities in a partition.
// Create a filter condition where the partition key is "Smith".
- String partitionFilter = TableQuery.generateFilterCondition("PartitionKey", QueryComparisons.EQUAL, "Smith");
+ String partitionFilter = TableQuery.generateFilterCondition(
+ "PartitionKey", QueryComparisons.EQUAL, "Smith");
// Specify a partition query, using "Smith" as the partition key filter.
- TableQuery partitionQuery = TableQuery.from(CustomerEntity.class).where(partitionFilter);
+ TableQuery partitionQuery = TableQuery.from(
+ CustomerEntity.class).where(partitionFilter);
// Loop through the results, displaying information about the entity.
for (CustomerEntity entity : table.execute(partitionQuery)) {
- System.out.println(entity.getPartitionKey() + " " + entity.getRowKey() + "\t" + entity.getEmail() + "\t"
- + entity.getPhoneNumber());
+ act.outputText(
+ view,
+ entity.getPartitionKey() + " " + entity.getRowKey() + "\t"
+ + entity.getEmail() + "\t"
+ + entity.getPhoneNumber());
}
}
@@ -183,12 +199,16 @@ public static void BasicQuery() throws StorageException {
*
* @throws StorageException
*/
- public static void BasicUpsert() throws StorageException {
- // Retrieve the entity with partition key of "Smith" and row key of "Jeff".
- TableOperation retrieveSmithJeff = TableOperation.retrieve("Smith", "Jeff", CustomerEntity.class);
+ public void BasicUpsert() throws StorageException {
+ // Retrieve the entity with partition key of "Smith" and row key of
+ // "Jeff".
+ TableOperation retrieveSmithJeff = TableOperation.retrieve("Smith",
+ "Jeff", CustomerEntity.class);
- // Submit the operation to the table service and get the specific entity.
- CustomerEntity specificEntity = table.execute(retrieveSmithJeff).getResultAsType();
+ // Submit the operation to the table service and get the specific
+ // entity.
+ CustomerEntity specificEntity = table.execute(retrieveSmithJeff)
+ .getResultAsType();
// Specify a new phone number.
specificEntity.setPhoneNumber("425-555-0105");
@@ -205,12 +225,16 @@ public static void BasicUpsert() throws StorageException {
*
* @throws StorageException
*/
- public static void BasicDeleteEntity() throws StorageException {
- // Create an operation to retrieve the entity with partition key of "Smith" and row key of "Jeff".
- TableOperation retrieveSmithJeff = TableOperation.retrieve("Smith", "Jeff", CustomerEntity.class);
+ public void BasicDeleteEntity() throws StorageException {
+ // Create an operation to retrieve the entity with partition key of
+ // "Smith" and row key of "Jeff".
+ TableOperation retrieveSmithJeff = TableOperation.retrieve("Smith",
+ "Jeff", CustomerEntity.class);
- // Retrieve the entity with partition key of "Smith" and row key of "Jeff".
- CustomerEntity entitySmithJeff = table.execute(retrieveSmithJeff).getResultAsType();
+ // Retrieve the entity with partition key of "Smith" and row key of
+ // "Jeff".
+ CustomerEntity entitySmithJeff = table.execute(retrieveSmithJeff)
+ .getResultAsType();
// Create an operation to delete the entity.
TableOperation deleteSmithJeff = TableOperation.delete(entitySmithJeff);
@@ -222,11 +246,12 @@ public static void BasicDeleteEntity() throws StorageException {
/**
* Illustrates how to list the tables.
*/
- public static void BasicListing() {
+ public void BasicListing() {
// List the tables with a given prefix.
- Iterable listTables = tableClient.listTables(tableName, null, null);
+ Iterable listTables = tableClient.listTables(tableName, null,
+ null);
for (String s : listTables) {
- System.out.println(s);
+ act.outputText(view, String.format("List of tables: %s", s));
}
}
-}
+}
\ No newline at end of file
diff --git a/microsoft-azure-storage-samples/src/com/microsoft/azure/storage/samples/table/TablePayloadFormatTask.java b/microsoft-azure-storage-samples/src/com/microsoft/azure/storage/samples/table/TablePayloadFormatTask.java
new file mode 100644
index 0000000..b9e6038
--- /dev/null
+++ b/microsoft-azure-storage-samples/src/com/microsoft/azure/storage/samples/table/TablePayloadFormatTask.java
@@ -0,0 +1,179 @@
+/**
+ * Copyright Microsoft Corporation
+ *
+ * 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.microsoft.azure.storage.samples.table;
+
+import java.util.UUID;
+
+import android.os.AsyncTask;
+import android.widget.TextView;
+
+import com.microsoft.azure.storage.CloudStorageAccount;
+import com.microsoft.azure.storage.samples.MainActivity;
+import com.microsoft.azure.storage.table.*;
+import com.microsoft.azure.storage.table.TableQuery.QueryComparisons;
+import com.microsoft.azure.storage.table.TableRequestOptions.PropertyResolver;
+
+/**
+ * This sample illustrates basic usage of the various Table Primitives provided
+ * in the Storage Client Library including TablePayloadFormat, PropertyResolver
+ * and TableRequestOptions. These are used to specify the payload format for
+ * table operations and to provide the property type information at runtime when
+ * using JsonNoMetadata.
+ */
+public class TablePayloadFormatTask extends AsyncTask {
+
+ protected static CloudTableClient tableClient;
+ protected static CloudTable table;
+ protected final static String tableName = "tablebasics";
+
+ private TextView view;
+ private MainActivity act;
+
+ public TablePayloadFormatTask(MainActivity act, TextView view) {
+ this.view = view;
+ this.act = act;
+ }
+
+ @Override
+ protected Void doInBackground(String... arg0) {
+ act.printSampleStartInfo("PayloadFormat");
+
+ try {
+ // Setup the cloud storage account.
+ CloudStorageAccount account = CloudStorageAccount
+ .parse(MainActivity.storageConnectionString);
+
+ // Create a table service client.
+ CloudTableClient tableClient = account.createCloudTableClient();
+
+ // Set the payload format on the client. For more information about
+ // the support for JSON, check the following document:
+ // http://blogs.msdn.com/b/windowsazurestorage/archive/2013/12/05/windows-azure-tables-introducing-json.aspx.
+ tableClient.getDefaultRequestOptions().setTablePayloadFormat(
+ TablePayloadFormat.JsonNoMetadata);
+
+ // Retrieve a reference to a table.
+ // Append a random UUID to the end of the table name so that this
+ // sample can be run more than once in quick succession.
+ CloudTable table = tableClient.getTableReference("tablepayloadformat"
+ + UUID.randomUUID().toString().replace("-", ""));
+
+ // Create the table if it doesn't already exist.
+ table.createIfNotExists();
+
+ // Create a new customer entity.
+ CustomerEntity customer1 = new CustomerEntity("Harp", "Walter");
+ customer1.setEmail("Walter@contoso.com");
+ customer1.setPhoneNumber("425-555-0101");
+ customer1.setId(UUID.randomUUID());
+
+ // Create an operation to add the new customer to the
+ // tablepayloadformat table.
+ TableOperation insertCustomer1 = TableOperation.insert(customer1);
+
+ // Submit the operation to the table service.
+ table.execute(insertCustomer1);
+
+ // When using JsonNoMetadata the client library will “infer” the property types(int, double,
+ // String and some booleans) by inspecting the type information on the POJO entity type
+ // provided by the client. Additionally, in some scenarios clients may wish to provide
+ // the property type information at runtime such as when querying with the DynamicTableEntity
+ // or doing complex queries that may return heterogeneous entities. To support this scenario
+ // the user should implement PropertyResolver which allows users to return an EdmType
+ // for each property based on the data received from the service.
+ class PropertyResolverClass implements PropertyResolver {
+
+ @Override
+ public EdmType propertyResolver(String pk, String rk,
+ String key, String value) {
+ if (key.equals("Email")) {
+ return EdmType.STRING;
+ } else if (key.equals("PhoneNumber")) {
+ return EdmType.STRING;
+ } else if (key.equals("Id")) {
+ return EdmType.GUID;
+ }
+ return null;
+ }
+ }
+
+ // Using the property resolver to infer property types.
+ // Create a TableRequestOptions object.
+ TableRequestOptions options = new TableRequestOptions();
+
+ // Set the propertyResolver on TableRequestOptions.
+ options.setPropertyResolver(new PropertyResolverClass());
+
+ // Retrieve all entities in a partition.
+ // Create a filter condition where the partition key is "Harp".
+ String partitionFilter = TableQuery.generateFilterCondition(
+ "PartitionKey", QueryComparisons.EQUAL, "Harp");
+
+ // Specify a partition query, using "Harp" as the partition key
+ // filter.
+ TableQuery partitionQuery = TableQuery.from(
+ DynamicTableEntity.class).where(partitionFilter);
+
+ // Loop through the results, displaying information about the entity. Note that the
+ // TableRequestOptions is passed in to the execute method in order
+ // to resolve the individual properties to their types since JsonNoMetadata is
+ // being used.
+ for (DynamicTableEntity entity : table.execute(partitionQuery,
+ options, null /* operationContext */)) {
+ act.outputText(view,
+ entity.getPartitionKey()
+ + " "
+ + entity.getRowKey()
+ + "\t"
+ + entity.getProperties().get("Email")
+ .getValueAsString()
+ + "\t"
+ + entity.getProperties().get("PhoneNumber")
+ .getValueAsString()
+ + "\t"
+ + entity.getProperties().get("Id")
+ .getValueAsUUID());
+ }
+
+ // When a POJO entity is used, it's fine to not specify a property resolver since
+ // the client library uses the class type to infer the correct property types.
+ // Specify a partition query, using "Harp" as the partition key filter.
+ TableQuery partitionQueryPOJO = TableQuery.from(
+ CustomerEntity.class).where(partitionFilter);
+
+ // Loop through the results, displaying information about the entity. Note that the
+ // TableRequestOptions is passed in to the execute method in order to resolve
+ // the individual properties to their types since JsonNoMetadata is being used.
+ for (CustomerEntity entity : table.execute(partitionQueryPOJO)) {
+ act.outputText(
+ view,
+ entity.getPartitionKey() + " " + entity.getRowKey()
+ + "\t" + entity.getEmail() + "\t"
+ + entity.getPhoneNumber() + "\t"
+ + entity.getId());
+ }
+
+ // Delete the table.
+ table.deleteIfExists();
+
+ } catch (Throwable t) {
+ act.printException(t);
+ }
+
+ act.printSampleCompleteInfo("PayloadFormat");
+
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/microsoft-azure-storage-samples/src/com/microsoft/azure/storage/table/gettingtstarted/CustomerEntity.java b/microsoft-azure-storage-samples/src/com/microsoft/azure/storage/table/gettingtstarted/CustomerEntity.java
deleted file mode 100644
index 054c518..0000000
--- a/microsoft-azure-storage-samples/src/com/microsoft/azure/storage/table/gettingtstarted/CustomerEntity.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * Copyright Microsoft Corporation
- *
- * 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.microsoft.azure.storage.table.gettingtstarted;
-
-import com.microsoft.azure.storage.table.TableServiceEntity;
-
-public class CustomerEntity extends TableServiceEntity {
-
- // Note: An entity's partition and row key uniquely identify the entity in the table.
- // Entities with the same partition key can be queried faster than those with different partition keys.
- public CustomerEntity(String lastName, String firstName) {
- this.partitionKey = lastName;
- this.rowKey = firstName;
- }
-
- public CustomerEntity() { }
-
- public String Email;
- public String PhoneNumber;
-
- public String getEmail() {
- return this.Email;
- }
-
- public void setEmail(String email) {
- this.Email = email;
- }
-
- public String getPhoneNumber() {
- return this.PhoneNumber;
- }
-
- public void setPhoneNumber(String phoneNumber) {
- this.PhoneNumber = phoneNumber;
- }
-}
diff --git a/microsoft-azure-storage-samples/src/com/microsoft/azure/storage/table/payloadformat/PayloadFormat.java b/microsoft-azure-storage-samples/src/com/microsoft/azure/storage/table/payloadformat/PayloadFormat.java
deleted file mode 100644
index e4ba4e0..0000000
--- a/microsoft-azure-storage-samples/src/com/microsoft/azure/storage/table/payloadformat/PayloadFormat.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/**
- * Copyright Microsoft Corporation
- *
- * 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.microsoft.azure.storage.table.payloadformat;
-
-import java.net.URISyntaxException;
-import java.security.InvalidKeyException;
-import java.util.UUID;
-
-import com.microsoft.azure.storage.CloudStorageAccount;
-import com.microsoft.azure.storage.table.CloudTable;
-import com.microsoft.azure.storage.table.CloudTableClient;
-import com.microsoft.azure.storage.table.DynamicTableEntity;
-import com.microsoft.azure.storage.table.EdmType;
-import com.microsoft.azure.storage.table.TableOperation;
-import com.microsoft.azure.storage.table.TablePayloadFormat;
-import com.microsoft.azure.storage.table.TableQuery;
-import com.microsoft.azure.storage.table.TableRequestOptions;
-import com.microsoft.azure.storage.table.TableQuery.QueryComparisons;
-import com.microsoft.azure.storage.table.TableRequestOptions.PropertyResolver;
-import com.microsoft.azure.storage.table.payloadformat.CustomerEntity;
-import com.microsoft.azure.storage.util.Utility;
-
-/**
- * This sample illustrates basic usage of the various Table Primitives provided
- * in the Storage Client Library including TablePayloadFormat, PropertyResolver
- * and TableRequestOptions. These are used to specify the payload format for
- * table operations and to provide the property type information at runtime when using
- * JsonNoMetadata.
- */
-public class PayloadFormat {
-
- /**
- * Executes the sample.
- *
- * @param args
- * No input args are expected from users.
- * @throws URISyntaxException
- * @throws InvalidKeyException
- */
- public static void main(String[] args) throws InvalidKeyException, URISyntaxException {
- Utility.printSampleStartInfo("PayloadFormat");
-
- // Setup the cloud storage account.
- CloudStorageAccount account = CloudStorageAccount.parse(Utility.storageConnectionString);
-
- // Create a table service client.
- CloudTableClient tableClient = account.createCloudTableClient();
-
- // Set the payload format on the client. For more information about the support for JSON,
- // check the following document: http://blogs.msdn.com/b/windowsazurestorage/archive/2013/12/05/windows-azure-tables-introducing-json.aspx.
- tableClient.getDefaultRequestOptions().setTablePayloadFormat(TablePayloadFormat.JsonNoMetadata);
-
- try {
- // Retrieve a reference to a table.
- CloudTable table = tableClient.getTableReference("tablepayloadformat");
-
- // Create the table if it doesn't already exist.
- table.createIfNotExists();
-
- // Create a new customer entity.
- CustomerEntity customer1 = new CustomerEntity("Harp", "Walter");
- customer1.setEmail("Walter@contoso.com");
- customer1.setPhoneNumber("425-555-0101");
- customer1.setId(UUID.randomUUID());
-
- // Create an operation to add the new customer to the tablepayloadformat table.
- TableOperation insertCustomer1 = TableOperation.insert(customer1);
-
- // Submit the operation to the table service.
- table.execute(insertCustomer1);
-
- // When using JsonNoMetadata the client library will “infer” the property types(int, double,
- // String and some booleans) by inspecting the type information on the POJO entity type
- // provided by the client. Additionally, in some scenarios clients may wish to provide
- // the property type information at runtime such as when querying with the DynamicTableEntity
- // or doing complex queries that may return heterogeneous entities. To support this scenario
- // the user should implement PropertyResolver which allows users to return an EdmType
- // for each property based on the data received from the service.
- class PropertyResolverClass implements PropertyResolver {
-
- @Override
- public EdmType propertyResolver(String pk, String rk, String key,
- String value) {
- if (key.equals("Email")) {
- return EdmType.STRING;
- }
- else if (key.equals("PhoneNumber")) {
- return EdmType.STRING;
- }
- else if (key.equals("Id")) {
- return EdmType.GUID;
- }
- return null;
- }
- }
-
- // Using the property resolver to infer property types.
- // Create a TableRequestOptions object.
- TableRequestOptions options = new TableRequestOptions();
-
- // Set the propertyResolver on TableRequestOptions.
- options.setPropertyResolver(new PropertyResolverClass());
-
- // Retrieve all entities in a partition.
- // Create a filter condition where the partition key is "Harp".
- String partitionFilter = TableQuery.generateFilterCondition(
- "PartitionKey",
- QueryComparisons.EQUAL,
- "Harp");
-
- // Specify a partition query, using "Harp" as the partition key filter.
- TableQuery partitionQuery =
- TableQuery.from(DynamicTableEntity.class)
- .where(partitionFilter);
-
- // Loop through the results, displaying information about the entity. Note that the
- // TableRequestOptions is passed in to the execute method in order to resolve
- // the individual properties to their types since JsonNoMetadata is being used.
- for (DynamicTableEntity entity : table.execute(partitionQuery, options, null /*operationContext*/)) {
- System.out.println(entity.getPartitionKey() + " " + entity.getRowKey() +
- "\t" + entity.getProperties().get("Email").getValueAsString() + "\t" + entity.getProperties().get("PhoneNumber").getValueAsString() + "\t" + entity.getProperties().get("Id").getValueAsUUID());
- }
-
- // When a POJO entity is used, it's fine to not specify a property resolver since
- // the client library uses the class type to infer the correct property types.
- // Specify a partition query, using "Harp" as the partition key filter.
- TableQuery partitionQueryPOJO =
- TableQuery.from(CustomerEntity.class)
- .where(partitionFilter);
-
- // Loop through the results, displaying information about the entity. Note that the
- // TableRequestOptions is passed in to the execute method in order to resolve
- // the individual properties to their types since JsonNoMetadata is being used.
- for (CustomerEntity entity : table.execute(partitionQueryPOJO)) {
- System.out.println(entity.getPartitionKey() + " " + entity.getRowKey() +
- "\t" + entity.getEmail() + "\t" + entity.getPhoneNumber() + "\t" + entity.getId());
- }
-
- // Delete the table.
- table.deleteIfExists();
-
- } catch (Throwable t) {
- Utility.printException(t);
- }
-
- Utility.printSampleCompleteInfo("PayloadFormat");
- }
-}
diff --git a/microsoft-azure-storage-samples/src/com/microsoft/azure/storage/util/Utility.java b/microsoft-azure-storage-samples/src/com/microsoft/azure/storage/util/Utility.java
deleted file mode 100644
index 4958ac8..0000000
--- a/microsoft-azure-storage-samples/src/com/microsoft/azure/storage/util/Utility.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * Copyright Microsoft Corporation
- *
- * 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.microsoft.azure.storage.util;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-
-/**
- * A class which provides utility methods
- *
- */
-public final class Utility {
- static {
- // Uncomment the following to use Fiddler
- // System.setProperty("http.proxyHost", "localhost");
- // System.setProperty("http.proxyPort", "8888");
- }
-
- /**
- * Stores the storage connection strings.
- *
- */
- public static final String storageConnectionString = "DefaultEndpointsProtocol=http;AccountName=myaccountname;AccountKey=myaccountkey";
-
- /**
- * Prints out the exception information .
- */
- public static void printException(Throwable t) {
- StringWriter stringWriter = new StringWriter();
- PrintWriter printWriter = new PrintWriter(stringWriter);
- t.printStackTrace(printWriter);
- System.out.println(String.format("Got an exception from running samples. Exception details:\n%s\n",
- stringWriter.toString()));
- }
-
- /**
- * Prints out the sample start information .
- */
- public static void printSampleStartInfo(String sampleName) {
- System.out.println(String.format("The Azure storage client library sample %s starting...", sampleName));
- }
-
- /**
- * Prints out the sample complete information .
- */
- public static void printSampleCompleteInfo(String sampleName) {
- System.out.println(String.format("The Azure storage client library sample %s completed.", sampleName));
- }
-}
diff --git a/microsoft-azure-storage-test/AndroidManifest.xml b/microsoft-azure-storage-test/AndroidManifest.xml
index 88decf6..5280dd5 100644
--- a/microsoft-azure-storage-test/AndroidManifest.xml
+++ b/microsoft-azure-storage-test/AndroidManifest.xml
@@ -11,11 +11,11 @@
+ android:versionName="0.4.1" >
+ android:targetSdkVersion="21" />
diff --git a/microsoft-azure-storage/AndroidManifest.xml b/microsoft-azure-storage/AndroidManifest.xml
index 2249728..24689fd 100644
--- a/microsoft-azure-storage/AndroidManifest.xml
+++ b/microsoft-azure-storage/AndroidManifest.xml
@@ -11,10 +11,10 @@
+ android:versionName="0.4.1" >
+ android:targetSdkVersion="21" />
diff --git a/microsoft-azure-storage/build.gradle b/microsoft-azure-storage/build.gradle
index a13fde4..ef37b30 100644
--- a/microsoft-azure-storage/build.gradle
+++ b/microsoft-azure-storage/build.gradle
@@ -33,8 +33,8 @@ apply plugin: 'android-library'
}
android {
- compileSdkVersion 18
- buildToolsVersion "19.0.0"
+ compileSdkVersion 19
+ buildToolsVersion "21.0.0"
defaultConfig {
packageName "microsoft.azure.storage.android.sdk"
diff --git a/microsoft-azure-storage/pom.xml b/microsoft-azure-storage/pom.xml
index c05f61e..c7a1cf8 100644
--- a/microsoft-azure-storage/pom.xml
+++ b/microsoft-azure-storage/pom.xml
@@ -10,7 +10,7 @@
4.0.0com.microsoft.azure.androidazure-storage-android
- 0.4.0
+ 0.4.1aarMicrosoft Azure Storage Android Client SDK
@@ -71,7 +71,7 @@
truetrue
- 18
+ 19
diff --git a/microsoft-azure-storage/src/com/microsoft/azure/storage/Constants.java b/microsoft-azure-storage/src/com/microsoft/azure/storage/Constants.java
index 26a2577..7c47a85 100644
--- a/microsoft-azure-storage/src/com/microsoft/azure/storage/Constants.java
+++ b/microsoft-azure-storage/src/com/microsoft/azure/storage/Constants.java
@@ -515,7 +515,7 @@ public static class HeaderConstants {
/**
* Specifies the value to use for UserAgent header.
*/
- public static final String USER_AGENT_VERSION = "0.4.0";
+ public static final String USER_AGENT_VERSION = "0.4.1";
/**
* The default type for content-type and accept
diff --git a/microsoft-azure-storage/src/com/microsoft/azure/storage/blob/CloudBlob.java b/microsoft-azure-storage/src/com/microsoft/azure/storage/blob/CloudBlob.java
index 79755cd..6e7dced 100644
--- a/microsoft-azure-storage/src/com/microsoft/azure/storage/blob/CloudBlob.java
+++ b/microsoft-azure-storage/src/com/microsoft/azure/storage/blob/CloudBlob.java
@@ -1092,7 +1092,7 @@ public HttpURLConnection buildRequest(CloudBlobClient client, CloudBlob blob, Op
@Override
public void signRequest(HttpURLConnection connection, CloudBlobClient client, OperationContext context)
throws Exception {
- StorageRequest.signBlobQueueAndFileRequest(connection, client, -1L, null);
+ StorageRequest.signBlobQueueAndFileRequest(connection, client, 0L, null);
}
@Override
diff --git a/microsoft-azure-storage/src/com/microsoft/azure/storage/blob/CloudBlobContainer.java b/microsoft-azure-storage/src/com/microsoft/azure/storage/blob/CloudBlobContainer.java
index 1952bf6..b7953be 100644
--- a/microsoft-azure-storage/src/com/microsoft/azure/storage/blob/CloudBlobContainer.java
+++ b/microsoft-azure-storage/src/com/microsoft/azure/storage/blob/CloudBlobContainer.java
@@ -432,7 +432,7 @@ public HttpURLConnection buildRequest(CloudBlobClient client, CloudBlobContainer
@Override
public void signRequest(HttpURLConnection connection, CloudBlobClient client, OperationContext context)
throws Exception {
- StorageRequest.signBlobQueueAndFileRequest(connection, client, -1L, null);
+ StorageRequest.signBlobQueueAndFileRequest(connection, client, 0L, null);
}
@Override
diff --git a/microsoft-azure-storage/src/com/microsoft/azure/storage/core/BaseRequest.java b/microsoft-azure-storage/src/com/microsoft/azure/storage/core/BaseRequest.java
index a72e7cc..919cdeb 100644
--- a/microsoft-azure-storage/src/com/microsoft/azure/storage/core/BaseRequest.java
+++ b/microsoft-azure-storage/src/com/microsoft/azure/storage/core/BaseRequest.java
@@ -235,6 +235,9 @@ public static HttpURLConnection delete(final URI uri, final RequestOptions optio
final HttpURLConnection retConnection = createURLConnection(uri, options, builder, opContext);
retConnection.setRequestMethod(Constants.HTTP_DELETE);
+
+ // Note: by default sends Content-Length 0; we must explicitly add this to prevent auth mismatches
+ retConnection.setRequestProperty(Constants.HeaderConstants.CONTENT_LENGTH, "0");
return retConnection;
}
diff --git a/microsoft-azure-storage/src/com/microsoft/azure/storage/file/CloudFile.java b/microsoft-azure-storage/src/com/microsoft/azure/storage/file/CloudFile.java
index 2297c38..89125b6 100644
--- a/microsoft-azure-storage/src/com/microsoft/azure/storage/file/CloudFile.java
+++ b/microsoft-azure-storage/src/com/microsoft/azure/storage/file/CloudFile.java
@@ -476,7 +476,7 @@ public HttpURLConnection buildRequest(CloudFileClient client, CloudFile file, Op
@Override
public void signRequest(HttpURLConnection connection, CloudFileClient client, OperationContext context)
throws Exception {
- StorageRequest.signBlobQueueAndFileRequest(connection, client, -1L, null);
+ StorageRequest.signBlobQueueAndFileRequest(connection, client, 0L, null);
}
@Override
diff --git a/microsoft-azure-storage/src/com/microsoft/azure/storage/file/CloudFileDirectory.java b/microsoft-azure-storage/src/com/microsoft/azure/storage/file/CloudFileDirectory.java
index c11afcf..c97423a 100644
--- a/microsoft-azure-storage/src/com/microsoft/azure/storage/file/CloudFileDirectory.java
+++ b/microsoft-azure-storage/src/com/microsoft/azure/storage/file/CloudFileDirectory.java
@@ -329,7 +329,7 @@ public HttpURLConnection buildRequest(CloudFileClient client, CloudFileDirectory
@Override
public void signRequest(HttpURLConnection connection, CloudFileClient client, OperationContext context)
throws Exception {
- StorageRequest.signBlobQueueAndFileRequest(connection, client, -1L, null);
+ StorageRequest.signBlobQueueAndFileRequest(connection, client, 0L, null);
}
@Override
diff --git a/microsoft-azure-storage/src/com/microsoft/azure/storage/file/CloudFileShare.java b/microsoft-azure-storage/src/com/microsoft/azure/storage/file/CloudFileShare.java
index 017945c..6fa2fe5 100644
--- a/microsoft-azure-storage/src/com/microsoft/azure/storage/file/CloudFileShare.java
+++ b/microsoft-azure-storage/src/com/microsoft/azure/storage/file/CloudFileShare.java
@@ -350,7 +350,7 @@ public HttpURLConnection buildRequest(CloudFileClient client, CloudFileShare sha
@Override
public void signRequest(HttpURLConnection connection, CloudFileClient client, OperationContext context)
throws Exception {
- StorageRequest.signBlobQueueAndFileRequest(connection, client, -1L, null);
+ StorageRequest.signBlobQueueAndFileRequest(connection, client, 0L, null);
}
@Override
diff --git a/microsoft-azure-storage/src/com/microsoft/azure/storage/queue/CloudQueue.java b/microsoft-azure-storage/src/com/microsoft/azure/storage/queue/CloudQueue.java
index 5d6eb2c..6ef39f7 100644
--- a/microsoft-azure-storage/src/com/microsoft/azure/storage/queue/CloudQueue.java
+++ b/microsoft-azure-storage/src/com/microsoft/azure/storage/queue/CloudQueue.java
@@ -393,7 +393,7 @@ public HttpURLConnection buildRequest(CloudQueueClient client, CloudQueue queue,
@Override
public void signRequest(HttpURLConnection connection, CloudQueueClient client, OperationContext context)
throws Exception {
- StorageRequest.signBlobQueueAndFileRequest(connection, client, -1L, null);
+ StorageRequest.signBlobQueueAndFileRequest(connection, client, 0L, null);
}
@Override
@@ -597,7 +597,7 @@ public HttpURLConnection buildRequest(CloudQueueClient client, CloudQueue queue,
@Override
public void signRequest(HttpURLConnection connection, CloudQueueClient client, OperationContext context)
throws Exception {
- StorageRequest.signBlobQueueAndFileRequest(connection, client, -1L, null);
+ StorageRequest.signBlobQueueAndFileRequest(connection, client, 0L, null);
}
@Override
@@ -742,7 +742,7 @@ public HttpURLConnection buildRequest(CloudQueueClient client, CloudQueue queue,
@Override
public void signRequest(HttpURLConnection connection, CloudQueueClient client, OperationContext context)
throws Exception {
- StorageRequest.signBlobQueueAndFileRequest(connection, client, -1L, null);
+ StorageRequest.signBlobQueueAndFileRequest(connection, client, 0L, null);
}
@Override
diff --git a/microsoft-azure-storage/src/com/microsoft/azure/storage/queue/QueueRequest.java b/microsoft-azure-storage/src/com/microsoft/azure/storage/queue/QueueRequest.java
index 622c168..3ab367e 100644
--- a/microsoft-azure-storage/src/com/microsoft/azure/storage/queue/QueueRequest.java
+++ b/microsoft-azure-storage/src/com/microsoft/azure/storage/queue/QueueRequest.java
@@ -96,12 +96,7 @@ public static void addMetadata(final HttpURLConnection request, final HashMap