Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure SDK for Java 0.2 release #21

Merged
merged 10 commits into from
Feb 29, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
2012.01.31. Version 0.1.3
2012.02.28 Version 0.2.0
* Added Support for Azure Table in com.microsoft.windowsazure.services.table
* Added Client Tests for Table
* Added a dependency on apache commons-lang3 3.1
* ResultsSegment exposes an ArrayList instead of an Iterable
* UserAgent updated to v1.1.2

2012.01.31 Version 0.1.3
* Updated User Agent to v0.1.1
* Updated License Headers
* Blob Client Mark bug fix
Expand All @@ -8,7 +15,7 @@
* Date parsing support for various number of fractional decimals
* StorageErrorResponse updated to support lower case xml for tables

2011.12.22. Version 0.1.2
2011.12.22 Version 0.1.2
* Fixed CloudBlob.download to lock to ETag during a resume
* Ensured that Client Side Exceptions are not resumed

Expand Down
13 changes: 12 additions & 1 deletion microsoft-azure-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.microsoft.windowsazure</groupId>
<artifactId>microsoft-windowsazure-api</artifactId>
<version>0.1.3</version>
<version>0.2.0</version>
<packaging>jar</packaging>

<name>Microsoft Windows Azure Client API</name>
Expand Down Expand Up @@ -80,6 +80,16 @@
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.1</version>
</dependency>
</dependencies>

