Permalink
Browse files

Merge branch 'security' of https://github.com/gcheng/azure-sdk-for-ja…

…va-pr into security

Conflicts:
	microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/JobIntegrationTest.java
  • Loading branch information...
2 parents 59c9897 + 4b6de12 commit 5b44499b054fbb320abf20e8b0a086dbe09074e7 Albert Cheng committed Dec 15, 2012
Showing with 918 additions and 467 deletions.
  1. +0 −5 microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/MediaContract.java
  2. +0 −10 ...c/main/java/com/microsoft/windowsazure/services/media/implementation/MediaExceptionProcessor.java
  3. +9 −3 ...re-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/MediaRestProxy.java
  4. +11 −0 ...azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/ODataEntity.java
  5. +1 −1 .../src/main/java/com/microsoft/windowsazure/services/media/implementation/VersionHeadersFilter.java
  6. +0 −71 ...e-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/JobType.java
  7. +18 −0 ...ava/com/microsoft/windowsazure/services/media/implementation/entities/DefaultActionOperation.java
  8. +18 −1 ...ava/com/microsoft/windowsazure/services/media/implementation/entities/DefaultDeleteOperation.java
  9. +19 −2 ...n/java/com/microsoft/windowsazure/services/media/implementation/entities/DefaultGetOperation.java
  10. +38 −0 .../java/com/microsoft/windowsazure/services/media/implementation/entities/DefaultListOperation.java
  11. +8 −0 ...java/com/microsoft/windowsazure/services/media/implementation/entities/EntityDeleteOperation.java
  12. +1 −1 ...n/java/com/microsoft/windowsazure/services/media/implementation/entities/EntityLinkOperation.java
  13. +2 −0 ...n/java/com/microsoft/windowsazure/services/media/implementation/entities/EntityListOperation.java
  14. +8 −2 .../main/java/com/microsoft/windowsazure/services/media/implementation/entities/EntityOperation.java
  15. +18 −0 ...n/java/com/microsoft/windowsazure/services/media/implementation/entities/EntityOperationBase.java
  16. +0 −1 ...om/microsoft/windowsazure/services/media/implementation/entities/EntityOperationSingleResult.java
  17. +33 −0 .../main/java/com/microsoft/windowsazure/services/media/implementation/entities/EntityProxyData.java
  18. +26 −10 .../main/java/com/microsoft/windowsazure/services/media/implementation/entities/EntityRestProxy.java
  19. +0 −1 ...java/com/microsoft/windowsazure/services/media/implementation/entities/EntityUpdateOperation.java
  20. +13 −3 microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/AccessPolicy.java
  21. +34 −4 microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/Asset.java
  22. +16 −9 microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/AssetFile.java
  23. +37 −0 microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/AssetInfo.java
  24. +14 −3 microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/ContentKey.java
  25. +12 −66 microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/Job.java
  26. +13 −13 microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/JobInfo.java
  27. +24 −20 microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/Locator.java
  28. +18 −0 microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/LocatorInfo.java
  29. +2 −3 ...soft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/MediaProcessor.java
  30. +98 −37 microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/Task.java
  31. +22 −4 microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/TaskInfo.java
  32. +69 −0 microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/TaskOption.java
  33. +81 −0 microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/TaskState.java
  34. +3 −9 ...zure-api/src/test/java/com/microsoft/windowsazure/services/media/AccessPolicyIntegrationTest.java
  35. +10 −12 ...t-azure-api/src/test/java/com/microsoft/windowsazure/services/media/AssetFileIntegrationTest.java
  36. +12 −22 ...osoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/AssetIntegrationTest.java
  37. +1 −7 ...-azure-api/src/test/java/com/microsoft/windowsazure/services/media/ContentKeyIntegrationTest.java
  38. +3 −9 microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/EntityProxyTest.java
  39. +4 −5 microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/IntegrationTestBase.java
  40. +70 −35 microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/JobIntegrationTest.java
  41. +45 −30 ...ft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/LocatorIntegrationTests.java
  42. +2 −12 ...re-api/src/test/java/com/microsoft/windowsazure/services/media/MediaProcessorIntegrationTest.java
  43. +1 −1 ...t-azure-api/src/test/java/com/microsoft/windowsazure/services/media/UploadingIntegrationTest.java
  44. +7 −2 .../test/java/com/microsoft/windowsazure/services/media/implementation/MediaBatchOperationsTest.java
  45. +64 −0 ...oft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/AssetEntityTest.java
  46. +0 −8 ...azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/AssetFileEntityTest.java
  47. +3 −6 ...t-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/LocatorEntityTest.java
  48. +3 −3 ...azure-api/src/test/java/com/microsoft/windowsazure/services/scenarios/MediaServiceValidation.java
  49. +27 −36 ...ft-azure-api/src/test/java/com/microsoft/windowsazure/services/scenarios/MediaServiceWrapper.java
