Permalink
Browse files

update on the action DCR.

  • Loading branch information...
1 parent 476b705 commit 520185b5f68fb74916b9c7bd74e206f00b148c31 Albert Cheng committed Jan 9, 2013
View
26 ...microsoft/windowsazure/services/media/implementation/entities/DefaultActionOperation.java
@@ -27,6 +27,8 @@
* Generic implementation of Delete operation usable by most entities.
*/
public class DefaultActionOperation implements EntityActionOperation {
+
+ /** The proxy data. */
private EntityProxyData proxyData;
/** The name. */
@@ -62,9 +64,13 @@ public DefaultActionOperation() {
/* (non-Javadoc)
* @see com.microsoft.windowsazure.services.media.implementation.entities.EntityOperation#setProxyData(com.microsoft.windowsazure.services.media.implementation.entities.EntityProxyData)
*/
+ @Override
+ public void setProxyData(EntityProxyData proxyData) {
+ this.proxyData = proxyData;
+ }
/**
- * Get the current proxy data
+ * Get the current proxy data.
*
* @return the proxy data
*/
@@ -139,15 +145,6 @@ public DefaultActionOperation setAcceptType(MediaType acceptType) {
}
/* (non-Javadoc)
- * @see com.microsoft.windowsazure.services.media.implementation.entities.EntityActionOperation#processResponse(com.sun.jersey.api.client.ClientResponse)
- */
- @Override
- public Object processResponse(ClientResponse clientResponse) {
- PipelineHelpers.ThrowIfNotSuccess(clientResponse);
- return clientResponse;
- }
-
- /* (non-Javadoc)
* @see com.microsoft.windowsazure.services.media.implementation.entities.EntityActionOperation#getVerb()
*/
@Override
@@ -163,13 +160,12 @@ public Object getRequestContents() {
return null;
}
- @Override
- public void setProxyData(EntityProxyData proxyData) {
- this.proxyData = proxyData;
- }
-
+ /* (non-Javadoc)
+ * @see com.microsoft.windowsazure.services.media.implementation.entities.EntityOperation#processResponse(java.lang.Object)
+ */
@Override
public Object processResponse(Object rawResponse) throws ServiceException {
+ PipelineHelpers.ThrowIfNotSuccess((ClientResponse) rawResponse);
return rawResponse;
}
View
70 ...osoft/windowsazure/services/media/implementation/entities/DefaultTypeActionOperation.java
@@ -7,8 +7,15 @@
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.core.util.MultivaluedMapImpl;
+/**
+ * The Class DefaultTypeActionOperation.
+ *
+ * @param <T>
+ * the generic type
+ */
public class DefaultTypeActionOperation<T> implements EntityTypeActionOperation<T> {
+ /** The name. */
private String name;
/** The content type. */
@@ -17,83 +24,138 @@
/** The accept type. */
private MediaType acceptType = MediaType.APPLICATION_ATOM_XML_TYPE;
+ /** The query parameters. */
private MultivaluedMapImpl queryParameters;
+ /** The proxy data. */
private EntityProxyData proxyData;
+ /**
+ * Instantiates a new default type action operation.
+ *
+ * @param name
+ * the name
+ */
public DefaultTypeActionOperation(String name) {
this();
this.name = name;
}
+ /**
+ * Instantiates a new default type action operation.
+ */
public DefaultTypeActionOperation() {
this.queryParameters = new MultivaluedMapImpl();
}
+ /* (non-Javadoc)
+ * @see com.microsoft.windowsazure.services.media.implementation.entities.EntityTypeActionOperation#processTypeResponse(com.sun.jersey.api.client.ClientResponse)
+ */
@Override
public T processTypeResponse(ClientResponse clientResponse) {
return null;
}
+ /* (non-Javadoc)
+ * @see com.microsoft.windowsazure.services.media.implementation.entities.EntityTypeActionOperation#getQueryParameters()
+ */
@Override
public MultivaluedMap<String, String> getQueryParameters() {
return this.queryParameters;
}
+ /* (non-Javadoc)
+ * @see com.microsoft.windowsazure.services.media.implementation.entities.EntityTypeActionOperation#getVerb()
+ */
@Override
public String getVerb() {
return "GET";
}
+ /* (non-Javadoc)
+ * @see com.microsoft.windowsazure.services.media.implementation.entities.EntityTypeActionOperation#getRequestContents()
+ */
@Override
public Object getRequestContents() {
return null;
}
+ /* (non-Javadoc)
+ * @see com.microsoft.windowsazure.services.media.implementation.entities.EntityOperation#setProxyData(com.microsoft.windowsazure.services.media.implementation.entities.EntityProxyData)
+ */
@Override
public void setProxyData(EntityProxyData proxyData) {
this.proxyData = proxyData;
}
+ /* (non-Javadoc)
+ * @see com.microsoft.windowsazure.services.media.implementation.entities.EntityOperation#getUri()
+ */
@Override
public String getUri() {
return this.name;
}
+ /* (non-Javadoc)
+ * @see com.microsoft.windowsazure.services.media.implementation.entities.EntityOperation#getContentType()
+ */
@Override
public MediaType getContentType() {
return this.contentType;
}
+ /* (non-Javadoc)
+ * @see com.microsoft.windowsazure.services.media.implementation.entities.EntityOperation#getAcceptType()
+ */
@Override
public MediaType getAcceptType() {
return this.acceptType;
}
+ /* (non-Javadoc)
+ * @see com.microsoft.windowsazure.services.media.implementation.entities.EntityOperation#processResponse(java.lang.Object)
+ */
@Override
public Object processResponse(Object rawResponse) throws ServiceException {
return null;
}
+ /* (non-Javadoc)
+ * @see com.microsoft.windowsazure.services.media.implementation.entities.EntityTypeActionOperation#addQueryParameter(java.lang.String, java.lang.String)
+ */
@Override
public DefaultTypeActionOperation<T> addQueryParameter(String key, String value) {
this.queryParameters.add(key, value);
return this;
}
- @Override
- public void processResponse(ClientResponse clientResponse) {
- }
-
+ /* (non-Javadoc)
+ * @see com.microsoft.windowsazure.services.media.implementation.entities.EntityTypeActionOperation#setContentType(javax.ws.rs.core.MediaType)
+ */
@Override
public EntityTypeActionOperation<T> setContentType(MediaType contentType) {
this.contentType = contentType;
return this;
}
+ /**
+ * Sets the accept type.
+ *
+ * @param acceptType
+ * the accept type
+ * @return the entity type action operation
+ */
public EntityTypeActionOperation<T> setAcceptType(MediaType acceptType) {
this.acceptType = acceptType;
return this;
}
+ /* (non-Javadoc)
+ * @see com.microsoft.windowsazure.services.media.implementation.entities.EntityTypeActionOperation#processResponse(com.sun.jersey.api.client.ClientResponse)
+ */
+ @Override
+ public Object processResponse(ClientResponse clientResponse) {
+ return null;
+ }
+
}
View
11 .../microsoft/windowsazure/services/media/implementation/entities/EntityActionOperation.java
@@ -18,8 +18,6 @@
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
-import com.sun.jersey.api.client.ClientResponse;
-
/**
* Action operation for Entities.
*/
@@ -44,15 +42,6 @@
EntityActionOperation addQueryParameter(String key, String value);
/**
- * Process response.
- *
- * @param clientResponse
- * the client response
- * @return the object
- */
- Object processResponse(ClientResponse clientResponse);
-
- /**
* Gets the verb.
*
* @return the verb
View
11 ...om/microsoft/windowsazure/services/media/implementation/entities/EntityLinkOperation.java
@@ -31,10 +31,8 @@
import org.w3c.dom.Document;
-import com.microsoft.windowsazure.services.core.utils.pipeline.PipelineHelpers;
import com.microsoft.windowsazure.services.media.implementation.content.Constants;
import com.microsoft.windowsazure.services.media.implementation.content.MediaUriType;
-import com.sun.jersey.api.client.ClientResponse;
/**
* Generic implementation of $link operation of two entities.
@@ -130,15 +128,6 @@ public String getVerb() {
}
/* (non-Javadoc)
- * @see com.microsoft.windowsazure.services.media.implementation.entities.EntityActionOperation#processResponse(com.sun.jersey.api.client.ClientResponse)
- */
- @Override
- public Object processResponse(ClientResponse clientResponse) {
- PipelineHelpers.ThrowIfNotSuccess(clientResponse);
- return null;
- }
-
- /* (non-Javadoc)
* @see com.microsoft.windowsazure.services.media.implementation.entities.DefaultActionOperation#getRequestContents()
*/
@Override
View
2 ...va/com/microsoft/windowsazure/services/media/implementation/entities/EntityRestProxy.java
@@ -173,7 +173,7 @@ public void delete(EntityDeleteOperation deleter) throws ServiceException {
.accept(entityTypeActionOperation.getAcceptType()).accept(MediaType.APPLICATION_XML_TYPE)
.entity(entityTypeActionOperation.getRequestContents(), MediaType.APPLICATION_XML_TYPE);
ClientResponse clientResponse = webResource.method(entityTypeActionOperation.getVerb(), ClientResponse.class);
- return entityTypeActionOperation.processTypeResponse(clientResponse);
+ return (T) entityTypeActionOperation.processResponse(clientResponse);
}
@Override
View
2 ...rosoft/windowsazure/services/media/implementation/entities/EntityTypeActionOperation.java
@@ -34,7 +34,7 @@
* the client response
* @return the object
*/
- void processResponse(ClientResponse clientResponse);
+ Object processResponse(ClientResponse clientResponse);
/**
* Gets the verb.

0 comments on commit 520185b

Please sign in to comment.