Permalink
Browse files

update the entity type action operation.

  • Loading branch information...
Albert Cheng
Albert Cheng committed Jan 9, 2013
1 parent 582439f commit e15f49ff9815a271ce64d83951491fbcf82a7921
@@ -1,3 +1,18 @@
+/**
+ * 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.windowsazure.services.media.implementation.entities;
import javax.ws.rs.core.MediaType;
@@ -25,10 +40,10 @@
private MediaType acceptType = MediaType.APPLICATION_ATOM_XML_TYPE;
/** The query parameters. */
- private MultivaluedMapImpl queryParameters;
+ private final MultivaluedMap<String, String> queryParameters;
/** The proxy data. */
- private EntityProxyData proxyData;
+ protected EntityProxyData proxyData;
/**
* Instantiates a new default type action operation.
@@ -138,24 +153,13 @@ public Object processResponse(Object rawResponse) throws ServiceException {
return this;
}
- /**
- * Sets the accept type.
- *
- * @param acceptType
- * the accept type
- * @return the entity type action operation
+ /* (non-Javadoc)
+ * @see com.microsoft.windowsazure.services.media.implementation.entities.EntityTypeActionOperation#setAcceptType(javax.ws.rs.core.MediaType)
*/
+ @Override
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;
- }
-
}
@@ -27,7 +27,7 @@
* @param proxyData
* @return
*/
- void setProxyData(EntityProxyData proxyData);
+ public void setProxyData(EntityProxyData proxyData);
/**
* Get the URI the creation request should be sent to.
@@ -97,6 +97,7 @@ private WebResource getResource(String entityName) {
* the operation
* @return the resource
* @throws ServiceException
+ * the service exception
*/
private Builder getResource(EntityOperation operation) throws ServiceException {
return getResource(operation.getUri()).type(operation.getContentType()).accept(operation.getAcceptType());
@@ -176,11 +177,21 @@ public void delete(EntityDeleteOperation deleter) throws ServiceException {
return (T) entityTypeActionOperation.processResponse(clientResponse);
}
+ /* (non-Javadoc)
+ * @see com.microsoft.windowsazure.services.media.implementation.entities.EntityContract#action(com.microsoft.windowsazure.services.media.implementation.entities.EntityActionOperation)
+ */
@Override
public void action(EntityActionOperation entityActionOperation) throws ServiceException {
entityActionOperation.processResponse(getActionClientResponse(entityActionOperation));
}
+ /**
+ * Gets the action client response.
+ *
+ * @param entityActionOperation
+ * the entity action operation
+ * @return the action client response
+ */
private ClientResponse getActionClientResponse(EntityActionOperation entityActionOperation) {
entityActionOperation.setProxyData(createProxyData());
Builder webResource = getResource(entityActionOperation.getUri())
@@ -1,12 +1,40 @@
+/**
+ * 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.windowsazure.services.media.implementation.entities;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import com.sun.jersey.api.client.ClientResponse;
+/**
+ * The Interface EntityTypeActionOperation.
+ *
+ * @param <T>
+ * the generic type
+ */
public interface EntityTypeActionOperation<T> extends EntityOperation {
+ /**
+ * Process type response.
+ *
+ * @param clientResponse
+ * the client response
+ * @return the t
+ */
T processTypeResponse(ClientResponse clientResponse);
/**
@@ -27,15 +55,6 @@
*/
EntityTypeActionOperation<T> addQueryParameter(String key, String value);
- /**
- * Process response.
- *
- * @param clientResponse
- * the client response
- * @return the object
- */
- Object processResponse(ClientResponse clientResponse);
-
/**
* Gets the verb.
*
@@ -50,6 +69,22 @@
*/
Object getRequestContents();
+ /**
+ * Sets the content type.
+ *
+ * @param contentType
+ * the content type
+ * @return the entity type action operation
+ */
EntityTypeActionOperation<T> setContentType(MediaType contentType);
+ /**
+ * Sets the accept type.
+ *
+ * @param acceptType
+ * the accept type
+ * @return the entity type action operation
+ */
+ EntityTypeActionOperation<T> setAcceptType(MediaType acceptType);
+
}

0 comments on commit e15f49f

Please sign in to comment.