<build>
Expand All @@ -104,6 +114,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ private Map<String, Role> translateRoles(RoleEnvironmentInfo environmentInfo, Ro
for (RoleInfo roleInfo : environmentInfo.getRoles().getRole()) {
Map<String, RoleInstance> instances = translateRoleInstances(roleInfo.getInstances());

if (roleInfo.getName() == currentRole) {
if (roleInfo.getName().equals(currentRole)) {
instances.put(currentInstance.getId(), currentInstance);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ public static AccessCondition generateEmptyCondition() {
* Returns an access condition such that an operation will be performed only if the resource's ETag value matches
* the specified ETag value.
* <p>
* Setting this access condition modifies the request to include the HTTP <i>If-Match</i> conditional header. If
* this access condition is set, the operation is performed only if the ETag of the resource matches the specified
* ETag.
* Setting this access condition modifies the request to include the HTTP <i>If-Match</i> conditional header. If this
* access condition is set, the operation is performed only if the ETag of the resource matches the specified ETag.
* <p>
* For more information, see <a href= 'http://go.microsoft.com/fwlink/?LinkID=224642&clcid=0x409'>Specifying
* Conditional Headers for Blob Service Operations</a>.
Expand Down Expand Up @@ -84,8 +83,8 @@ public static AccessCondition generateIfModifiedSinceCondition(final Date lastMo
* Returns an access condition such that an operation will be performed only if the resource's ETag value does not
* match the specified ETag value.
* <p>
* Setting this access condition modifies the request to include the HTTP <i>If-None-Match</i> conditional header.
* If this access condition is set, the operation is performed only if the ETag of the resource does not match the
* Setting this access condition modifies the request to include the HTTP <i>If-None-Match</i> conditional header. If
* this access condition is set, the operation is performed only if the ETag of the resource does not match the
* specified ETag.
* <p>
* For more information, see <a href= 'http://go.microsoft.com/fwlink/?LinkID=224642&clcid=0x409'>Specifying
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.microsoft.windowsazure.services.blob.client.CloudBlobClient;
import com.microsoft.windowsazure.services.core.storage.utils.Utility;
import com.microsoft.windowsazure.services.queue.client.CloudQueueClient;
import com.microsoft.windowsazure.services.table.client.CloudTableClient;

/**
* Represents a Windows Azure storage account.
Expand Down Expand Up @@ -538,6 +539,26 @@ public CloudQueueClient createCloudQueueClient() {
return new CloudQueueClient(this.getQueueEndpoint(), this.getCredentials());
}

/**
* Creates a new table service client.
*
* @return A client object that uses the Table service endpoint.
*/
public CloudTableClient createCloudTableClient() {
if (this.getTableEndpoint() == null) {
throw new IllegalArgumentException("No table endpoint configured.");
}

if (this.credentials == null) {
throw new IllegalArgumentException("No credentials provided.");
}

if (!this.credentials.canCredentialsSignRequest()) {
throw new IllegalArgumentException("CloudTableClient requires a credential that can sign request");
}
return new CloudTableClient(this.getTableEndpoint(), this.getCredentials());
}

/**
* Returns the endpoint for the Blob service, as configured for the storage account. This method is not supported
* when using shared access signature credentials.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ public static class HeaderConstants {
/**
* Specifies the value to use for UserAgent header.
*/
public static final String USER_AGENT_VERSION = "Client v0.1.1";
public static final String USER_AGENT_VERSION = "Client v0.1.2";
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ public class ResultSegment<T> {
private final int pageSize;

/**
* Holds the Iterable collection of results.
* Holds the ArrayList of results.
*/
private final Iterable<T> results;
private final ArrayList<T> results;

/**
* Reserved for internal use. Creates an instance of the <code>ResultSegment</code> class.
Expand Down Expand Up @@ -115,11 +115,11 @@ public int getRemainingPageResults() {
}

/**
* Returns an enumerable set of results from the blob service.
* Returns an enumerable set of results from the service.
*
* @return The results retrieved from the blob service.
* @return The results retrieved from the service.
*/
public Iterable<T> getResults() {
public ArrayList<T> getResults() {
return this.results;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -242,13 +242,13 @@ public void setRetryPolicyFactory(final RetryPolicyFactory retryPolicyFactory) {
/**
* Sets the timeout to use when making requests to the storage service.
* <p>
* The server timeout interval begins at the time that the complete request has been received by the service, and
* the server begins processing the response. If the timeout interval elapses before the response is returned to the
* The server timeout interval begins at the time that the complete request has been received by the service, and the
* server begins processing the response. If the timeout interval elapses before the response is returned to the
* client, the operation times out. The timeout interval resets with each retry, if the request is retried.
*
* The default timeout interval for a request made via the service client is 90 seconds. You can change this value
* on the service client by setting this property, so that all subsequent requests made via the service client will
* use the new timeout interval. You can also change this value for an individual request, by setting the
* The default timeout interval for a request made via the service client is 90 seconds. You can change this value on
* the service client by setting this property, so that all subsequent requests made via the service client will use
* the new timeout interval. You can also change this value for an individual request, by setting the
* {@link RequestOptions#timeoutIntervalInMs} property.
*
* If you are downloading a large blob, you should increase the value of the timeout beyond the default value.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public abstract class StorageCredentials {
* Either include an account name with an account key (specifying values for
* {@link CloudStorageAccount#ACCOUNT_NAME_NAME} and {@link CloudStorageAccount#ACCOUNT_KEY_NAME} ), or a
* shared access signature (specifying a value for
* {@link CloudStorageAccount#SHARED_ACCESS_SIGNATURE_NAME} ). If you use an account name and account
* key, do not include a shared access signature, and vice versa.
* {@link CloudStorageAccount#SHARED_ACCESS_SIGNATURE_NAME} ). If you use an account name and account key,
* do not include a shared access signature, and vice versa.
*
* @return A {@link StorageCredentials} object representing the storage credentials determined from the name/value
* pairs.
Expand Down Expand Up @@ -81,8 +81,8 @@ protected static StorageCredentials tryParseCredentials(final HashMap<String, St
* @param connectionString
* A <code>String</code> that contains the key/value pairs that represent the storage credentials.
* <p>
* The format for the connection string is in the pattern "<i>keyname=value</i>". Multiple key/value
* pairs can be separated by a semi-colon, for example, "<i>keyname1=value1;keyname2=value2</i>".
* The format for the connection string is in the pattern "<i>keyname=value</i>". Multiple key/value pairs
* can be separated by a semi-colon, for example, "<i>keyname1=value1;keyname2=value2</i>".
*
* @return A {@link StorageCredentials} object representing the storage credentials determined from the connection
* string.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ public String computeHmac256(final String value) {

/**
* Computes a signature for the specified string using the HMAC-SHA256 algorithm with the specified operation
* context. This is not a valid operation for objects of type <code>StorageCredentialsSharedAccessSignature</code>
* so the method merely returns <code>null</code>.
* context. This is not a valid operation for objects of type <code>StorageCredentialsSharedAccessSignature</code> so
* the method merely returns <code>null</code>.
*
* @param value
* The UTF-8-encoded string to sign.
Expand Down Expand Up @@ -130,8 +130,8 @@ public String computeHmac512(final String value) {

/**
* Computes a signature for the specified string using the HMAC-SHA512 algorithm with the specified operation
* context. This is not a valid operation for objects of type <code>StorageCredentialsSharedAccessSignature</code>
* so the method merely returns <code>null</code>.
* context. This is not a valid operation for objects of type <code>StorageCredentialsSharedAccessSignature</code> so
* the method merely returns <code>null</code>.
*
* @param value
* The UTF-8-encoded string to sign.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,11 @@ public final class StorageErrorCodeStrings {
*/
public static final String SERVER_BUSY = "ServerBusy";

/**
* Table Already Exists
*/
public static final String TABLE_ALREADY_EXISTS = "TableAlreadyExists";

/**
* One or more header values are not supported.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.microsoft.windowsazure.services.core.storage.utils.implementation;

import java.io.IOException;
Expand All @@ -34,6 +35,7 @@
import com.microsoft.windowsazure.services.core.storage.RetryResult;
import com.microsoft.windowsazure.services.core.storage.StorageErrorCodeStrings;
import com.microsoft.windowsazure.services.core.storage.StorageException;
import com.microsoft.windowsazure.services.table.client.TableServiceException;

/**
* RESERVED FOR INTERNAL USE. A class that handles execution of StorageOperations and enforces retry policies.
Expand Down Expand Up @@ -166,6 +168,17 @@ public static <CLIENT_TYPE, PARENT_TYPE, RESULT_TYPE> RESULT_TYPE executeWithRet
setLastException(opContext, translatedException);
throw translatedException;
}
catch (final TableServiceException e) {
task.getResult().setStatusCode(e.getHttpStatusCode());
task.getResult().setStatusMessage(e.getMessage());
setLastException(opContext, e);
if (!e.isRetryable()) {
throw e;
}
else {
translatedException = e;
}
}
catch (final StorageException e) {
// Non Retryable, just throw
// do not translate StorageException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.microsoft.windowsazure.services.core.storage.utils.implementation;

import java.io.InputStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public QueueContract withFilter(ServiceFilter filter) {

private ServiceException processCatch(ServiceException e) {
log.warn(e.getMessage(), e.getCause());
return ServiceExceptionFactory.process("blob", e);
return ServiceExceptionFactory.process("queue", e);
}

public GetServicePropertiesResult getServiceProperties() throws ServiceException {
Expand Down
Loading