@@ -15,8 +15,6 @@
package com.microsoft.windowsazure.services.media;
-import java.net.URI;
-
import com.microsoft.windowsazure.services.core.FilterableService;
import com.microsoft.windowsazure.services.media.implementation.entities.EntityContract;
import com.microsoft.windowsazure.services.media.models.LocatorInfo;
@@ -26,9 +24,6 @@
*
*/
public interface MediaContract extends FilterableService<MediaContract>, EntityContract {
-
- URI getRestServiceUri();
-
/**
* Creates an instance of the <code>WritableBlobContainerContract</code> API that will
* write to the blob container given by the provided locator.
@@ -15,8 +15,6 @@
package com.microsoft.windowsazure.services.media.implementation;
-import java.net.URI;
-
import javax.inject.Inject;
import org.apache.commons.logging.Log;
@@ -191,14 +189,6 @@ public Object action(EntityActionOperation action) throws ServiceException {
}
/* (non-Javadoc)
- * @see com.microsoft.windowsazure.services.media.MediaContract#getRestServiceUri()
- */
- @Override
- public URI getRestServiceUri() {
- return service.getRestServiceUri();
- }
-
- /* (non-Javadoc)
* @see com.microsoft.windowsazure.services.media.MediaContract#createBlobWriter(com.microsoft.windowsazure.services.media.models.LocatorInfo)
*/
@Override
@@ -27,6 +27,7 @@
import com.microsoft.windowsazure.services.core.utils.pipeline.ClientConfigSettings;
import com.microsoft.windowsazure.services.media.MediaContract;
import com.microsoft.windowsazure.services.media.WritableBlobContainerContract;
+import com.microsoft.windowsazure.services.media.implementation.entities.EntityProxyData;
import com.microsoft.windowsazure.services.media.implementation.entities.EntityRestProxy;
import com.microsoft.windowsazure.services.media.models.LocatorInfo;
import com.microsoft.windowsazure.services.media.models.LocatorType;
@@ -100,11 +101,16 @@ public MediaContract withFilter(ServiceFilter filter) {
}
/* (non-Javadoc)
- * @see com.microsoft.windowsazure.services.media.MediaContract#getRestServiceUri()
+ * @see com.microsoft.windowsazure.services.media.implementation.entities.EntityRestProxy#createProxyData()
*/
@Override
- public URI getRestServiceUri() {
- return this.redirectFilter.getBaseURI();
+ protected EntityProxyData createProxyData() {
+ return new EntityProxyData() {
+ @Override
+ public URI getServiceUri() {
+ return redirectFilter.getBaseURI();
+ }
+ };
}
/* (non-Javadoc)
@@ -100,6 +100,17 @@ public LinkInfo getLink(String rel) {
}
/**
+ * Get the link to navigate an OData relationship
+ *
+ * @param relationName
+ * name of the OData relationship
+ * @return the link if found, null if not.
+ */
+ public LinkInfo getRelationLink(String relationName) {
+ return getLink(Constants.ODATA_DATA_NS + "/related/" + relationName);
+ }
+
+ /**
* Return the links from this entry
*
* @return List of the links.
@@ -37,7 +37,7 @@ public ClientResponse doHandle(ClientRequest cr) throws ClientHandlerException {
MultivaluedMap<String, Object> headers = cr.getHeaders();
headers.add("DataServiceVersion", "3.0");
headers.add("MaxDataServiceVersion", "3.0");
- headers.add("x-ms-version", "1.0");
+ headers.add("x-ms-version", "2.0");
return getNext().handle(cr);
}
}
@@ -16,7 +16,6 @@
package com.microsoft.windowsazure.services.media.implementation.content;
import java.util.Date;
-import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
@@ -70,16 +69,6 @@
@XmlElement(name = "TemplateId", namespace = Constants.ODATA_DATA_NS)
protected String templateId;
- /** The output media assets. */
- protected List<String> outputMediaAssets;
-
- /** The input media assets. */
- protected List<String> inputMediaAssets;
-
- /** The tasks. */
- @XmlElement(name = "TaskBody", namespace = Constants.ODATA_DATA_NS)
- protected String taskBody;
-
/**
* Gets the id.
*
@@ -280,64 +269,4 @@ public JobType setTemplateId(String templateId) {
return this;
}
- /**
- * Gets the output media assets.
- *
- * @return the output media assets
- */
- public List<String> getOutputMediaAssets() {
- return outputMediaAssets;
- }
-
- /**
- * Sets the output media assets.
- *
- * @param uriList
- * the new output media assets
- */
- public JobType setOutputMediaAssets(List<String> outputMediaAssets) {
- this.outputMediaAssets = outputMediaAssets;
- return this;
- }
-
- /**
- * Gets the input media assets.
- *
- * @return the input media assets
- */
- public List<String> getInputMediaAssets() {
- return inputMediaAssets;
- }
-
- /**
- * Sets the input media assets.
- *
- * @param uriList
- * the new input media assets
- */
- public JobType setInputMediaAssets(List<String> inputMediaAssets) {
- this.inputMediaAssets = inputMediaAssets;
- return this;
- }
-
- /**
- * Gets the tasks.
- *
- * @return the tasks
- */
- public String getTaskBody() {
- return taskBody;
- }
-
- /**
- * Sets the tasks.
- *
- * @param tasks
- * the new tasks
- */
- public JobType setTaskBody(String taskBody) {
- this.taskBody = taskBody;
- return this;
- }
-
}
@@ -26,6 +26,7 @@
* Generic implementation of Delete operation usable by most entities.
*/
public class DefaultActionOperation implements EntityActionOperation {
+ private EntityProxyData proxyData;
/** The name. */
protected String name;
@@ -58,6 +59,23 @@ 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
+ *
+ * @return the proxy data
+ */
+ protected EntityProxyData getProxyData() {
+ return proxyData;
+ }
+
+ /* (non-Javadoc)
* @see com.microsoft.windowsazure.services.media.entities.EntityDeleteOperation#getUri()
*/
@Override
@@ -15,13 +15,13 @@
package com.microsoft.windowsazure.services.media.implementation.entities;
-
/**
* Generic implementation of Delete operation usable by most entities
*
*/
public class DefaultDeleteOperation implements EntityDeleteOperation {
private final EntityOperationBase.EntityUriBuilder uriBuilder;
+ private EntityProxyData proxyData;
/**
*
@@ -31,6 +31,23 @@ public DefaultDeleteOperation(String entityUri, String entityId) {
}
/* (non-Javadoc)
+ * @see com.microsoft.windowsazure.services.media.implementation.entities.EntityDeleteOperation#setProxyData(com.microsoft.windowsazure.services.media.implementation.entities.EntityProxyData)
+ */
+ @Override
+ public void setProxyData(EntityProxyData proxyData) {
+ this.proxyData = proxyData;
+ }
+
+ /**
+ * Get currently set proxy data
+ *
+ * @return the proxyData
+ */
+ protected EntityProxyData getProxyData() {
+ return proxyData;
+ }
+
+ /* (non-Javadoc)
* @see com.microsoft.windowsazure.services.media.entities.EntityDeleteOperation#getUri()
*/
@Override
@@ -15,18 +15,35 @@
package com.microsoft.windowsazure.services.media.implementation.entities;
-
/**
* Generic implementation of the get operation usable for most entities
*
*/
public class DefaultGetOperation<T> extends EntityOperationSingleResultBase<T> implements EntityGetOperation<T> {
/**
- * @param uri
+ * Construct a new DefaultGetOperation to return the given entity id
+ *
+ * @param entityTypeUri
+ * Entity set URI
+ * @param entityId
+ * id of entity
* @param responseClass
+ * class to return from the get operation
*/
public DefaultGetOperation(String entityTypeUri, String entityId, Class<T> responseClass) {
super(new EntityOperationBase.EntityIdUriBuilder(entityTypeUri, entityId), responseClass);
}
+
+ /**
+ * Construct a new DefaultGetOperation to return the entity from the given uri
+ *
+ * @param uri
+ * Uri for entity
+ * @param responseClass
+ * class to return from the get operation
+ */
+ public DefaultGetOperation(String uri, Class<T> responseClass) {
+ super(uri, responseClass);
+ }
}
@@ -41,6 +41,44 @@ public DefaultListOperation(String entityUri, GenericType<ListResult<T>> respons
this.queryParameters.putAll(queryParameters);
}
+ /**
+ * Add a "$top" query parameter to set the number of values to return
+ *
+ * @param topValue
+ * number of values to return
+ * @return this
+ */
+ public DefaultListOperation<T> setTop(int topValue) {
+ queryParameters.add("$top", Integer.toString(topValue));
+ return this;
+ }
+
+ /**
+ * Add a "$skip" query parameter to set the number of values to skip
+ *
+ * @param skipValue
+ * the number of values to skip
+ * @return this
+ */
+ public DefaultListOperation<T> setSkip(int skipValue) {
+ queryParameters.add("$skip", Integer.toString(skipValue));
+ return this;
+ }
+
+ /**
+ * Add an arbitrary query parameter
+ *
+ * @param parameterName
+ * name of query parameter
+ * @param parameterValue
+ * value for query parameter
+ * @return this
+ */
+ public DefaultListOperation<T> set(String parameterName, String parameterValue) {
+ queryParameters.add(parameterName, parameterValue);
+ return this;
+ }
+
/* (non-Javadoc)
* @see com.microsoft.windowsazure.services.media.entities.EntityListOperation#getQueryParameters()
*/
@@ -1,6 +1,14 @@
package com.microsoft.windowsazure.services.media.implementation.entities;
public interface EntityDeleteOperation {
+
+ /**
+ * Supplies the current proxy information to the action.
+ *
+ * @param proxyData
+ */
+ void setProxyData(EntityProxyData proxyData);
+
/**
* Get the URI to use to delete an entity
*
@@ -144,7 +144,7 @@ public Object processResponse(ClientResponse clientResponse) {
@Override
public Object getRequestContents() {
MediaUriType mediaUriType = new MediaUriType();
- mediaUriType.setUri(this.secondaryEntityUri.toString());
+ mediaUriType.setUri(getProxyData().getServiceUri().toString() + this.secondaryEntityUri.toString());
JAXBElement<MediaUriType> mediaUriTypeElement = new JAXBElement<MediaUriType>(new QName(
Constants.ODATA_DATA_NS, "uri"), MediaUriType.class, mediaUriType);
Document document = documentBuilder.newDocument();
@@ -35,6 +35,8 @@
/**
* Get a GenericType object representing the result list type
+ *
+ * @return the type of the operation's result
*/
GenericType<ListResult<T>> getResponseGenericType();
}
@@ -22,6 +22,13 @@
public interface EntityOperation {
/**
+ * Supplies the current proxy information to the action.
+ *
+ * @param proxyData
+ */
+ void setProxyData(EntityProxyData proxyData);
+
+ /**
* Get the URI the creation request should be sent to.
*
* @return The uri
@@ -40,5 +47,4 @@
* Get the MIME type that we're expecting the server to send back.
*/
public abstract MediaType getAcceptType();
-
-}
+}
Oops, something went wrong. Retry.

0 comments on commit 5b44499

Please sign in to comment.