diff --git a/ChangeLog.txt b/ChangeLog.txt index 78ac7b32bfa1..8fe478e4a635 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,9 @@ +2013.1.18 Version 0.4.0 + * Added support for Windows Azure Media Services + * Updated dependencies to non-beta stable versions + * Add a Sending Request Event to OperationContext in Storage Client code + * Fix a bug in the STorage client in blob download resume for blobs greater than 2GB + 2012.10.29 Version 0.3.3 * In the blob client, fixed a bug which allows users to call write APIs on a blob snapshot reference * Updated the URL parse method in storage client libraries, to allow users to pass a URL ending with "/" diff --git a/README.md b/README.md index a49e66e0493b..87ce6e7e7bba 100644 --- a/README.md +++ b/README.md @@ -13,13 +13,17 @@ For documentation please see the [Windows Azure Java Developer Center](http://ww * Create/Delete Queues * Insert/Peek Queue Messages * Advanced Queue Operations +* Media Services + * Upload Media Files to Media Services + * Change the encoding on uploaded Media Services + * Provide streaming or download access to uploaded/transformed Media Files * Service Bus * Use either the Queue or Topic/Subscription Model * Service Runtime * Retrieve information about the state of your Azure Compute instances * Table * Manage Tables - * Work with Table Entities (CRUD) + * Table Entity Operations * Entity Group Transactions (Batch) #Getting Started @@ -41,7 +45,7 @@ within your project you can also have them installed by the Java package manager com.microsoft.windowsazure microsoft-windowsazure-api - 0.3.3 + 0.4.0 ##Minimum Requirements diff --git a/microsoft-azure-api/.settings/org.eclipse.core.resources.prefs b/microsoft-azure-api/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 000000000000..29abf9995641 --- /dev/null +++ b/microsoft-azure-api/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/test/java=UTF-8 +encoding//src/test/resources=UTF-8 +encoding/=UTF-8 diff --git a/microsoft-azure-api/.settings/org.eclipse.jdt.ui.prefs b/microsoft-azure-api/.settings/org.eclipse.jdt.ui.prefs index 0f7349dc4064..1192a0c8bae0 100644 --- a/microsoft-azure-api/.settings/org.eclipse.jdt.ui.prefs +++ b/microsoft-azure-api/.settings/org.eclipse.jdt.ui.prefs @@ -30,7 +30,7 @@ cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=tru cleanup.qualify_static_member_accesses_with_declaring_class=true cleanup.qualify_static_method_accesses_with_declaring_class=false cleanup.remove_private_constructors=true -cleanup.remove_trailing_whitespaces=false +cleanup.remove_trailing_whitespaces=true cleanup.remove_trailing_whitespaces_all=true cleanup.remove_trailing_whitespaces_ignore_empty=false cleanup.remove_unnecessary_casts=true diff --git a/microsoft-azure-api/pom.xml b/microsoft-azure-api/pom.xml index 9dec5ce436d2..45fbc390a65e 100644 --- a/microsoft-azure-api/pom.xml +++ b/microsoft-azure-api/pom.xml @@ -1,252 +1,275 @@ - - - 4.0.0 - com.microsoft.windowsazure - microsoft-windowsazure-api - 0.3.3 - jar - - Microsoft Windows Azure Client API - API for Microsoft Windows Azure Clients - https://github.com/WindowsAzure/azure-sdk-for-java - - - - The Apache Software License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - repo - - - - - scm:git:https://github.com/WindowsAzure/azure-sdk-for-java - scm:git:git://github.com/WindowsAzure/azure-sdk-for-java.git - - - - UTF-8 - - - - - - microsoft - Microsoft - - - - - - com.sun.jersey - jersey-client - 1.10-b02 - - - javax.xml.bind - jaxb-api - 2.1 - provided - - - junit - junit - 4.8 - test - - - org.hamcrest - hamcrest-all - 1.1 - test - - - org.mockito - mockito-all - test - 1.9.0-rc1 - - - javax.inject - javax.inject - 1 - - - com.sun.jersey - jersey-json - 1.10-b02 - - - commons-logging - commons-logging - 1.1.1 - - - javax.mail - mail - 1.4 - - - org.apache.commons - commons-lang3 - 3.1 - - - - - - - org.apache.maven.plugins - maven-help-plugin - 2.1.1 - - - validate - - evaluate - - - legal - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.3.2 - - 1.6 - 1.6 - - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - 0.8.0 - - - generate-sources - - generate - - - - - true - - - org.jvnet.jaxb2_commons - jaxb2-basics - 0.6.0 - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - 0.6.0 - - - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 2.8 - - *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization - /** -
* Copyright 2011 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. -
*/]]>
-
-
- - - org.codehaus.mojo - findbugs-maven-plugin - 2.3.2 - - true - true - true - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - 2.8 - - src/config/checkstyle.xml - - - - -
- - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - org.apache.maven.plugins - maven-help-plugin - [2.1.1,) - - evaluate - - - - - - - - - - - - org.apache.maven.plugins - maven-resources-plugin - 2.4.3 - - - org.apache.maven.plugins - maven-surefire-plugin - 2.12 - - - -
-
\ No newline at end of file + + + 4.0.0 + com.microsoft.windowsazure + microsoft-windowsazure-api + 0.4.0 + jar + + Microsoft Windows Azure Client API + API for Microsoft Windows Azure Clients + https://github.com/WindowsAzure/azure-sdk-for-java + + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + scm:git:https://github.com/WindowsAzure/azure-sdk-for-java + scm:git:git://github.com/WindowsAzure/azure-sdk-for-java.git + + + + UTF-8 + + + + + + microsoft + Microsoft + + + + + + com.sun.jersey + jersey-client + 1.13 + + + javax.xml.bind + jaxb-api + 2.2.7 + provided + + + junit + junit + 4.10 + test + + + org.hamcrest + hamcrest-all + 1.3 + test + + + org.mockito + mockito-all + 1.9.0 + test + + + javax.inject + javax.inject + 1 + + + com.sun.jersey + jersey-json + 1.13 + + + commons-logging + commons-logging + 1.1.1 + + + javax.mail + mail + 1.4.5 + + + org.apache.commons + commons-lang3 + 3.1 + + + + + + + org.apache.maven.plugins + maven-help-plugin + 2.1.1 + + + validate + + evaluate + + + legal + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.3.2 + + 1.6 + 1.6 + + + + org.jvnet.jaxb2.maven2 + maven-jaxb2-plugin + 0.8.0 + + + generate-sources + + generate + + + + + true + + + org.jvnet.jaxb2_commons + jaxb2-basics + 0.6.0 + + + org.jvnet.jaxb2_commons + jaxb2-basics-annotate + 0.6.0 + + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization + /** +
* Copyright 2011 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. +
*/]]>
+
+
+ + + org.codehaus.mojo + findbugs-maven-plugin + 2.3.2 + + true + true + true + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + 2.8 + + src/config/checkstyle.xml + + + +
+ + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + org.apache.maven.plugins + maven-help-plugin + [2.1.1,) + + evaluate + + + + + + + + + + + + org.apache.maven.plugins + maven-resources-plugin + 2.4.3 + + + org.apache.maven.plugins + maven-surefire-plugin + 2.12 + + + **/Test*.java + **/*Test.java + **/*Tests.java + **/*TestCase.java + + + + + +
+ + + + org.codehaus.mojo + emma-maven-plugin + 1.0-alpha-3 + true + + + org.codehaus.mojo + surefire-report-maven-plugin + 2.0-beta-1 + true + + + +
diff --git a/microsoft-azure-api/src/config/checkstyle.xml b/microsoft-azure-api/src/config/checkstyle.xml index 0f628e43c5c5..287b61490dd3 100644 --- a/microsoft-azure-api/src/config/checkstyle.xml +++ b/microsoft-azure-api/src/config/checkstyle.xml @@ -47,7 +47,12 @@ + + @@ -62,11 +67,15 @@ + + --> @@ -74,10 +83,17 @@ + + @@ -118,9 +134,15 @@ + + @@ -150,7 +172,12 @@ + + @@ -159,7 +186,13 @@ + + @@ -170,7 +203,15 @@ + + + @@ -180,7 +221,13 @@ + + + diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/AcquireCurrentState.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/AcquireCurrentState.java index 2dd6e66b1858..075bafcad08b 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/AcquireCurrentState.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/AcquireCurrentState.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/AcquireLeaseInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/AcquireLeaseInfo.java index 7030db4332b2..981433e5ccca 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/AcquireLeaseInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/AcquireLeaseInfo.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/Adapter1.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/Adapter1.java index 3b35f8d0463e..f6ffdd6ff61f 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/Adapter1.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/Adapter1.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/ChunkedGoalStateDeserializer.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/ChunkedGoalStateDeserializer.java index 4d5d2f468fe4..38ed6c4a4812 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/ChunkedGoalStateDeserializer.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/ChunkedGoalStateDeserializer.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/ConfigurationSettingInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/ConfigurationSettingInfo.java index 3c52c56eb568..3dc242264b4c 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/ConfigurationSettingInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/ConfigurationSettingInfo.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/ConfigurationSettingsInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/ConfigurationSettingsInfo.java index 152228cced1b..c649e156bc8d 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/ConfigurationSettingsInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/ConfigurationSettingsInfo.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/CurrentRoleInstanceInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/CurrentRoleInstanceInfo.java index 78ae4283605f..2e2e0cab510e 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/CurrentRoleInstanceInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/CurrentRoleInstanceInfo.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/CurrentState.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/CurrentState.java index a297210f77e4..1a94780bec99 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/CurrentState.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/CurrentState.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/CurrentStateInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/CurrentStateInfo.java index e9ae55b96a16..d1a510648d22 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/CurrentStateInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/CurrentStateInfo.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/CurrentStateSerializer.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/CurrentStateSerializer.java index b972bc6c4f51..a49ea402dd49 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/CurrentStateSerializer.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/CurrentStateSerializer.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/CurrentStatus.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/CurrentStatus.java index 4117871ddac5..581ae06130d8 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/CurrentStatus.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/CurrentStatus.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/CurrentStatusEnum.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/CurrentStatusEnum.java index 01ce61f3ae83..47ccf5fe608a 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/CurrentStatusEnum.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/CurrentStatusEnum.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/DeploymentInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/DeploymentInfo.java index 90b28659fa77..bf718ae02a45 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/DeploymentInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/DeploymentInfo.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/EndpointInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/EndpointInfo.java index 38a846701d74..27080ec5e080 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/EndpointInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/EndpointInfo.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/EndpointsInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/EndpointsInfo.java index 208070113082..c7fec0149f8c 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/EndpointsInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/EndpointsInfo.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/ExpectedState.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/ExpectedState.java index c341d8630e50..12c3c2574fb3 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/ExpectedState.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/ExpectedState.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/ExpectedStateEnum.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/ExpectedStateEnum.java index 9f07267449bb..84dc6e399cf6 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/ExpectedStateEnum.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/ExpectedStateEnum.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/FileInputChannel.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/FileInputChannel.java index 75c85fb7e05b..3d4d2ee09ef3 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/FileInputChannel.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/FileInputChannel.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/FileOutputChannel.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/FileOutputChannel.java index a377a8f42b72..19d28d97d859 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/FileOutputChannel.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/FileOutputChannel.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/GoalState.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/GoalState.java index 963b1e88abaf..5dce2f4fc9fb 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/GoalState.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/GoalState.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/GoalStateChangedListener.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/GoalStateChangedListener.java index 68af2418ea7c..1ce379942f89 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/GoalStateChangedListener.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/GoalStateChangedListener.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/GoalStateDeserializer.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/GoalStateDeserializer.java index c255037d4393..71bea2022a6c 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/GoalStateDeserializer.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/GoalStateDeserializer.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/GoalStateInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/GoalStateInfo.java index fa26a21d4046..8cdab9ef1035 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/GoalStateInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/GoalStateInfo.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/InputChannel.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/InputChannel.java index 9623dfd83541..287281391853 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/InputChannel.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/InputChannel.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/LocalResource.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/LocalResource.java index c62ff4aaf866..aadc32b1c0e0 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/LocalResource.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/LocalResource.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/LocalResourceInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/LocalResourceInfo.java index 524a072ca85a..2f835312652b 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/LocalResourceInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/LocalResourceInfo.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/LocalResourcesInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/LocalResourcesInfo.java index e4c1f724e57c..fe827403e610 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/LocalResourcesInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/LocalResourcesInfo.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/ObjectFactory.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/ObjectFactory.java index 043b15c7dc37..9f1fdc395fba 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/ObjectFactory.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/ObjectFactory.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/OutputChannel.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/OutputChannel.java index 02588c1bbd76..10afcce3714a 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/OutputChannel.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/OutputChannel.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/Protocol1RuntimeClient.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/Protocol1RuntimeClient.java index 145fd690c46b..bc64390fa745 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/Protocol1RuntimeClient.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/Protocol1RuntimeClient.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/Protocol1RuntimeCurrentStateClient.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/Protocol1RuntimeCurrentStateClient.java index 5629f11bcf2c..50386d173b70 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/Protocol1RuntimeCurrentStateClient.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/Protocol1RuntimeCurrentStateClient.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/Protocol1RuntimeGoalStateClient.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/Protocol1RuntimeGoalStateClient.java index 5ad4692c4352..0f159c54eb7b 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/Protocol1RuntimeGoalStateClient.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/Protocol1RuntimeGoalStateClient.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/ProtocolEnum.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/ProtocolEnum.java index db453e64c4fc..c48227e85de7 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/ProtocolEnum.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/ProtocolEnum.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/ReleaseCurrentState.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/ReleaseCurrentState.java index a1f55f0c57e1..31d36f1907d1 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/ReleaseCurrentState.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/ReleaseCurrentState.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/Role.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/Role.java index aacdb7393c32..32674087109b 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/Role.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/Role.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironment.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironment.java index f0bc096b8a1e..5d8f04727b04 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironment.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironment.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. @@ -468,7 +468,7 @@ public static void setStatus(RoleInstanceStatus status, Date expiration_utc) { Calendar expiration = Calendar.getInstance(); expiration.setTime(expiration_utc); - + CurrentState newState = new AcquireCurrentState(clientId, currentGoalState.get().getIncarnation(), currentStatus, expiration); diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentChange.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentChange.java index 25f1471358ef..4d0016f92f8f 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentChange.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentChange.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentChangedEvent.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentChangedEvent.java index 9dceff6aaa21..9f24a1ba276e 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentChangedEvent.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentChangedEvent.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentChangedListener.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentChangedListener.java index f97f3254bf79..a70a6c2073c3 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentChangedListener.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentChangedListener.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentChangingEvent.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentChangingEvent.java index 165c01ae0445..47ea45eaddc5 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentChangingEvent.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentChangingEvent.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentChangingListener.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentChangingListener.java index d23826c7636d..128216aff7b1 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentChangingListener.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentChangingListener.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentConfigurationSettingChange.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentConfigurationSettingChange.java index 8cacec8f3936..98cb83df9371 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentConfigurationSettingChange.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentConfigurationSettingChange.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentData.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentData.java index 28d7583ec2dd..77cd51233165 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentData.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentData.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentDataDeserializer.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentDataDeserializer.java index acb58d29d213..a551898a6916 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentDataDeserializer.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentDataDeserializer.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentInfo.java index d12e8be57331..8c14d2406b32 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentInfo.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentNotAvailableException.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentNotAvailableException.java index 5d677fc39c4b..bf0155fe25f4 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentNotAvailableException.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentNotAvailableException.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentStoppingListener.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentStoppingListener.java index e226db05b84b..d00d8081c77d 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentStoppingListener.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentStoppingListener.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentTopologyChange.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentTopologyChange.java index b6e93c6f2def..f7709f3da541 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentTopologyChange.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentTopologyChange.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleInfo.java index a658b35195ef..98e36249cfcd 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleInfo.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleInstance.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleInstance.java index e43948abd8b3..4f7a470f2f20 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleInstance.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleInstance.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleInstanceEndpoint.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleInstanceEndpoint.java index 2e13e5fb7b09..3efe3eefb54c 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleInstanceEndpoint.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleInstanceEndpoint.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleInstanceInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleInstanceInfo.java index 16f5d51cdd25..ef81ccbcf049 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleInstanceInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleInstanceInfo.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleInstanceStatus.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleInstanceStatus.java index f1dd9d12e3d9..89e62e8e51a1 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleInstanceStatus.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleInstanceStatus.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleInstancesInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleInstancesInfo.java index 128754996001..ce1e0a1b36ae 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleInstancesInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RoleInstancesInfo.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RolesInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RolesInfo.java index 75c91dd91930..cf0d27cff09e 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RolesInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RolesInfo.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RuntimeClient.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RuntimeClient.java index 8e628daccffb..db615c19f24e 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RuntimeClient.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RuntimeClient.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RuntimeClientFactory.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RuntimeClientFactory.java index 5e08d97c6329..23934f16847b 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RuntimeClientFactory.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RuntimeClientFactory.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RuntimeCurrentStateClient.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RuntimeCurrentStateClient.java index 253dbe543264..aa07d24e2615 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RuntimeCurrentStateClient.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RuntimeCurrentStateClient.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RuntimeGoalStateClient.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RuntimeGoalStateClient.java index 74f1166990e6..8ae17edc65a4 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RuntimeGoalStateClient.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RuntimeGoalStateClient.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RuntimeKernel.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RuntimeKernel.java index 58bc3927ad72..2189b14c8a62 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RuntimeKernel.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RuntimeKernel.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RuntimeServerDiscoveryInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RuntimeServerDiscoveryInfo.java index df4dac6e76ed..95d8d15c81b4 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RuntimeServerDiscoveryInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RuntimeServerDiscoveryInfo.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RuntimeServerEndpointInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RuntimeServerEndpointInfo.java index 071da2b2710d..70813f42b9fc 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RuntimeServerEndpointInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RuntimeServerEndpointInfo.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RuntimeServerEndpointsInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RuntimeServerEndpointsInfo.java index 13dfdd635989..4de26b343672 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RuntimeServerEndpointsInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RuntimeServerEndpointsInfo.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RuntimeVersionManager.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RuntimeVersionManager.java index 272cc36f59a2..09931c8a5f85 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RuntimeVersionManager.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RuntimeVersionManager.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RuntimeVersionProtocolClient.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RuntimeVersionProtocolClient.java index 4bea2131f367..1895b03ac914 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RuntimeVersionProtocolClient.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/RuntimeVersionProtocolClient.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/StatusLeaseInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/StatusLeaseInfo.java index 3d4b1e55bc71..8c67f9c094ab 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/StatusLeaseInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/StatusLeaseInfo.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/XmlCurrentStateSerializer.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/XmlCurrentStateSerializer.java index b947685e5c85..2c3b741c6e0c 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/XmlCurrentStateSerializer.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/XmlCurrentStateSerializer.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/XmlGoalStateDeserializer.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/XmlGoalStateDeserializer.java index 8499f43b7dd0..700e9e33d186 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/XmlGoalStateDeserializer.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/XmlGoalStateDeserializer.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/XmlRoleEnvironmentDataDeserializer.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/XmlRoleEnvironmentDataDeserializer.java index 8f27d2a1e346..6304825adc8c 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/XmlRoleEnvironmentDataDeserializer.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/serviceruntime/XmlRoleEnvironmentDataDeserializer.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/BlobConfiguration.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/BlobConfiguration.java index a8191bce65ae..80c3896d33a3 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/BlobConfiguration.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/BlobConfiguration.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/BlobContract.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/BlobContract.java index 367d3b311d93..2cac537f9456 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/BlobContract.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/BlobContract.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/BlobService.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/BlobService.java index 0e48a3033dfb..f09cb8e888da 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/BlobService.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/BlobService.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/Exports.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/Exports.java index 8d9d63bc8972..57a7cd87cc5f 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/Exports.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/Exports.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobAccessPolicyResponse.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobAccessPolicyResponse.java index 66313bc04ebf..a4bccf20ddb4 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobAccessPolicyResponse.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobAccessPolicyResponse.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobAttributes.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobAttributes.java index 64f83ee08e53..0fd33658c862 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobAttributes.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobAttributes.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobConstants.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobConstants.java index 8f3acd35234b..0c56cc1f9377 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobConstants.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobConstants.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobContainerAttributes.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobContainerAttributes.java index f0db3fad5b0f..fb6481bee001 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobContainerAttributes.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobContainerAttributes.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobContainerPermissions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobContainerPermissions.java index c5eabded3812..3838342e0873 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobContainerPermissions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobContainerPermissions.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobContainerProperties.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobContainerProperties.java index 599687b285d7..2b781912d584 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobContainerProperties.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobContainerProperties.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobContainerPublicAccessType.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobContainerPublicAccessType.java index 554dd7bfd40c..51c6cdcbafad 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobContainerPublicAccessType.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobContainerPublicAccessType.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobDeserializationHelper.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobDeserializationHelper.java index 785eed98292d..290d529b6a21 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobDeserializationHelper.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobDeserializationHelper.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobInputStream.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobInputStream.java index 55a8ca520e87..a31526a40e00 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobInputStream.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobInputStream.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobListingContext.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobListingContext.java index 16fea0fbe2bc..d697d0a69ba8 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobListingContext.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobListingContext.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobListingDetails.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobListingDetails.java index 1ea25afa820e..db0b7f9a2dbd 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobListingDetails.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobListingDetails.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobOutputStream.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobOutputStream.java index c3509df1f0c6..dae640999861 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobOutputStream.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobOutputStream.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobProperties.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobProperties.java index 9bb09d0b23f6..9fc4475b052d 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobProperties.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobProperties.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobRequest.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobRequest.java index 52e9cca26ae6..97dd33e6b9e6 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobRequest.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobRequest.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobRequestOptions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobRequestOptions.java index 3cd3c219d4ef..8c1b5e055a51 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobRequestOptions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobRequestOptions.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobResponse.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobResponse.java index ea4f9ab2f974..24c3d5eb9ff6 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobResponse.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobResponse.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobType.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobType.java index 11e5fc250621..5cef258dde15 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobType.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlobType.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlockEntry.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlockEntry.java index 06a588e22776..5e01358333de 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlockEntry.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlockEntry.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlockListingFilter.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlockListingFilter.java index fac52b103895..78295959d61c 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlockListingFilter.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlockListingFilter.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlockSearchMode.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlockSearchMode.java index f7dee4b65297..e96875f9ac37 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlockSearchMode.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/BlockSearchMode.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/CloudBlob.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/CloudBlob.java index 6fc382140925..49ae8c7366fa 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/CloudBlob.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/CloudBlob.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/CloudBlobClient.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/CloudBlobClient.java index ed74ed27450c..181549a8d575 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/CloudBlobClient.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/CloudBlobClient.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/CloudBlobContainer.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/CloudBlobContainer.java index 6cd9752c046e..ff67b888bfe3 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/CloudBlobContainer.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/CloudBlobContainer.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/CloudBlobDirectory.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/CloudBlobDirectory.java index 622ce08f40dc..6f5d16588cbc 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/CloudBlobDirectory.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/CloudBlobDirectory.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/CloudBlockBlob.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/CloudBlockBlob.java index 350cf65c5267..b28a54a6affd 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/CloudBlockBlob.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/CloudBlockBlob.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/CloudPageBlob.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/CloudPageBlob.java index f5ce8f06f4c8..e31eb5aff196 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/CloudPageBlob.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/CloudPageBlob.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/ContainerListingDetails.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/ContainerListingDetails.java index 12c3d8f7b27d..366ef2f8215a 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/ContainerListingDetails.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/ContainerListingDetails.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/ContainerRequest.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/ContainerRequest.java index 4c00cef60eff..4dfad857b93c 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/ContainerRequest.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/ContainerRequest.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/ContainerResponse.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/ContainerResponse.java index f03144533da8..1dbaec6bb4ee 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/ContainerResponse.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/ContainerResponse.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/CopyState.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/CopyState.java index b109528b1496..10c25597d082 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/CopyState.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/CopyState.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/CopyStatus.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/CopyStatus.java index 33809c15c10c..3358e040115d 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/CopyStatus.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/CopyStatus.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/DeleteSnapshotsOption.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/DeleteSnapshotsOption.java index 596d43f5afea..ce7a5b5750c6 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/DeleteSnapshotsOption.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/DeleteSnapshotsOption.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/GetBlockListResponse.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/GetBlockListResponse.java index 7bb03d294fe1..4b2f8f2eeec9 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/GetBlockListResponse.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/GetBlockListResponse.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/GetPageRangesResponse.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/GetPageRangesResponse.java index 412c863a0f9f..63ce73d7c0ae 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/GetPageRangesResponse.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/GetPageRangesResponse.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/ListBlobItem.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/ListBlobItem.java index 10f1b232fbd6..790aa4603463 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/ListBlobItem.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/ListBlobItem.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/ListBlobsResponse.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/ListBlobsResponse.java index 5d01e4a14832..fad732e4e49b 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/ListBlobsResponse.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/ListBlobsResponse.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/ListContainersResponse.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/ListContainersResponse.java index e70aa7ad5e4d..2aa51ccfc7e2 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/ListContainersResponse.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/ListContainersResponse.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/PageOperationType.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/PageOperationType.java index f41ba443a738..e9d49b573948 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/PageOperationType.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/PageOperationType.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/PageProperties.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/PageProperties.java index 334c9aaa5f29..1e76174d7474 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/PageProperties.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/PageProperties.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/PageRange.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/PageRange.java index 3827eca7897e..92b03228ebc0 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/PageRange.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/PageRange.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/SharedAccessBlobPermissions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/SharedAccessBlobPermissions.java index 5475705a29fd..003153c6338a 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/SharedAccessBlobPermissions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/SharedAccessBlobPermissions.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/SharedAccessBlobPolicy.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/SharedAccessBlobPolicy.java index 8d9c708aa56c..c4ebe80b713c 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/SharedAccessBlobPolicy.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/client/SharedAccessBlobPolicy.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/core/storage/SharedAccessSignatureHelper.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/core/storage/SharedAccessSignatureHelper.java index 26cefa304d70..9be65bdcb88f 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/core/storage/SharedAccessSignatureHelper.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/core/storage/SharedAccessSignatureHelper.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/BlobExceptionProcessor.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/BlobExceptionProcessor.java index 157dbd9737cb..8bae36798a8c 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/BlobExceptionProcessor.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/BlobExceptionProcessor.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/BlobOperationRestProxy.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/BlobOperationRestProxy.java new file mode 100644 index 000000000000..b07f42f63f29 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/BlobOperationRestProxy.java @@ -0,0 +1,1012 @@ +/** + * 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.blob.implementation; + +import java.io.InputStream; +import java.util.HashMap; +import java.util.Map; + +import com.microsoft.windowsazure.services.blob.BlobContract; +import com.microsoft.windowsazure.services.blob.models.AccessCondition; +import com.microsoft.windowsazure.services.blob.models.AcquireLeaseOptions; +import com.microsoft.windowsazure.services.blob.models.AcquireLeaseResult; +import com.microsoft.windowsazure.services.blob.models.BlobProperties; +import com.microsoft.windowsazure.services.blob.models.BlobServiceOptions; +import com.microsoft.windowsazure.services.blob.models.BlockList; +import com.microsoft.windowsazure.services.blob.models.CommitBlobBlocksOptions; +import com.microsoft.windowsazure.services.blob.models.ContainerACL; +import com.microsoft.windowsazure.services.blob.models.ContainerACL.PublicAccessType; +import com.microsoft.windowsazure.services.blob.models.CopyBlobOptions; +import com.microsoft.windowsazure.services.blob.models.CopyBlobResult; +import com.microsoft.windowsazure.services.blob.models.CreateBlobBlockOptions; +import com.microsoft.windowsazure.services.blob.models.CreateBlobOptions; +import com.microsoft.windowsazure.services.blob.models.CreateBlobPagesOptions; +import com.microsoft.windowsazure.services.blob.models.CreateBlobPagesResult; +import com.microsoft.windowsazure.services.blob.models.CreateBlobResult; +import com.microsoft.windowsazure.services.blob.models.CreateBlobSnapshotOptions; +import com.microsoft.windowsazure.services.blob.models.CreateBlobSnapshotResult; +import com.microsoft.windowsazure.services.blob.models.CreateContainerOptions; +import com.microsoft.windowsazure.services.blob.models.DeleteBlobOptions; +import com.microsoft.windowsazure.services.blob.models.DeleteContainerOptions; +import com.microsoft.windowsazure.services.blob.models.GetBlobMetadataOptions; +import com.microsoft.windowsazure.services.blob.models.GetBlobMetadataResult; +import com.microsoft.windowsazure.services.blob.models.GetBlobOptions; +import com.microsoft.windowsazure.services.blob.models.GetBlobPropertiesOptions; +import com.microsoft.windowsazure.services.blob.models.GetBlobPropertiesResult; +import com.microsoft.windowsazure.services.blob.models.GetBlobResult; +import com.microsoft.windowsazure.services.blob.models.GetContainerACLResult; +import com.microsoft.windowsazure.services.blob.models.GetContainerPropertiesResult; +import com.microsoft.windowsazure.services.blob.models.GetServicePropertiesResult; +import com.microsoft.windowsazure.services.blob.models.ListBlobBlocksOptions; +import com.microsoft.windowsazure.services.blob.models.ListBlobBlocksResult; +import com.microsoft.windowsazure.services.blob.models.ListBlobRegionsOptions; +import com.microsoft.windowsazure.services.blob.models.ListBlobRegionsResult; +import com.microsoft.windowsazure.services.blob.models.ListBlobsOptions; +import com.microsoft.windowsazure.services.blob.models.ListBlobsResult; +import com.microsoft.windowsazure.services.blob.models.ListContainersOptions; +import com.microsoft.windowsazure.services.blob.models.ListContainersResult; +import com.microsoft.windowsazure.services.blob.models.PageRange; +import com.microsoft.windowsazure.services.blob.models.ServiceProperties; +import com.microsoft.windowsazure.services.blob.models.SetBlobMetadataOptions; +import com.microsoft.windowsazure.services.blob.models.SetBlobMetadataResult; +import com.microsoft.windowsazure.services.blob.models.SetBlobPropertiesOptions; +import com.microsoft.windowsazure.services.blob.models.SetBlobPropertiesResult; +import com.microsoft.windowsazure.services.blob.models.SetContainerMetadataOptions; +import com.microsoft.windowsazure.services.core.ServiceException; +import com.microsoft.windowsazure.services.core.ServiceFilter; +import com.microsoft.windowsazure.services.core.utils.CommaStringBuilder; +import com.microsoft.windowsazure.services.core.utils.pipeline.ClientFilterAdapter; +import com.microsoft.windowsazure.services.core.utils.pipeline.PipelineHelpers; +import com.sun.jersey.api.client.Client; +import com.sun.jersey.api.client.ClientResponse; +import com.sun.jersey.api.client.WebResource; +import com.sun.jersey.api.client.WebResource.Builder; +import com.sun.jersey.core.util.Base64; + +public abstract class BlobOperationRestProxy implements BlobContract { + + private static final String API_VERSION = "2011-08-18"; + private final Client channel; + private final String accountName; + private final String url; + private final RFC1123DateConverter dateMapper; + private final ServiceFilter[] filters; + + protected BlobOperationRestProxy(Client channel, String accountName, String url) { + this(channel, new ServiceFilter[0], accountName, url, new RFC1123DateConverter()); + } + + protected BlobOperationRestProxy(Client channel, ServiceFilter[] filters, String accountName, String url, + RFC1123DateConverter dateMapper) { + this.channel = channel; + this.accountName = accountName; + this.url = url; + this.filters = filters; + this.dateMapper = dateMapper; + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.core.FilterableService#withFilter(com.microsoft.windowsazure.services.core.ServiceFilter) + */ + @Override + public abstract BlobContract withFilter(ServiceFilter filter); + + protected Client getChannel() { + return channel; + } + + protected String getAccountName() { + return accountName; + } + + protected String getUrl() { + return url; + } + + protected RFC1123DateConverter getDateMapper() { + return dateMapper; + } + + protected ServiceFilter[] getFilters() { + return filters; + } + + private void ThrowIfError(ClientResponse r) { + PipelineHelpers.ThrowIfError(r); + } + + private void ThrowIfNotSuccess(ClientResponse clientResponse) { + PipelineHelpers.ThrowIfNotSuccess(clientResponse); + } + + private WebResource addOptionalQueryParam(WebResource webResource, String key, Object value) { + return PipelineHelpers.addOptionalQueryParam(webResource, key, value); + } + + private WebResource addOptionalQueryParam(WebResource webResource, String key, int value, int defaultValue) { + return PipelineHelpers.addOptionalQueryParam(webResource, key, value, defaultValue); + } + + private Builder addOptionalHeader(Builder builder, String name, Object value) { + return PipelineHelpers.addOptionalHeader(builder, name, value); + } + + private Builder addOptionalMetadataHeader(Builder builder, Map metadata) { + return PipelineHelpers.addOptionalMetadataHeader(builder, metadata); + } + + private Builder addOptionalRangeHeader(Builder builder, Long rangeStart, Long rangeEnd) { + return PipelineHelpers.addOptionalRangeHeader(builder, rangeStart, rangeEnd); + } + + private Builder addOptionalAccessConditionHeader(Builder builder, AccessCondition accessCondition) { + return PipelineHelpers.addOptionalAccessConditionHeader(builder, accessCondition); + } + + private Builder addOptionalSourceAccessConditionHeader(Builder builder, AccessCondition accessCondition) { + return PipelineHelpers.addOptionalSourceAccessConditionHeader(builder, accessCondition); + } + + private HashMap getMetadataFromHeaders(ClientResponse response) { + return PipelineHelpers.getMetadataFromHeaders(response); + } + + private WebResource addOptionalBlobListingIncludeQueryParam(ListBlobsOptions options, WebResource webResource) { + CommaStringBuilder sb = new CommaStringBuilder(); + sb.addValue(options.isIncludeSnapshots(), "snapshots"); + sb.addValue(options.isIncludeUncommittedBlobs(), "uncommittedblobs"); + sb.addValue(options.isIncludeMetadata(), "metadata"); + webResource = addOptionalQueryParam(webResource, "include", sb.toString()); + return webResource; + } + + private WebResource addOptionalContainerIncludeQueryParam(ListContainersOptions options, WebResource webResource) { + CommaStringBuilder sb = new CommaStringBuilder(); + sb.addValue(options.isIncludeMetadata(), "metadata"); + webResource = addOptionalQueryParam(webResource, "include", sb.toString()); + return webResource; + } + + private Builder addPutBlobHeaders(CreateBlobOptions options, Builder builder) { + builder = addOptionalHeader(builder, "Content-Type", options.getContentType()); + if (options.getContentType() == null) { + // Note: Add content type here to enable proper HMAC signing + builder = builder.type("application/octet-stream"); + } + builder = addOptionalHeader(builder, "Content-Encoding", options.getContentEncoding()); + builder = addOptionalHeader(builder, "Content-Language", options.getContentLanguage()); + builder = addOptionalHeader(builder, "Content-MD5", options.getContentMD5()); + builder = addOptionalHeader(builder, "Cache-Control", options.getCacheControl()); + builder = addOptionalHeader(builder, "x-ms-blob-content-type", options.getBlobContentType()); + builder = addOptionalHeader(builder, "x-ms-blob-content-encoding", options.getBlobContentEncoding()); + builder = addOptionalHeader(builder, "x-ms-blob-content-language", options.getBlobContentLanguage()); + builder = addOptionalHeader(builder, "x-ms-blob-content-md5", options.getBlobContentMD5()); + builder = addOptionalHeader(builder, "x-ms-blob-cache-control", options.getBlobCacheControl()); + builder = addOptionalHeader(builder, "x-ms-lease-id", options.getLeaseId()); + builder = addOptionalMetadataHeader(builder, options.getMetadata()); + builder = addOptionalAccessConditionHeader(builder, options.getAccessCondition()); + + return builder; + } + + private GetBlobPropertiesResult getBlobPropertiesResultFromResponse(ClientResponse response) { + // Properties + BlobProperties properties = new BlobProperties(); + properties.setLastModified(dateMapper.parse(response.getHeaders().getFirst("Last-Modified"))); + properties.setBlobType(response.getHeaders().getFirst("x-ms-blob-type")); + properties.setLeaseStatus(response.getHeaders().getFirst("x-ms-lease-status")); + + properties.setContentLength(Long.parseLong(response.getHeaders().getFirst("Content-Length"))); + properties.setContentType(response.getHeaders().getFirst("Content-Type")); + properties.setContentMD5(response.getHeaders().getFirst("Content-MD5")); + properties.setContentEncoding(response.getHeaders().getFirst("Content-Encoding")); + properties.setContentLanguage(response.getHeaders().getFirst("Content-Language")); + properties.setCacheControl(response.getHeaders().getFirst("Cache-Control")); + + properties.setEtag(response.getHeaders().getFirst("Etag")); + if (response.getHeaders().containsKey("x-ms-blob-sequence-number")) { + properties.setSequenceNumber(Long.parseLong(response.getHeaders().getFirst("x-ms-blob-sequence-number"))); + } + + // Metadata + HashMap metadata = getMetadataFromHeaders(response); + + // Result + GetBlobPropertiesResult result = new GetBlobPropertiesResult(); + result.setMetadata(metadata); + result.setProperties(properties); + return result; + } + + private WebResource getResource(BlobServiceOptions options) { + WebResource webResource = channel.resource(url).path("/"); + webResource = addOptionalQueryParam(webResource, "timeout", options.getTimeout()); + for (ServiceFilter filter : filters) { + webResource.addFilter(new ClientFilterAdapter(filter)); + } + + return webResource; + } + + private String getCopyBlobSourceName(String sourceContainer, String sourceBlob, CopyBlobOptions options) { + // Specifies the name of the source blob, in one of the following + // formats: + // Blob in named container: /accountName/containerName/blobName + // + // Snapshot in named container: + // /accountName/containerName/blobName?snapshot= + // + // Blob in root container: /accountName/blobName + // + // Snapshot in root container: /accountName/blobName?snapshot= + String sourceName = "/" + this.accountName; + if (sourceContainer != null) { + sourceName += "/" + sourceContainer; + } + sourceName += "/" + sourceBlob; + if (options.getSourceSnapshot() != null) { + sourceName += "?snapshot=" + options.getSourceSnapshot(); + } + return sourceName; + } + + @Override + public GetServicePropertiesResult getServiceProperties() throws ServiceException { + return getServiceProperties(new BlobServiceOptions()); + } + + @Override + public GetServicePropertiesResult getServiceProperties(BlobServiceOptions options) throws ServiceException { + WebResource webResource = getResource(options).path("/").queryParam("resType", "service") + .queryParam("comp", "properties"); + + WebResource.Builder builder = webResource.header("x-ms-version", API_VERSION); + + GetServicePropertiesResult result = new GetServicePropertiesResult(); + result.setValue(builder.get(ServiceProperties.class)); + return result; + } + + @Override + public void setServiceProperties(ServiceProperties serviceProperties) throws ServiceException { + setServiceProperties(serviceProperties, new BlobServiceOptions()); + } + + @Override + public void setServiceProperties(ServiceProperties serviceProperties, BlobServiceOptions options) + throws ServiceException { + WebResource webResource = getResource(options).path("/").queryParam("resType", "service") + .queryParam("comp", "properties"); + + WebResource.Builder builder = webResource.header("x-ms-version", API_VERSION); + + builder.put(serviceProperties); + } + + @Override + public void createContainer(String container) throws ServiceException { + createContainer(container, new CreateContainerOptions()); + } + + @Override + public void createContainer(String container, CreateContainerOptions options) throws ServiceException { + if (container == null || container.isEmpty()) { + throw new IllegalArgumentException("The container cannot be null or empty."); + } + WebResource webResource = getResource(options).path(container).queryParam("resType", "container"); + + WebResource.Builder builder = webResource.header("x-ms-version", API_VERSION); + builder = addOptionalMetadataHeader(builder, options.getMetadata()); + builder = addOptionalHeader(builder, "x-ms-blob-public-access", options.getPublicAccess()); + + builder.put(); + } + + @Override + public void deleteContainer(String container) throws ServiceException { + deleteContainer(container, new DeleteContainerOptions()); + } + + @Override + public void deleteContainer(String container, DeleteContainerOptions options) throws ServiceException { + if ((container == null) || (container.isEmpty())) { + throw new IllegalArgumentException("The root container has already been created."); + } + WebResource webResource = getResource(options).path(container).queryParam("resType", "container"); + + WebResource.Builder builder = webResource.header("x-ms-version", API_VERSION); + builder = addOptionalAccessConditionHeader(builder, options.getAccessCondition()); + + builder.delete(); + } + + @Override + public GetContainerPropertiesResult getContainerProperties(String container) throws ServiceException { + return getContainerProperties(container, new BlobServiceOptions()); + } + + @Override + public GetContainerPropertiesResult getContainerProperties(String container, BlobServiceOptions options) + throws ServiceException { + return getContainerPropertiesImpl(container, options, null); + } + + @Override + public GetContainerPropertiesResult getContainerMetadata(String container) throws ServiceException { + return getContainerMetadata(container, new BlobServiceOptions()); + } + + @Override + public GetContainerPropertiesResult getContainerMetadata(String container, BlobServiceOptions options) + throws ServiceException { + return getContainerPropertiesImpl(container, options, "metadata"); + } + + private GetContainerPropertiesResult getContainerPropertiesImpl(String container, BlobServiceOptions options, + String operation) throws ServiceException { + String path = createPathFromContainer(container); + WebResource webResource = getResource(options).path(path).queryParam("resType", "container"); + webResource = addOptionalQueryParam(webResource, "comp", operation); + + Builder builder = webResource.header("x-ms-version", API_VERSION); + + ClientResponse response = builder.get(ClientResponse.class); + ThrowIfError(response); + + GetContainerPropertiesResult properties = new GetContainerPropertiesResult(); + properties.setEtag(response.getHeaders().getFirst("ETag")); + properties.setLastModified(dateMapper.parse(response.getHeaders().getFirst("Last-Modified"))); + properties.setMetadata(getMetadataFromHeaders(response)); + + return properties; + } + + @Override + public GetContainerACLResult getContainerACL(String container) throws ServiceException { + return getContainerACL(container, new BlobServiceOptions()); + } + + @Override + public GetContainerACLResult getContainerACL(String container, BlobServiceOptions options) throws ServiceException { + String path = createPathFromContainer(container); + WebResource webResource = getResource(options).path(path).queryParam("resType", "container") + .queryParam("comp", "acl"); + + Builder builder = webResource.header("x-ms-version", API_VERSION); + + ClientResponse response = builder.get(ClientResponse.class); + ThrowIfError(response); + + ContainerACL.SignedIdentifiers si = response.getEntity(ContainerACL.SignedIdentifiers.class); + ContainerACL acl = new ContainerACL(); + acl.setSignedIdentifiers(si.getSignedIdentifiers()); + if ("container".equals(response.getHeaders().getFirst("x-ms-blob-public-access"))) { + acl.setPublicAccess(PublicAccessType.CONTAINER_AND_BLOBS); + } + else if ("blob".equals(response.getHeaders().getFirst("x-ms-blob-public-access"))) { + acl.setPublicAccess(PublicAccessType.BLOBS_ONLY); + } + else { + acl.setPublicAccess(PublicAccessType.NONE); + } + acl.setEtag(response.getHeaders().getFirst("ETag")); + acl.setLastModified(dateMapper.parse(response.getHeaders().getFirst("Last-Modified"))); + + GetContainerACLResult result = new GetContainerACLResult(); + result.setValue(acl); + return result; + } + + @Override + public void setContainerACL(String container, ContainerACL acl) throws ServiceException { + setContainerACL(container, acl, new BlobServiceOptions()); + } + + @Override + public void setContainerACL(String container, ContainerACL acl, BlobServiceOptions options) throws ServiceException { + String path = createPathFromContainer(container); + WebResource webResource = getResource(options).path(path).queryParam("resType", "container") + .queryParam("comp", "acl"); + + Builder builder = webResource.header("x-ms-version", API_VERSION); + if (acl.getPublicAccess() == PublicAccessType.BLOBS_ONLY) { + builder = addOptionalHeader(builder, "x-ms-blob-public-access", "blob"); + } + else if (acl.getPublicAccess() == PublicAccessType.CONTAINER_AND_BLOBS) { + builder = addOptionalHeader(builder, "x-ms-blob-public-access", "container"); + } + + ContainerACL.SignedIdentifiers si = new ContainerACL.SignedIdentifiers(); + si.setSignedIdentifiers(acl.getSignedIdentifiers()); + + builder.put(si); + } + + @Override + public void setContainerMetadata(String container, HashMap metadata) throws ServiceException { + setContainerMetadata(container, metadata, new SetContainerMetadataOptions()); + } + + @Override + public void setContainerMetadata(String container, HashMap metadata, + SetContainerMetadataOptions options) throws ServiceException { + String path = createPathFromContainer(container); + WebResource webResource = getResource(options).path(path).queryParam("resType", "container") + .queryParam("comp", "metadata"); + + WebResource.Builder builder = webResource.header("x-ms-version", API_VERSION); + builder = addOptionalMetadataHeader(builder, metadata); + builder = addOptionalAccessConditionHeader(builder, options.getAccessCondition()); + + builder.put(""); + } + + @Override + public ListContainersResult listContainers() throws ServiceException { + return listContainers(new ListContainersOptions()); + } + + @Override + public ListContainersResult listContainers(ListContainersOptions options) throws ServiceException { + WebResource webResource = getResource(options).path("/").queryParam("comp", "list"); + webResource = addOptionalQueryParam(webResource, "prefix", options.getPrefix()); + webResource = addOptionalQueryParam(webResource, "marker", options.getMarker()); + webResource = addOptionalQueryParam(webResource, "maxresults", options.getMaxResults(), 0); + webResource = addOptionalContainerIncludeQueryParam(options, webResource); + + Builder builder = webResource.header("x-ms-version", API_VERSION); + + return builder.get(ListContainersResult.class); + } + + @Override + public ListBlobsResult listBlobs(String container) throws ServiceException { + return listBlobs(container, new ListBlobsOptions()); + } + + @Override + public ListBlobsResult listBlobs(String container, ListBlobsOptions options) throws ServiceException { + String path = createPathFromContainer(container); + WebResource webResource = getResource(options).path(path).queryParam("comp", "list") + .queryParam("resType", "container"); + webResource = addOptionalQueryParam(webResource, "prefix", options.getPrefix()); + webResource = addOptionalQueryParam(webResource, "marker", options.getMarker()); + webResource = addOptionalQueryParam(webResource, "maxresults", options.getMaxResults(), 0); + webResource = addOptionalQueryParam(webResource, "delimiter", options.getDelimiter()); + webResource = addOptionalBlobListingIncludeQueryParam(options, webResource); + + Builder builder = webResource.header("x-ms-version", API_VERSION); + + return builder.get(ListBlobsResult.class); + } + + @Override + public CreateBlobResult createPageBlob(String container, String blob, long length) throws ServiceException { + return createPageBlob(container, blob, length, new CreateBlobOptions()); + } + + @Override + public CreateBlobResult createPageBlob(String container, String blob, long length, CreateBlobOptions options) + throws ServiceException { + String path = createPathFromContainer(container); + WebResource webResource = getResource(options).path(path).path(blob); + + Builder builder = webResource.header("x-ms-version", API_VERSION); + builder = addOptionalHeader(builder, "x-ms-blob-type", "PageBlob"); + builder = addOptionalHeader(builder, "Content-Length", 0); + builder = addOptionalHeader(builder, "x-ms-blob-content-length", length); + builder = addOptionalHeader(builder, "x-ms-blob-sequence-number", options.getSequenceNumber()); + builder = addPutBlobHeaders(options, builder); + + ClientResponse clientResponse = builder.put(ClientResponse.class, ""); + ThrowIfError(clientResponse); + + CreateBlobResult createBlobResult = new CreateBlobResult(); + createBlobResult.setEtag(clientResponse.getHeaders().getFirst("ETag")); + createBlobResult.setLastModified(dateMapper.parse(clientResponse.getHeaders().getFirst("Last-Modified"))); + + return createBlobResult; + } + + @Override + public CreateBlobResult createBlockBlob(String container, String blob, InputStream contentStream) + throws ServiceException { + return createBlockBlob(container, blob, contentStream, new CreateBlobOptions()); + } + + @Override + public CreateBlobResult createBlockBlob(String container, String blob, InputStream contentStream, + CreateBlobOptions options) throws ServiceException { + String path = createPathFromContainer(container); + System.out.println(path); + WebResource webResource = getResource(options).path(path).path(blob); + + Builder builder = webResource.header("x-ms-version", API_VERSION); + + builder = builder.header("x-ms-blob-type", "BlockBlob"); + builder = addPutBlobHeaders(options, builder); + + Object contentObject = (contentStream == null ? new byte[0] : contentStream); + ClientResponse clientResponse = builder.put(ClientResponse.class, contentObject); + ThrowIfError(clientResponse); + + CreateBlobResult createBlobResult = new CreateBlobResult(); + createBlobResult.setEtag(clientResponse.getHeaders().getFirst("ETag")); + createBlobResult.setLastModified(dateMapper.parse(clientResponse.getHeaders().getFirst("Last-Modified"))); + + return createBlobResult; + } + + @Override + public GetBlobPropertiesResult getBlobProperties(String container, String blob) throws ServiceException { + return getBlobProperties(container, blob, new GetBlobPropertiesOptions()); + } + + @Override + public GetBlobPropertiesResult getBlobProperties(String container, String blob, GetBlobPropertiesOptions options) + throws ServiceException { + String path = createPathFromContainer(container); + WebResource webResource = getResource(options).path(path).path(blob); + webResource = addOptionalQueryParam(webResource, "snapshot", options.getSnapshot()); + + Builder builder = webResource.header("x-ms-version", API_VERSION); + builder = addOptionalHeader(builder, "x-ms-lease-id", options.getLeaseId()); + builder = addOptionalAccessConditionHeader(builder, options.getAccessCondition()); + + ClientResponse response = builder.method("HEAD", ClientResponse.class); + ThrowIfNotSuccess(response); + + return getBlobPropertiesResultFromResponse(response); + } + + @Override + public GetBlobMetadataResult getBlobMetadata(String container, String blob) throws ServiceException { + return getBlobMetadata(container, blob, new GetBlobMetadataOptions()); + } + + @Override + public GetBlobMetadataResult getBlobMetadata(String container, String blob, GetBlobMetadataOptions options) + throws ServiceException { + String path = createPathFromContainer(container); + WebResource webResource = getResource(options).path(path).path(blob).queryParam("comp", "metadata"); + webResource = addOptionalQueryParam(webResource, "snapshot", options.getSnapshot()); + + Builder builder = webResource.header("x-ms-version", API_VERSION); + builder = addOptionalHeader(builder, "x-ms-lease-id", options.getLeaseId()); + builder = addOptionalAccessConditionHeader(builder, options.getAccessCondition()); + + ClientResponse response = builder.get(ClientResponse.class); + ThrowIfError(response); + + GetBlobMetadataResult properties = new GetBlobMetadataResult(); + properties.setEtag(response.getHeaders().getFirst("ETag")); + properties.setLastModified(dateMapper.parse(response.getHeaders().getFirst("Last-Modified"))); + properties.setMetadata(getMetadataFromHeaders(response)); + + return properties; + } + + @Override + public SetBlobPropertiesResult setBlobProperties(String container, String blob, SetBlobPropertiesOptions options) + throws ServiceException { + String path = createPathFromContainer(container); + WebResource webResource = getResource(options).path(path).path(blob).queryParam("comp", "properties"); + + WebResource.Builder builder = webResource.header("x-ms-version", API_VERSION); + builder = addOptionalHeader(builder, "x-ms-blob-cache-control", options.getCacheControl()); + builder = addOptionalHeader(builder, "x-ms-blob-content-type", options.getContentType()); + builder = addOptionalHeader(builder, "x-ms-blob-content-md5", options.getContentMD5()); + builder = addOptionalHeader(builder, "x-ms-blob-content-encoding", options.getContentEncoding()); + builder = addOptionalHeader(builder, "x-ms-blob-content-language", options.getContentLanguage()); + builder = addOptionalHeader(builder, "x-ms-blob-content-length", options.getContentLength()); + builder = addOptionalHeader(builder, "x-ms-sequence-number-action", options.getSequenceNumberAction()); + builder = addOptionalHeader(builder, "x-ms-blob-sequence-number", options.getSequenceNumber()); + builder = addOptionalHeader(builder, "x-ms-lease-id", options.getLeaseId()); + builder = addOptionalAccessConditionHeader(builder, options.getAccessCondition()); + + ClientResponse response = builder.put(ClientResponse.class, ""); + ThrowIfError(response); + + SetBlobPropertiesResult result = new SetBlobPropertiesResult(); + + result.setEtag(response.getHeaders().getFirst("ETag")); + result.setLastModified(dateMapper.parse(response.getHeaders().getFirst("Last-Modified"))); + if (response.getHeaders().getFirst("x-ms-blob-sequence-number") != null) { + result.setSequenceNumber(Long.parseLong(response.getHeaders().getFirst("x-ms-blob-sequence-number"))); + } + + return result; + } + + @Override + public SetBlobMetadataResult setBlobMetadata(String container, String blob, HashMap metadata) + throws ServiceException { + return setBlobMetadata(container, blob, metadata, new SetBlobMetadataOptions()); + } + + @Override + public SetBlobMetadataResult setBlobMetadata(String container, String blob, HashMap metadata, + SetBlobMetadataOptions options) throws ServiceException { + String path = createPathFromContainer(container); + WebResource webResource = getResource(options).path(path).path(blob).queryParam("comp", "metadata"); + + WebResource.Builder builder = webResource.header("x-ms-version", API_VERSION); + builder = addOptionalHeader(builder, "x-ms-lease-id", options.getLeaseId()); + builder = addOptionalMetadataHeader(builder, metadata); + builder = addOptionalAccessConditionHeader(builder, options.getAccessCondition()); + + ClientResponse response = builder.put(ClientResponse.class, ""); + ThrowIfError(response); + + SetBlobMetadataResult result = new SetBlobMetadataResult(); + result.setEtag(response.getHeaders().getFirst("ETag")); + result.setLastModified(dateMapper.parse(response.getHeaders().getFirst("Last-Modified"))); + return result; + } + + @Override + public GetBlobResult getBlob(String container, String blob) throws ServiceException { + return getBlob(container, blob, new GetBlobOptions()); + } + + @Override + public GetBlobResult getBlob(String container, String blob, GetBlobOptions options) throws ServiceException { + String path = createPathFromContainer(container); + WebResource webResource = getResource(options).path(path).path(blob); + webResource = addOptionalQueryParam(webResource, "snapshot", options.getSnapshot()); + + Builder builder = webResource.header("x-ms-version", API_VERSION); + builder = addOptionalHeader(builder, "x-ms-lease-id", options.getLeaseId()); + builder = addOptionalRangeHeader(builder, options.getRangeStart(), options.getRangeEnd()); + builder = addOptionalAccessConditionHeader(builder, options.getAccessCondition()); + if (options.isComputeRangeMD5()) { + builder = addOptionalHeader(builder, "x-ms-range-get-content-md5", "true"); + } + + ClientResponse response = builder.get(ClientResponse.class); + ThrowIfNotSuccess(response); + + GetBlobPropertiesResult properties = getBlobPropertiesResultFromResponse(response); + GetBlobResult blobResult = new GetBlobResult(); + blobResult.setProperties(properties.getProperties()); + blobResult.setMetadata(properties.getMetadata()); + blobResult.setContentStream(response.getEntityInputStream()); + return blobResult; + } + + @Override + public void deleteBlob(String container, String blob) throws ServiceException { + deleteBlob(container, blob, new DeleteBlobOptions()); + } + + @Override + public void deleteBlob(String container, String blob, DeleteBlobOptions options) throws ServiceException { + String path = createPathFromContainer(container); + WebResource webResource = getResource(options).path(path).path(blob); + webResource = addOptionalQueryParam(webResource, "snapshot", options.getSnapshot()); + + Builder builder = webResource.header("x-ms-version", API_VERSION); + builder = addOptionalHeader(builder, "x-ms-lease-id", options.getLeaseId()); + if (options.getDeleteSnaphotsOnly() != null) { + builder = addOptionalHeader(builder, "x-ms-delete-snapshots", options.getDeleteSnaphotsOnly() ? "only" + : "include"); + } + builder = addOptionalAccessConditionHeader(builder, options.getAccessCondition()); + + builder.delete(); + } + + @Override + public CreateBlobSnapshotResult createBlobSnapshot(String container, String blob) throws ServiceException { + return createBlobSnapshot(container, blob, new CreateBlobSnapshotOptions()); + } + + @Override + public CreateBlobSnapshotResult createBlobSnapshot(String container, String blob, CreateBlobSnapshotOptions options) + throws ServiceException { + String path = createPathFromContainer(container); + WebResource webResource = getResource(options).path(path).path(blob).queryParam("comp", "snapshot"); + + Builder builder = webResource.header("x-ms-version", API_VERSION); + builder = addOptionalHeader(builder, "x-ms-lease-id", options.getLeaseId()); + builder = addOptionalMetadataHeader(builder, options.getMetadata()); + builder = addOptionalAccessConditionHeader(builder, options.getAccessCondition()); + + ClientResponse response = builder.put(ClientResponse.class, ""); + ThrowIfError(response); + + CreateBlobSnapshotResult blobSnapshot = new CreateBlobSnapshotResult(); + blobSnapshot.setEtag(response.getHeaders().getFirst("ETag")); + blobSnapshot.setSnapshot(response.getHeaders().getFirst("x-ms-snapshot")); + blobSnapshot.setLastModified(dateMapper.parse(response.getHeaders().getFirst("Last-Modified"))); + + return blobSnapshot; + } + + @Override + public CopyBlobResult copyBlob(String destinationContainer, String destinationBlob, String sourceContainer, + String sourceBlob) throws ServiceException { + return copyBlob(destinationContainer, destinationBlob, sourceContainer, sourceBlob, new CopyBlobOptions()); + } + + @Override + public CopyBlobResult copyBlob(String destinationContainer, String destinationBlob, String sourceContainer, + String sourceBlob, CopyBlobOptions options) { + String path = createPathFromContainer(destinationContainer); + WebResource webResource = getResource(options).path(path).path(destinationBlob); + + Builder builder = webResource.header("x-ms-version", API_VERSION); + builder = addOptionalHeader(builder, "x-ms-lease-id", options.getLeaseId()); + builder = addOptionalHeader(builder, "x-ms-source-lease-id", options.getSourceLeaseId()); + builder = addOptionalHeader(builder, "x-ms-copy-source", + getCopyBlobSourceName(sourceContainer, sourceBlob, options)); + builder = addOptionalMetadataHeader(builder, options.getMetadata()); + builder = addOptionalAccessConditionHeader(builder, options.getAccessCondition()); + builder = addOptionalSourceAccessConditionHeader(builder, options.getSourceAccessCondition()); + + ClientResponse clientResponse = builder.put(ClientResponse.class, ""); + ThrowIfError(clientResponse); + + CopyBlobResult copyBlobResult = new CopyBlobResult(); + copyBlobResult.setEtag(clientResponse.getHeaders().getFirst("ETag")); + copyBlobResult.setLastModified(dateMapper.parse(clientResponse.getHeaders().getFirst("Last-Modified"))); + + return copyBlobResult; + } + + @Override + public AcquireLeaseResult acquireLease(String container, String blob) throws ServiceException { + return acquireLease(container, blob, new AcquireLeaseOptions()); + } + + @Override + public AcquireLeaseResult acquireLease(String container, String blob, AcquireLeaseOptions options) + throws ServiceException { + return putLeaseImpl("acquire", container, blob, null/* leaseId */, options, options.getAccessCondition()); + } + + @Override + public AcquireLeaseResult renewLease(String container, String blob, String leaseId) throws ServiceException { + return renewLease(container, blob, leaseId, new BlobServiceOptions()); + } + + @Override + public AcquireLeaseResult renewLease(String container, String blob, String leaseId, BlobServiceOptions options) + throws ServiceException { + return putLeaseImpl("renew", container, blob, leaseId, options, null/* accessCondition */); + } + + @Override + public void releaseLease(String container, String blob, String leaseId) throws ServiceException { + releaseLease(container, blob, leaseId, new BlobServiceOptions()); + } + + @Override + public void releaseLease(String container, String blob, String leaseId, BlobServiceOptions options) + throws ServiceException { + putLeaseImpl("release", container, blob, leaseId, options, null/* accessCondition */); + } + + @Override + public void breakLease(String container, String blob, String leaseId) throws ServiceException { + breakLease(container, blob, leaseId, new BlobServiceOptions()); + } + + @Override + public void breakLease(String container, String blob, String leaseId, BlobServiceOptions options) + throws ServiceException { + putLeaseImpl("break", container, blob, leaseId, options, null/* accessCondition */); + } + + private AcquireLeaseResult putLeaseImpl(String leaseAction, String container, String blob, String leaseId, + BlobServiceOptions options, AccessCondition accessCondition) throws ServiceException { + String path = createPathFromContainer(container); + WebResource webResource = getResource(options).path(path).path(blob).queryParam("comp", "lease"); + + Builder builder = webResource.header("x-ms-version", API_VERSION); + builder = addOptionalHeader(builder, "x-ms-lease-id", leaseId); + builder = addOptionalHeader(builder, "x-ms-lease-action", leaseAction); + builder = addOptionalAccessConditionHeader(builder, accessCondition); + + // Note: Add content type here to enable proper HMAC signing + ClientResponse response = builder.put(ClientResponse.class, ""); + ThrowIfError(response); + + AcquireLeaseResult result = new AcquireLeaseResult(); + result.setLeaseId(response.getHeaders().getFirst("x-ms-lease-id")); + return result; + } + + @Override + public CreateBlobPagesResult clearBlobPages(String container, String blob, PageRange range) throws ServiceException { + return clearBlobPages(container, blob, range, new CreateBlobPagesOptions()); + } + + @Override + public CreateBlobPagesResult clearBlobPages(String container, String blob, PageRange range, + CreateBlobPagesOptions options) throws ServiceException { + return updatePageBlobPagesImpl("clear", container, blob, range, 0, null, options); + } + + @Override + public CreateBlobPagesResult createBlobPages(String container, String blob, PageRange range, long length, + InputStream contentStream) throws ServiceException { + return createBlobPages(container, blob, range, length, contentStream, new CreateBlobPagesOptions()); + } + + @Override + public CreateBlobPagesResult createBlobPages(String container, String blob, PageRange range, long length, + InputStream contentStream, CreateBlobPagesOptions options) throws ServiceException { + return updatePageBlobPagesImpl("update", container, blob, range, length, contentStream, options); + } + + private CreateBlobPagesResult updatePageBlobPagesImpl(String action, String container, String blob, + PageRange range, long length, InputStream contentStream, CreateBlobPagesOptions options) + throws ServiceException { + String path = createPathFromContainer(container); + WebResource webResource = getResource(options).path(path).path(blob).queryParam("comp", "page"); + + Builder builder = webResource.header("x-ms-version", API_VERSION); + builder = addOptionalRangeHeader(builder, range.getStart(), range.getEnd()); + builder = addOptionalHeader(builder, "Content-Length", length); + builder = addOptionalHeader(builder, "Content-MD5", options.getContentMD5()); + builder = addOptionalHeader(builder, "x-ms-lease-id", options.getLeaseId()); + builder = addOptionalHeader(builder, "x-ms-page-write", action); + builder = addOptionalAccessConditionHeader(builder, options.getAccessCondition()); + + Object contentObject = (contentStream == null ? new byte[0] : contentStream); + ClientResponse response = builder.put(ClientResponse.class, contentObject); + ThrowIfError(response); + + CreateBlobPagesResult result = new CreateBlobPagesResult(); + result.setEtag(response.getHeaders().getFirst("ETag")); + result.setLastModified(dateMapper.parse(response.getHeaders().getFirst("Last-Modified"))); + result.setContentMD5(response.getHeaders().getFirst("Content-MD5")); + result.setSequenceNumber(Long.parseLong(response.getHeaders().getFirst("x-ms-blob-sequence-number"))); + + return result; + } + + @Override + public ListBlobRegionsResult listBlobRegions(String container, String blob) throws ServiceException { + return listBlobRegions(container, blob, new ListBlobRegionsOptions()); + } + + @Override + public ListBlobRegionsResult listBlobRegions(String container, String blob, ListBlobRegionsOptions options) + throws ServiceException { + String path = createPathFromContainer(container); + WebResource webResource = getResource(options).path(path).path(blob).queryParam("comp", "pagelist"); + + Builder builder = webResource.header("x-ms-version", API_VERSION); + builder = addOptionalRangeHeader(builder, options.getRangeStart(), options.getRangeEnd()); + builder = addOptionalHeader(builder, "x-ms-lease-id", options.getLeaseId()); + builder = addOptionalAccessConditionHeader(builder, options.getAccessCondition()); + + ClientResponse response = builder.get(ClientResponse.class); + ThrowIfError(response); + + ListBlobRegionsResult result = response.getEntity(ListBlobRegionsResult.class); + result.setEtag(response.getHeaders().getFirst("ETag")); + result.setContentLength(Long.parseLong(response.getHeaders().getFirst("x-ms-blob-content-length"))); + result.setLastModified(dateMapper.parse(response.getHeaders().getFirst("Last-Modified"))); + + return result; + } + + @Override + public void createBlobBlock(String container, String blob, String blockId, InputStream contentStream) + throws ServiceException { + createBlobBlock(container, blob, blockId, contentStream, new CreateBlobBlockOptions()); + } + + @Override + public void createBlobBlock(String container, String blob, String blockId, InputStream contentStream, + CreateBlobBlockOptions options) throws ServiceException { + String path = createPathFromContainer(container); + WebResource webResource = getResource(options).path(path).path(blob).queryParam("comp", "block"); + webResource = addOptionalQueryParam(webResource, "blockid", new String(Base64.encode(blockId))); + + Builder builder = webResource.header("x-ms-version", API_VERSION); + builder = addOptionalHeader(builder, "x-ms-lease-id", options.getLeaseId()); + builder = addOptionalHeader(builder, "Content-MD5", options.getContentMD5()); + + builder.put(contentStream); + } + + @Override + public void commitBlobBlocks(String container, String blob, BlockList blockList) throws ServiceException { + commitBlobBlocks(container, blob, blockList, new CommitBlobBlocksOptions()); + } + + @Override + public void commitBlobBlocks(String container, String blob, BlockList blockList, CommitBlobBlocksOptions options) + throws ServiceException { + String path = createPathFromContainer(container); + WebResource webResource = getResource(options).path(path).path(blob).queryParam("comp", "blocklist"); + + Builder builder = webResource.header("x-ms-version", API_VERSION); + builder = addOptionalHeader(builder, "x-ms-lease-id", options.getLeaseId()); + builder = addOptionalHeader(builder, "x-ms-blob-cache-control", options.getBlobCacheControl()); + builder = addOptionalHeader(builder, "x-ms-blob-content-type", options.getBlobContentType()); + builder = addOptionalHeader(builder, "x-ms-blob-content-encoding", options.getBlobContentEncoding()); + builder = addOptionalHeader(builder, "x-ms-blob-content-language", options.getBlobContentLanguage()); + builder = addOptionalHeader(builder, "x-ms-blob-content-md5", options.getBlobContentMD5()); + builder = addOptionalMetadataHeader(builder, options.getMetadata()); + builder = addOptionalAccessConditionHeader(builder, options.getAccessCondition()); + + builder.put(blockList); + } + + @Override + public ListBlobBlocksResult listBlobBlocks(String container, String blob) throws ServiceException { + return listBlobBlocks(container, blob, new ListBlobBlocksOptions()); + } + + @Override + public ListBlobBlocksResult listBlobBlocks(String container, String blob, ListBlobBlocksOptions options) + throws ServiceException { + String path = createPathFromContainer(container); + WebResource webResource = getResource(options).path(path).path(blob).queryParam("comp", "blocklist"); + webResource = addOptionalQueryParam(webResource, "snapshot", options.getSnapshot()); + if (options.isCommittedList() && options.isUncommittedList()) { + webResource = addOptionalQueryParam(webResource, "blocklisttype", "all"); + } + else if (options.isCommittedList()) { + webResource = addOptionalQueryParam(webResource, "blocklisttype", "committed"); + } + else if (options.isUncommittedList()) { + webResource = addOptionalQueryParam(webResource, "blocklisttype", "uncommitted"); + } + + Builder builder = webResource.header("x-ms-version", API_VERSION); + builder = addOptionalHeader(builder, "x-ms-lease-id", options.getLeaseId()); + + ClientResponse response = builder.get(ClientResponse.class); + ThrowIfError(response); + + ListBlobBlocksResult result = response.getEntity(ListBlobBlocksResult.class); + result.setEtag(response.getHeaders().getFirst("ETag")); + result.setContentType(response.getHeaders().getFirst("Content-Type")); + + String blobContentLength = response.getHeaders().getFirst("x-ms-blob-content-length"); + if (blobContentLength != null) { + result.setContentLength(Long.parseLong(blobContentLength)); + } + else { + result.setContentLength(0); + } + + String lastModified = response.getHeaders().getFirst("Last-Modified"); + if (lastModified != null) { + result.setLastModified(dateMapper.parse(lastModified)); + } + + return result; + } + + private String createPathFromContainer(String containerName) { + String path; + if (containerName == null || containerName.isEmpty()) { + path = "$root"; + } + else { + path = containerName; + } + return path; + } + +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/BlobRestProxy.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/BlobRestProxy.java index 1a8d830c20df..bb628ea9d72f 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/BlobRestProxy.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/BlobRestProxy.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. @@ -14,993 +14,41 @@ */ package com.microsoft.windowsazure.services.blob.implementation; -import java.io.InputStream; import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; import javax.inject.Inject; import javax.inject.Named; import com.microsoft.windowsazure.services.blob.BlobConfiguration; import com.microsoft.windowsazure.services.blob.BlobContract; -import com.microsoft.windowsazure.services.blob.models.AccessCondition; -import com.microsoft.windowsazure.services.blob.models.AcquireLeaseOptions; -import com.microsoft.windowsazure.services.blob.models.AcquireLeaseResult; -import com.microsoft.windowsazure.services.blob.models.BlobProperties; -import com.microsoft.windowsazure.services.blob.models.BlobServiceOptions; -import com.microsoft.windowsazure.services.blob.models.BlockList; -import com.microsoft.windowsazure.services.blob.models.CommitBlobBlocksOptions; -import com.microsoft.windowsazure.services.blob.models.ContainerACL; -import com.microsoft.windowsazure.services.blob.models.ContainerACL.PublicAccessType; -import com.microsoft.windowsazure.services.blob.models.CopyBlobOptions; -import com.microsoft.windowsazure.services.blob.models.CopyBlobResult; -import com.microsoft.windowsazure.services.blob.models.CreateBlobBlockOptions; -import com.microsoft.windowsazure.services.blob.models.CreateBlobOptions; -import com.microsoft.windowsazure.services.blob.models.CreateBlobPagesOptions; -import com.microsoft.windowsazure.services.blob.models.CreateBlobPagesResult; -import com.microsoft.windowsazure.services.blob.models.CreateBlobResult; -import com.microsoft.windowsazure.services.blob.models.CreateBlobSnapshotOptions; -import com.microsoft.windowsazure.services.blob.models.CreateBlobSnapshotResult; -import com.microsoft.windowsazure.services.blob.models.CreateContainerOptions; -import com.microsoft.windowsazure.services.blob.models.DeleteBlobOptions; -import com.microsoft.windowsazure.services.blob.models.DeleteContainerOptions; -import com.microsoft.windowsazure.services.blob.models.GetBlobMetadataOptions; -import com.microsoft.windowsazure.services.blob.models.GetBlobMetadataResult; -import com.microsoft.windowsazure.services.blob.models.GetBlobOptions; -import com.microsoft.windowsazure.services.blob.models.GetBlobPropertiesOptions; -import com.microsoft.windowsazure.services.blob.models.GetBlobPropertiesResult; -import com.microsoft.windowsazure.services.blob.models.GetBlobResult; -import com.microsoft.windowsazure.services.blob.models.GetContainerACLResult; -import com.microsoft.windowsazure.services.blob.models.GetContainerPropertiesResult; -import com.microsoft.windowsazure.services.blob.models.GetServicePropertiesResult; -import com.microsoft.windowsazure.services.blob.models.ListBlobBlocksOptions; -import com.microsoft.windowsazure.services.blob.models.ListBlobBlocksResult; -import com.microsoft.windowsazure.services.blob.models.ListBlobRegionsOptions; -import com.microsoft.windowsazure.services.blob.models.ListBlobRegionsResult; -import com.microsoft.windowsazure.services.blob.models.ListBlobsOptions; -import com.microsoft.windowsazure.services.blob.models.ListBlobsResult; -import com.microsoft.windowsazure.services.blob.models.ListContainersOptions; -import com.microsoft.windowsazure.services.blob.models.ListContainersResult; -import com.microsoft.windowsazure.services.blob.models.PageRange; -import com.microsoft.windowsazure.services.blob.models.ServiceProperties; -import com.microsoft.windowsazure.services.blob.models.SetBlobMetadataOptions; -import com.microsoft.windowsazure.services.blob.models.SetBlobMetadataResult; -import com.microsoft.windowsazure.services.blob.models.SetBlobPropertiesOptions; -import com.microsoft.windowsazure.services.blob.models.SetBlobPropertiesResult; -import com.microsoft.windowsazure.services.blob.models.SetContainerMetadataOptions; -import com.microsoft.windowsazure.services.core.ServiceException; import com.microsoft.windowsazure.services.core.ServiceFilter; -import com.microsoft.windowsazure.services.core.utils.CommaStringBuilder; -import com.microsoft.windowsazure.services.core.utils.pipeline.ClientFilterAdapter; import com.microsoft.windowsazure.services.core.utils.pipeline.HttpURLConnectionClient; -import com.microsoft.windowsazure.services.core.utils.pipeline.PipelineHelpers; -import com.sun.jersey.api.client.ClientResponse; -import com.sun.jersey.api.client.WebResource; -import com.sun.jersey.api.client.WebResource.Builder; -import com.sun.jersey.core.util.Base64; +import com.sun.jersey.api.client.Client; -public class BlobRestProxy implements BlobContract { - private static final String API_VERSION = "2011-08-18"; - private final HttpURLConnectionClient channel; - private final String accountName; - private final String url; - private final RFC1123DateConverter dateMapper; - private final ServiceFilter[] filters; +public class BlobRestProxy extends BlobOperationRestProxy implements BlobContract { private final SharedKeyFilter filter; @Inject public BlobRestProxy(HttpURLConnectionClient channel, @Named(BlobConfiguration.ACCOUNT_NAME) String accountName, @Named(BlobConfiguration.URI) String url, SharedKeyFilter filter) { + super(channel, accountName, url); - this.channel = channel; - this.accountName = accountName; - this.url = url; this.filter = filter; - this.dateMapper = new RFC1123DateConverter(); - this.filters = new ServiceFilter[0]; channel.addFilter(filter); } - public BlobRestProxy(HttpURLConnectionClient client, ServiceFilter[] filters, String accountName, String url, + public BlobRestProxy(Client client, ServiceFilter[] filters, String accountName, String url, SharedKeyFilter filter, RFC1123DateConverter dateMapper) { + super(client, filters, accountName, url, dateMapper); - this.channel = client; - this.filters = filters; - this.accountName = accountName; - this.url = url; this.filter = filter; - this.dateMapper = dateMapper; } @Override public BlobContract withFilter(ServiceFilter filter) { - ServiceFilter[] newFilters = Arrays.copyOf(filters, filters.length + 1); - newFilters[filters.length] = filter; - return new BlobRestProxy(this.channel, newFilters, this.accountName, this.url, this.filter, this.dateMapper); - } - - private void ThrowIfError(ClientResponse r) { - PipelineHelpers.ThrowIfError(r); - } - - private void ThrowIfNotSuccess(ClientResponse clientResponse) { - PipelineHelpers.ThrowIfNotSuccess(clientResponse); - } - - private WebResource addOptionalQueryParam(WebResource webResource, String key, Object value) { - return PipelineHelpers.addOptionalQueryParam(webResource, key, value); - } - - private WebResource addOptionalQueryParam(WebResource webResource, String key, int value, int defaultValue) { - return PipelineHelpers.addOptionalQueryParam(webResource, key, value, defaultValue); - } - - private Builder addOptionalHeader(Builder builder, String name, Object value) { - return PipelineHelpers.addOptionalHeader(builder, name, value); - } - - private Builder addOptionalMetadataHeader(Builder builder, Map metadata) { - return PipelineHelpers.addOptionalMetadataHeader(builder, metadata); - } - - private Builder addOptionalRangeHeader(Builder builder, Long rangeStart, Long rangeEnd) { - return PipelineHelpers.addOptionalRangeHeader(builder, rangeStart, rangeEnd); - } - - private Builder addOptionalAccessConditionHeader(Builder builder, AccessCondition accessCondition) { - return PipelineHelpers.addOptionalAccessConditionHeader(builder, accessCondition); - } - - private Builder addOptionalSourceAccessConditionHeader(Builder builder, AccessCondition accessCondition) { - return PipelineHelpers.addOptionalSourceAccessConditionHeader(builder, accessCondition); - } - - private HashMap getMetadataFromHeaders(ClientResponse response) { - return PipelineHelpers.getMetadataFromHeaders(response); - } - - private WebResource addOptionalBlobListingIncludeQueryParam(ListBlobsOptions options, WebResource webResource) { - CommaStringBuilder sb = new CommaStringBuilder(); - sb.addValue(options.isIncludeSnapshots(), "snapshots"); - sb.addValue(options.isIncludeUncommittedBlobs(), "uncommittedblobs"); - sb.addValue(options.isIncludeMetadata(), "metadata"); - webResource = addOptionalQueryParam(webResource, "include", sb.toString()); - return webResource; - } - - private WebResource addOptionalContainerIncludeQueryParam(ListContainersOptions options, WebResource webResource) { - CommaStringBuilder sb = new CommaStringBuilder(); - sb.addValue(options.isIncludeMetadata(), "metadata"); - webResource = addOptionalQueryParam(webResource, "include", sb.toString()); - return webResource; - } - - private Builder addPutBlobHeaders(CreateBlobOptions options, Builder builder) { - builder = addOptionalHeader(builder, "Content-Type", options.getContentType()); - if (options.getContentType() == null) { - // Note: Add content type here to enable proper HMAC signing - builder = builder.type("application/octet-stream"); - } - builder = addOptionalHeader(builder, "Content-Encoding", options.getContentEncoding()); - builder = addOptionalHeader(builder, "Content-Language", options.getContentLanguage()); - builder = addOptionalHeader(builder, "Content-MD5", options.getContentMD5()); - builder = addOptionalHeader(builder, "Cache-Control", options.getCacheControl()); - builder = addOptionalHeader(builder, "x-ms-blob-content-type", options.getBlobContentType()); - builder = addOptionalHeader(builder, "x-ms-blob-content-encoding", options.getBlobContentEncoding()); - builder = addOptionalHeader(builder, "x-ms-blob-content-language", options.getBlobContentLanguage()); - builder = addOptionalHeader(builder, "x-ms-blob-content-md5", options.getBlobContentMD5()); - builder = addOptionalHeader(builder, "x-ms-blob-cache-control", options.getBlobCacheControl()); - builder = addOptionalHeader(builder, "x-ms-lease-id", options.getLeaseId()); - builder = addOptionalMetadataHeader(builder, options.getMetadata()); - builder = addOptionalAccessConditionHeader(builder, options.getAccessCondition()); - - return builder; - } - - private GetBlobPropertiesResult getBlobPropertiesResultFromResponse(ClientResponse response) { - // Properties - BlobProperties properties = new BlobProperties(); - properties.setLastModified(dateMapper.parse(response.getHeaders().getFirst("Last-Modified"))); - properties.setBlobType(response.getHeaders().getFirst("x-ms-blob-type")); - properties.setLeaseStatus(response.getHeaders().getFirst("x-ms-lease-status")); - - properties.setContentLength(Long.parseLong(response.getHeaders().getFirst("Content-Length"))); - properties.setContentType(response.getHeaders().getFirst("Content-Type")); - properties.setContentMD5(response.getHeaders().getFirst("Content-MD5")); - properties.setContentEncoding(response.getHeaders().getFirst("Content-Encoding")); - properties.setContentLanguage(response.getHeaders().getFirst("Content-Language")); - properties.setCacheControl(response.getHeaders().getFirst("Cache-Control")); - - properties.setEtag(response.getHeaders().getFirst("Etag")); - if (response.getHeaders().containsKey("x-ms-blob-sequence-number")) { - properties.setSequenceNumber(Long.parseLong(response.getHeaders().getFirst("x-ms-blob-sequence-number"))); - } - - // Metadata - HashMap metadata = getMetadataFromHeaders(response); - - // Result - GetBlobPropertiesResult result = new GetBlobPropertiesResult(); - result.setMetadata(metadata); - result.setProperties(properties); - return result; - } - - private WebResource getResource(BlobServiceOptions options) { - WebResource webResource = channel.resource(url).path("/"); - webResource = addOptionalQueryParam(webResource, "timeout", options.getTimeout()); - for (ServiceFilter filter : filters) { - webResource.addFilter(new ClientFilterAdapter(filter)); - } - - return webResource; - } - - private String getCopyBlobSourceName(String sourceContainer, String sourceBlob, CopyBlobOptions options) { - // Specifies the name of the source blob, in one of the following - // formats: - // Blob in named container: /accountName/containerName/blobName - // - // Snapshot in named container: - // /accountName/containerName/blobName?snapshot= - // - // Blob in root container: /accountName/blobName - // - // Snapshot in root container: /accountName/blobName?snapshot= - String sourceName = "/" + this.accountName; - if (sourceContainer != null) { - sourceName += "/" + sourceContainer; - } - sourceName += "/" + sourceBlob; - if (options.getSourceSnapshot() != null) { - sourceName += "?snapshot=" + options.getSourceSnapshot(); - } - return sourceName; - } - - @Override - public GetServicePropertiesResult getServiceProperties() throws ServiceException { - return getServiceProperties(new BlobServiceOptions()); - } - - @Override - public GetServicePropertiesResult getServiceProperties(BlobServiceOptions options) throws ServiceException { - WebResource webResource = getResource(options).path("/").queryParam("resType", "service") - .queryParam("comp", "properties"); - - WebResource.Builder builder = webResource.header("x-ms-version", API_VERSION); - - GetServicePropertiesResult result = new GetServicePropertiesResult(); - result.setValue(builder.get(ServiceProperties.class)); - return result; - } - - @Override - public void setServiceProperties(ServiceProperties serviceProperties) throws ServiceException { - setServiceProperties(serviceProperties, new BlobServiceOptions()); - } - - @Override - public void setServiceProperties(ServiceProperties serviceProperties, BlobServiceOptions options) - throws ServiceException { - WebResource webResource = getResource(options).path("/").queryParam("resType", "service") - .queryParam("comp", "properties"); - - WebResource.Builder builder = webResource.header("x-ms-version", API_VERSION); - - builder.put(serviceProperties); - } - - @Override - public void createContainer(String container) throws ServiceException { - createContainer(container, new CreateContainerOptions()); - } - - @Override - public void createContainer(String container, CreateContainerOptions options) throws ServiceException { - if (container == null || container.isEmpty()) { - throw new IllegalArgumentException("The container cannot be null or empty."); - } - WebResource webResource = getResource(options).path(container).queryParam("resType", "container"); - - WebResource.Builder builder = webResource.header("x-ms-version", API_VERSION); - builder = addOptionalMetadataHeader(builder, options.getMetadata()); - builder = addOptionalHeader(builder, "x-ms-blob-public-access", options.getPublicAccess()); - - builder.put(); - } - - @Override - public void deleteContainer(String container) throws ServiceException { - deleteContainer(container, new DeleteContainerOptions()); - } - - @Override - public void deleteContainer(String container, DeleteContainerOptions options) throws ServiceException { - if ((container == null) || (container.isEmpty())) { - throw new IllegalArgumentException("The root container has already been created."); - } - WebResource webResource = getResource(options).path(container).queryParam("resType", "container"); - - WebResource.Builder builder = webResource.header("x-ms-version", API_VERSION); - builder = addOptionalAccessConditionHeader(builder, options.getAccessCondition()); - - builder.delete(); - } - - @Override - public GetContainerPropertiesResult getContainerProperties(String container) throws ServiceException { - return getContainerProperties(container, new BlobServiceOptions()); - } - - @Override - public GetContainerPropertiesResult getContainerProperties(String container, BlobServiceOptions options) - throws ServiceException { - return getContainerPropertiesImpl(container, options, null); - } - - @Override - public GetContainerPropertiesResult getContainerMetadata(String container) throws ServiceException { - return getContainerMetadata(container, new BlobServiceOptions()); - } - - @Override - public GetContainerPropertiesResult getContainerMetadata(String container, BlobServiceOptions options) - throws ServiceException { - return getContainerPropertiesImpl(container, options, "metadata"); - } - - private GetContainerPropertiesResult getContainerPropertiesImpl(String container, BlobServiceOptions options, - String operation) throws ServiceException { - String path = createPathFromContainer(container); - WebResource webResource = getResource(options).path(path).queryParam("resType", "container"); - webResource = addOptionalQueryParam(webResource, "comp", operation); - - Builder builder = webResource.header("x-ms-version", API_VERSION); - - ClientResponse response = builder.get(ClientResponse.class); - ThrowIfError(response); - - GetContainerPropertiesResult properties = new GetContainerPropertiesResult(); - properties.setEtag(response.getHeaders().getFirst("ETag")); - properties.setLastModified(dateMapper.parse(response.getHeaders().getFirst("Last-Modified"))); - properties.setMetadata(getMetadataFromHeaders(response)); - - return properties; - } - - @Override - public GetContainerACLResult getContainerACL(String container) throws ServiceException { - return getContainerACL(container, new BlobServiceOptions()); - } - - @Override - public GetContainerACLResult getContainerACL(String container, BlobServiceOptions options) throws ServiceException { - String path = createPathFromContainer(container); - WebResource webResource = getResource(options).path(path).queryParam("resType", "container") - .queryParam("comp", "acl"); - - Builder builder = webResource.header("x-ms-version", API_VERSION); - - ClientResponse response = builder.get(ClientResponse.class); - ThrowIfError(response); - - ContainerACL.SignedIdentifiers si = response.getEntity(ContainerACL.SignedIdentifiers.class); - ContainerACL acl = new ContainerACL(); - acl.setSignedIdentifiers(si.getSignedIdentifiers()); - if ("container".equals(response.getHeaders().getFirst("x-ms-blob-public-access"))) { - acl.setPublicAccess(PublicAccessType.CONTAINER_AND_BLOBS); - } - else if ("blob".equals(response.getHeaders().getFirst("x-ms-blob-public-access"))) { - acl.setPublicAccess(PublicAccessType.BLOBS_ONLY); - } - else { - acl.setPublicAccess(PublicAccessType.NONE); - } - acl.setEtag(response.getHeaders().getFirst("ETag")); - acl.setLastModified(dateMapper.parse(response.getHeaders().getFirst("Last-Modified"))); - - GetContainerACLResult result = new GetContainerACLResult(); - result.setValue(acl); - return result; - } - - @Override - public void setContainerACL(String container, ContainerACL acl) throws ServiceException { - setContainerACL(container, acl, new BlobServiceOptions()); - } - - @Override - public void setContainerACL(String container, ContainerACL acl, BlobServiceOptions options) throws ServiceException { - String path = createPathFromContainer(container); - WebResource webResource = getResource(options).path(path).queryParam("resType", "container") - .queryParam("comp", "acl"); - - Builder builder = webResource.header("x-ms-version", API_VERSION); - if (acl.getPublicAccess() == PublicAccessType.BLOBS_ONLY) { - builder = addOptionalHeader(builder, "x-ms-blob-public-access", "blob"); - } - else if (acl.getPublicAccess() == PublicAccessType.CONTAINER_AND_BLOBS) { - builder = addOptionalHeader(builder, "x-ms-blob-public-access", "container"); - } - - ContainerACL.SignedIdentifiers si = new ContainerACL.SignedIdentifiers(); - si.setSignedIdentifiers(acl.getSignedIdentifiers()); - - builder.put(si); - } - - @Override - public void setContainerMetadata(String container, HashMap metadata) throws ServiceException { - setContainerMetadata(container, metadata, new SetContainerMetadataOptions()); - } - - @Override - public void setContainerMetadata(String container, HashMap metadata, - SetContainerMetadataOptions options) throws ServiceException { - String path = createPathFromContainer(container); - WebResource webResource = getResource(options).path(path).queryParam("resType", "container") - .queryParam("comp", "metadata"); - - WebResource.Builder builder = webResource.header("x-ms-version", API_VERSION); - builder = addOptionalMetadataHeader(builder, metadata); - builder = addOptionalAccessConditionHeader(builder, options.getAccessCondition()); - - builder.put(); - } - - @Override - public ListContainersResult listContainers() throws ServiceException { - return listContainers(new ListContainersOptions()); - } - - @Override - public ListContainersResult listContainers(ListContainersOptions options) throws ServiceException { - WebResource webResource = getResource(options).path("/").queryParam("comp", "list"); - webResource = addOptionalQueryParam(webResource, "prefix", options.getPrefix()); - webResource = addOptionalQueryParam(webResource, "marker", options.getMarker()); - webResource = addOptionalQueryParam(webResource, "maxresults", options.getMaxResults(), 0); - webResource = addOptionalContainerIncludeQueryParam(options, webResource); - - Builder builder = webResource.header("x-ms-version", API_VERSION); - - return builder.get(ListContainersResult.class); - } - - @Override - public ListBlobsResult listBlobs(String container) throws ServiceException { - return listBlobs(container, new ListBlobsOptions()); - } - - @Override - public ListBlobsResult listBlobs(String container, ListBlobsOptions options) throws ServiceException { - String path = createPathFromContainer(container); - WebResource webResource = getResource(options).path(path).queryParam("comp", "list") - .queryParam("resType", "container"); - webResource = addOptionalQueryParam(webResource, "prefix", options.getPrefix()); - webResource = addOptionalQueryParam(webResource, "marker", options.getMarker()); - webResource = addOptionalQueryParam(webResource, "maxresults", options.getMaxResults(), 0); - webResource = addOptionalQueryParam(webResource, "delimiter", options.getDelimiter()); - webResource = addOptionalBlobListingIncludeQueryParam(options, webResource); - - Builder builder = webResource.header("x-ms-version", API_VERSION); - - return builder.get(ListBlobsResult.class); - } - - @Override - public CreateBlobResult createPageBlob(String container, String blob, long length) throws ServiceException { - return createPageBlob(container, blob, length, new CreateBlobOptions()); - } - - @Override - public CreateBlobResult createPageBlob(String container, String blob, long length, CreateBlobOptions options) - throws ServiceException { - String path = createPathFromContainer(container); - WebResource webResource = getResource(options).path(path).path(blob); - - Builder builder = webResource.header("x-ms-version", API_VERSION); - builder = addOptionalHeader(builder, "x-ms-blob-type", "PageBlob"); - builder = addOptionalHeader(builder, "Content-Length", 0); - builder = addOptionalHeader(builder, "x-ms-blob-content-length", length); - builder = addOptionalHeader(builder, "x-ms-blob-sequence-number", options.getSequenceNumber()); - builder = addPutBlobHeaders(options, builder); - - ClientResponse clientResponse = builder.put(ClientResponse.class); - ThrowIfError(clientResponse); - - CreateBlobResult createBlobResult = new CreateBlobResult(); - createBlobResult.setEtag(clientResponse.getHeaders().getFirst("ETag")); - createBlobResult.setLastModified(dateMapper.parse(clientResponse.getHeaders().getFirst("Last-Modified"))); - - return createBlobResult; - } - - @Override - public CreateBlobResult createBlockBlob(String container, String blob, InputStream contentStream) - throws ServiceException { - return createBlockBlob(container, blob, contentStream, new CreateBlobOptions()); - } - - @Override - public CreateBlobResult createBlockBlob(String container, String blob, InputStream contentStream, - CreateBlobOptions options) throws ServiceException { - String path = createPathFromContainer(container); - System.out.println(path); - WebResource webResource = getResource(options).path(path).path(blob); - - Builder builder = webResource.header("x-ms-version", API_VERSION); - - builder = builder.header("x-ms-blob-type", "BlockBlob"); - builder = addPutBlobHeaders(options, builder); - - Object contentObject = (contentStream == null ? new byte[0] : contentStream); - ClientResponse clientResponse = builder.put(ClientResponse.class, contentObject); - ThrowIfError(clientResponse); - - CreateBlobResult createBlobResult = new CreateBlobResult(); - createBlobResult.setEtag(clientResponse.getHeaders().getFirst("ETag")); - createBlobResult.setLastModified(dateMapper.parse(clientResponse.getHeaders().getFirst("Last-Modified"))); - - return createBlobResult; - } - - @Override - public GetBlobPropertiesResult getBlobProperties(String container, String blob) throws ServiceException { - return getBlobProperties(container, blob, new GetBlobPropertiesOptions()); - } - - @Override - public GetBlobPropertiesResult getBlobProperties(String container, String blob, GetBlobPropertiesOptions options) - throws ServiceException { - String path = createPathFromContainer(container); - WebResource webResource = getResource(options).path(path).path(blob); - webResource = addOptionalQueryParam(webResource, "snapshot", options.getSnapshot()); - - Builder builder = webResource.header("x-ms-version", API_VERSION); - builder = addOptionalHeader(builder, "x-ms-lease-id", options.getLeaseId()); - builder = addOptionalAccessConditionHeader(builder, options.getAccessCondition()); - - ClientResponse response = builder.method("HEAD", ClientResponse.class); - ThrowIfNotSuccess(response); - - return getBlobPropertiesResultFromResponse(response); - } - - @Override - public GetBlobMetadataResult getBlobMetadata(String container, String blob) throws ServiceException { - return getBlobMetadata(container, blob, new GetBlobMetadataOptions()); - } - - @Override - public GetBlobMetadataResult getBlobMetadata(String container, String blob, GetBlobMetadataOptions options) - throws ServiceException { - String path = createPathFromContainer(container); - WebResource webResource = getResource(options).path(path).path(blob).queryParam("comp", "metadata"); - webResource = addOptionalQueryParam(webResource, "snapshot", options.getSnapshot()); - - Builder builder = webResource.header("x-ms-version", API_VERSION); - builder = addOptionalHeader(builder, "x-ms-lease-id", options.getLeaseId()); - builder = addOptionalAccessConditionHeader(builder, options.getAccessCondition()); - - ClientResponse response = builder.get(ClientResponse.class); - ThrowIfError(response); - - GetBlobMetadataResult properties = new GetBlobMetadataResult(); - properties.setEtag(response.getHeaders().getFirst("ETag")); - properties.setLastModified(dateMapper.parse(response.getHeaders().getFirst("Last-Modified"))); - properties.setMetadata(getMetadataFromHeaders(response)); - - return properties; - } - - @Override - public SetBlobPropertiesResult setBlobProperties(String container, String blob, SetBlobPropertiesOptions options) - throws ServiceException { - String path = createPathFromContainer(container); - WebResource webResource = getResource(options).path(path).path(blob).queryParam("comp", "properties"); - - WebResource.Builder builder = webResource.header("x-ms-version", API_VERSION); - builder = addOptionalHeader(builder, "x-ms-blob-cache-control", options.getCacheControl()); - builder = addOptionalHeader(builder, "x-ms-blob-content-type", options.getContentType()); - builder = addOptionalHeader(builder, "x-ms-blob-content-md5", options.getContentMD5()); - builder = addOptionalHeader(builder, "x-ms-blob-content-encoding", options.getContentEncoding()); - builder = addOptionalHeader(builder, "x-ms-blob-content-language", options.getContentLanguage()); - builder = addOptionalHeader(builder, "x-ms-blob-content-length", options.getContentLength()); - builder = addOptionalHeader(builder, "x-ms-sequence-number-action", options.getSequenceNumberAction()); - builder = addOptionalHeader(builder, "x-ms-blob-sequence-number", options.getSequenceNumber()); - builder = addOptionalHeader(builder, "x-ms-lease-id", options.getLeaseId()); - builder = addOptionalAccessConditionHeader(builder, options.getAccessCondition()); - - ClientResponse response = builder.put(ClientResponse.class); - ThrowIfError(response); - - SetBlobPropertiesResult result = new SetBlobPropertiesResult(); - - result.setEtag(response.getHeaders().getFirst("ETag")); - result.setLastModified(dateMapper.parse(response.getHeaders().getFirst("Last-Modified"))); - if (response.getHeaders().getFirst("x-ms-blob-sequence-number") != null) { - result.setSequenceNumber(Long.parseLong(response.getHeaders().getFirst("x-ms-blob-sequence-number"))); - } - - return result; - } - - @Override - public SetBlobMetadataResult setBlobMetadata(String container, String blob, HashMap metadata) - throws ServiceException { - return setBlobMetadata(container, blob, metadata, new SetBlobMetadataOptions()); - } - - @Override - public SetBlobMetadataResult setBlobMetadata(String container, String blob, HashMap metadata, - SetBlobMetadataOptions options) throws ServiceException { - String path = createPathFromContainer(container); - WebResource webResource = getResource(options).path(path).path(blob).queryParam("comp", "metadata"); - - WebResource.Builder builder = webResource.header("x-ms-version", API_VERSION); - builder = addOptionalHeader(builder, "x-ms-lease-id", options.getLeaseId()); - builder = addOptionalMetadataHeader(builder, metadata); - builder = addOptionalAccessConditionHeader(builder, options.getAccessCondition()); - - ClientResponse response = builder.put(ClientResponse.class); - ThrowIfError(response); - - SetBlobMetadataResult result = new SetBlobMetadataResult(); - result.setEtag(response.getHeaders().getFirst("ETag")); - result.setLastModified(dateMapper.parse(response.getHeaders().getFirst("Last-Modified"))); - return result; - } - - @Override - public GetBlobResult getBlob(String container, String blob) throws ServiceException { - return getBlob(container, blob, new GetBlobOptions()); - } - - @Override - public GetBlobResult getBlob(String container, String blob, GetBlobOptions options) throws ServiceException { - String path = createPathFromContainer(container); - WebResource webResource = getResource(options).path(path).path(blob); - webResource = addOptionalQueryParam(webResource, "snapshot", options.getSnapshot()); - - Builder builder = webResource.header("x-ms-version", API_VERSION); - builder = addOptionalHeader(builder, "x-ms-lease-id", options.getLeaseId()); - builder = addOptionalRangeHeader(builder, options.getRangeStart(), options.getRangeEnd()); - builder = addOptionalAccessConditionHeader(builder, options.getAccessCondition()); - if (options.isComputeRangeMD5()) { - builder = addOptionalHeader(builder, "x-ms-range-get-content-md5", "true"); - } - - ClientResponse response = builder.get(ClientResponse.class); - ThrowIfNotSuccess(response); - - GetBlobPropertiesResult properties = getBlobPropertiesResultFromResponse(response); - GetBlobResult blobResult = new GetBlobResult(); - blobResult.setProperties(properties.getProperties()); - blobResult.setMetadata(properties.getMetadata()); - blobResult.setContentStream(response.getEntityInputStream()); - return blobResult; - } - - @Override - public void deleteBlob(String container, String blob) throws ServiceException { - deleteBlob(container, blob, new DeleteBlobOptions()); - } - - @Override - public void deleteBlob(String container, String blob, DeleteBlobOptions options) throws ServiceException { - String path = createPathFromContainer(container); - WebResource webResource = getResource(options).path(path).path(blob); - webResource = addOptionalQueryParam(webResource, "snapshot", options.getSnapshot()); - - Builder builder = webResource.header("x-ms-version", API_VERSION); - builder = addOptionalHeader(builder, "x-ms-lease-id", options.getLeaseId()); - if (options.getDeleteSnaphotsOnly() != null) { - builder = addOptionalHeader(builder, "x-ms-delete-snapshots", options.getDeleteSnaphotsOnly() ? "only" - : "include"); - } - builder = addOptionalAccessConditionHeader(builder, options.getAccessCondition()); - - builder.delete(); - } - - @Override - public CreateBlobSnapshotResult createBlobSnapshot(String container, String blob) throws ServiceException { - return createBlobSnapshot(container, blob, new CreateBlobSnapshotOptions()); - } - - @Override - public CreateBlobSnapshotResult createBlobSnapshot(String container, String blob, CreateBlobSnapshotOptions options) - throws ServiceException { - String path = createPathFromContainer(container); - WebResource webResource = getResource(options).path(path).path(blob).queryParam("comp", "snapshot"); - - Builder builder = webResource.header("x-ms-version", API_VERSION); - builder = addOptionalHeader(builder, "x-ms-lease-id", options.getLeaseId()); - builder = addOptionalMetadataHeader(builder, options.getMetadata()); - builder = addOptionalAccessConditionHeader(builder, options.getAccessCondition()); - - ClientResponse response = builder.put(ClientResponse.class); - ThrowIfError(response); - - CreateBlobSnapshotResult blobSnapshot = new CreateBlobSnapshotResult(); - blobSnapshot.setEtag(response.getHeaders().getFirst("ETag")); - blobSnapshot.setSnapshot(response.getHeaders().getFirst("x-ms-snapshot")); - blobSnapshot.setLastModified(dateMapper.parse(response.getHeaders().getFirst("Last-Modified"))); - - return blobSnapshot; - } - - @Override - public CopyBlobResult copyBlob(String destinationContainer, String destinationBlob, String sourceContainer, - String sourceBlob) throws ServiceException { - return copyBlob(destinationContainer, destinationBlob, sourceContainer, sourceBlob, new CopyBlobOptions()); - } - - @Override - public CopyBlobResult copyBlob(String destinationContainer, String destinationBlob, String sourceContainer, - String sourceBlob, CopyBlobOptions options) { - String path = createPathFromContainer(destinationContainer); - WebResource webResource = getResource(options).path(path).path(destinationBlob); - - Builder builder = webResource.header("x-ms-version", API_VERSION); - builder = addOptionalHeader(builder, "x-ms-lease-id", options.getLeaseId()); - builder = addOptionalHeader(builder, "x-ms-source-lease-id", options.getSourceLeaseId()); - builder = addOptionalHeader(builder, "x-ms-copy-source", - getCopyBlobSourceName(sourceContainer, sourceBlob, options)); - builder = addOptionalMetadataHeader(builder, options.getMetadata()); - builder = addOptionalAccessConditionHeader(builder, options.getAccessCondition()); - builder = addOptionalSourceAccessConditionHeader(builder, options.getSourceAccessCondition()); - - ClientResponse clientResponse = builder.put(ClientResponse.class); - ThrowIfError(clientResponse); - - CopyBlobResult copyBlobResult = new CopyBlobResult(); - copyBlobResult.setEtag(clientResponse.getHeaders().getFirst("ETag")); - copyBlobResult.setLastModified(dateMapper.parse(clientResponse.getHeaders().getFirst("Last-Modified"))); - - return copyBlobResult; - } - - @Override - public AcquireLeaseResult acquireLease(String container, String blob) throws ServiceException { - return acquireLease(container, blob, new AcquireLeaseOptions()); - } - - @Override - public AcquireLeaseResult acquireLease(String container, String blob, AcquireLeaseOptions options) - throws ServiceException { - return putLeaseImpl("acquire", container, blob, null/* leaseId */, options, options.getAccessCondition()); - } - - @Override - public AcquireLeaseResult renewLease(String container, String blob, String leaseId) throws ServiceException { - return renewLease(container, blob, leaseId, new BlobServiceOptions()); - } - - @Override - public AcquireLeaseResult renewLease(String container, String blob, String leaseId, BlobServiceOptions options) - throws ServiceException { - return putLeaseImpl("renew", container, blob, leaseId, options, null/* accessCondition */); - } - - @Override - public void releaseLease(String container, String blob, String leaseId) throws ServiceException { - releaseLease(container, blob, leaseId, new BlobServiceOptions()); - } - - @Override - public void releaseLease(String container, String blob, String leaseId, BlobServiceOptions options) - throws ServiceException { - putLeaseImpl("release", container, blob, leaseId, options, null/* accessCondition */); - } - - @Override - public void breakLease(String container, String blob, String leaseId) throws ServiceException { - breakLease(container, blob, leaseId, new BlobServiceOptions()); - } - - @Override - public void breakLease(String container, String blob, String leaseId, BlobServiceOptions options) - throws ServiceException { - putLeaseImpl("break", container, blob, leaseId, options, null/* accessCondition */); - } - - private AcquireLeaseResult putLeaseImpl(String leaseAction, String container, String blob, String leaseId, - BlobServiceOptions options, AccessCondition accessCondition) throws ServiceException { - String path = createPathFromContainer(container); - WebResource webResource = getResource(options).path(path).path(blob).queryParam("comp", "lease"); - - Builder builder = webResource.header("x-ms-version", API_VERSION); - builder = addOptionalHeader(builder, "x-ms-lease-id", leaseId); - builder = addOptionalHeader(builder, "x-ms-lease-action", leaseAction); - builder = addOptionalAccessConditionHeader(builder, accessCondition); - - // Note: Add content type here to enable proper HMAC signing - ClientResponse response = builder.put(ClientResponse.class); - ThrowIfError(response); - - AcquireLeaseResult result = new AcquireLeaseResult(); - result.setLeaseId(response.getHeaders().getFirst("x-ms-lease-id")); - return result; - } - - @Override - public CreateBlobPagesResult clearBlobPages(String container, String blob, PageRange range) throws ServiceException { - return clearBlobPages(container, blob, range, new CreateBlobPagesOptions()); - } - - @Override - public CreateBlobPagesResult clearBlobPages(String container, String blob, PageRange range, - CreateBlobPagesOptions options) throws ServiceException { - return updatePageBlobPagesImpl("clear", container, blob, range, 0, null, options); - } - - @Override - public CreateBlobPagesResult createBlobPages(String container, String blob, PageRange range, long length, - InputStream contentStream) throws ServiceException { - return createBlobPages(container, blob, range, length, contentStream, new CreateBlobPagesOptions()); - } - - @Override - public CreateBlobPagesResult createBlobPages(String container, String blob, PageRange range, long length, - InputStream contentStream, CreateBlobPagesOptions options) throws ServiceException { - return updatePageBlobPagesImpl("update", container, blob, range, length, contentStream, options); - } - - private CreateBlobPagesResult updatePageBlobPagesImpl(String action, String container, String blob, - PageRange range, long length, InputStream contentStream, CreateBlobPagesOptions options) - throws ServiceException { - String path = createPathFromContainer(container); - WebResource webResource = getResource(options).path(path).path(blob).queryParam("comp", "page"); - - Builder builder = webResource.header("x-ms-version", API_VERSION); - builder = addOptionalRangeHeader(builder, range.getStart(), range.getEnd()); - builder = addOptionalHeader(builder, "Content-Length", length); - builder = addOptionalHeader(builder, "Content-MD5", options.getContentMD5()); - builder = addOptionalHeader(builder, "x-ms-lease-id", options.getLeaseId()); - builder = addOptionalHeader(builder, "x-ms-page-write", action); - builder = addOptionalAccessConditionHeader(builder, options.getAccessCondition()); - - ClientResponse response = builder.put(ClientResponse.class, contentStream); - ThrowIfError(response); - - CreateBlobPagesResult result = new CreateBlobPagesResult(); - result.setEtag(response.getHeaders().getFirst("ETag")); - result.setLastModified(dateMapper.parse(response.getHeaders().getFirst("Last-Modified"))); - result.setContentMD5(response.getHeaders().getFirst("Content-MD5")); - result.setSequenceNumber(Long.parseLong(response.getHeaders().getFirst("x-ms-blob-sequence-number"))); - - return result; - } - - @Override - public ListBlobRegionsResult listBlobRegions(String container, String blob) throws ServiceException { - return listBlobRegions(container, blob, new ListBlobRegionsOptions()); - } - - @Override - public ListBlobRegionsResult listBlobRegions(String container, String blob, ListBlobRegionsOptions options) - throws ServiceException { - String path = createPathFromContainer(container); - WebResource webResource = getResource(options).path(path).path(blob).queryParam("comp", "pagelist"); - - Builder builder = webResource.header("x-ms-version", API_VERSION); - builder = addOptionalRangeHeader(builder, options.getRangeStart(), options.getRangeEnd()); - builder = addOptionalHeader(builder, "x-ms-lease-id", options.getLeaseId()); - builder = addOptionalAccessConditionHeader(builder, options.getAccessCondition()); - - ClientResponse response = builder.get(ClientResponse.class); - ThrowIfError(response); - - ListBlobRegionsResult result = response.getEntity(ListBlobRegionsResult.class); - result.setEtag(response.getHeaders().getFirst("ETag")); - result.setContentLength(Long.parseLong(response.getHeaders().getFirst("x-ms-blob-content-length"))); - result.setLastModified(dateMapper.parse(response.getHeaders().getFirst("Last-Modified"))); - - return result; - } - - @Override - public void createBlobBlock(String container, String blob, String blockId, InputStream contentStream) - throws ServiceException { - createBlobBlock(container, blob, blockId, contentStream, new CreateBlobBlockOptions()); - } - - @Override - public void createBlobBlock(String container, String blob, String blockId, InputStream contentStream, - CreateBlobBlockOptions options) throws ServiceException { - String path = createPathFromContainer(container); - WebResource webResource = getResource(options).path(path).path(blob).queryParam("comp", "block"); - webResource = addOptionalQueryParam(webResource, "blockid", new String(Base64.encode(blockId))); - - Builder builder = webResource.header("x-ms-version", API_VERSION); - builder = addOptionalHeader(builder, "x-ms-lease-id", options.getLeaseId()); - builder = addOptionalHeader(builder, "Content-MD5", options.getContentMD5()); - - builder.put(contentStream); - } - - @Override - public void commitBlobBlocks(String container, String blob, BlockList blockList) throws ServiceException { - commitBlobBlocks(container, blob, blockList, new CommitBlobBlocksOptions()); - } - - @Override - public void commitBlobBlocks(String container, String blob, BlockList blockList, CommitBlobBlocksOptions options) - throws ServiceException { - String path = createPathFromContainer(container); - WebResource webResource = getResource(options).path(path).path(blob).queryParam("comp", "blocklist"); - - Builder builder = webResource.header("x-ms-version", API_VERSION); - builder = addOptionalHeader(builder, "x-ms-lease-id", options.getLeaseId()); - builder = addOptionalHeader(builder, "x-ms-blob-cache-control", options.getBlobCacheControl()); - builder = addOptionalHeader(builder, "x-ms-blob-content-type", options.getBlobContentType()); - builder = addOptionalHeader(builder, "x-ms-blob-content-encoding", options.getBlobContentEncoding()); - builder = addOptionalHeader(builder, "x-ms-blob-content-language", options.getBlobContentLanguage()); - builder = addOptionalHeader(builder, "x-ms-blob-content-md5", options.getBlobContentMD5()); - builder = addOptionalMetadataHeader(builder, options.getMetadata()); - builder = addOptionalAccessConditionHeader(builder, options.getAccessCondition()); - - builder.put(blockList); - } - - @Override - public ListBlobBlocksResult listBlobBlocks(String container, String blob) throws ServiceException { - return listBlobBlocks(container, blob, new ListBlobBlocksOptions()); - } - - @Override - public ListBlobBlocksResult listBlobBlocks(String container, String blob, ListBlobBlocksOptions options) - throws ServiceException { - String path = createPathFromContainer(container); - WebResource webResource = getResource(options).path(path).path(blob).queryParam("comp", "blocklist"); - webResource = addOptionalQueryParam(webResource, "snapshot", options.getSnapshot()); - if (options.isCommittedList() && options.isUncommittedList()) { - webResource = addOptionalQueryParam(webResource, "blocklisttype", "all"); - } - else if (options.isCommittedList()) { - webResource = addOptionalQueryParam(webResource, "blocklisttype", "committed"); - } - else if (options.isUncommittedList()) { - webResource = addOptionalQueryParam(webResource, "blocklisttype", "uncommitted"); - } - - Builder builder = webResource.header("x-ms-version", API_VERSION); - builder = addOptionalHeader(builder, "x-ms-lease-id", options.getLeaseId()); - - ClientResponse response = builder.get(ClientResponse.class); - ThrowIfError(response); - - ListBlobBlocksResult result = response.getEntity(ListBlobBlocksResult.class); - result.setEtag(response.getHeaders().getFirst("ETag")); - result.setContentType(response.getHeaders().getFirst("Content-Type")); - - String blobContentLength = response.getHeaders().getFirst("x-ms-blob-content-length"); - if (blobContentLength != null) { - result.setContentLength(Long.parseLong(blobContentLength)); - } - else { - result.setContentLength(0); - } - - String lastModified = response.getHeaders().getFirst("Last-Modified"); - if (lastModified != null) { - result.setLastModified(dateMapper.parse(lastModified)); - } - - return result; - } - - private String createPathFromContainer(String containerName) { - String path; - if (containerName == null || containerName.isEmpty()) { - path = "$root"; - } - else { - path = containerName; - } - return path; + ServiceFilter[] currentFilters = getFilters(); + ServiceFilter[] newFilters = Arrays.copyOf(currentFilters, currentFilters.length + 1); + newFilters[currentFilters.length] = filter; + return new BlobRestProxy(getChannel(), newFilters, getAccountName(), getUrl(), this.filter, getDateMapper()); } } diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/ContainerACLDateAdapter.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/ContainerACLDateAdapter.java index f1ea12dbaa76..06ef3c975a26 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/ContainerACLDateAdapter.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/ContainerACLDateAdapter.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/HmacSHA256Sign.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/HmacSHA256Sign.java index 395d7d9cd393..71a68bd061cc 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/HmacSHA256Sign.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/HmacSHA256Sign.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/ISO8601DateConverter.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/ISO8601DateConverter.java index 34444b858a03..cac734d4dc6e 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/ISO8601DateConverter.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/ISO8601DateConverter.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/MetadataAdapter.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/MetadataAdapter.java index fb07884c72a3..b174cf5f5f49 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/MetadataAdapter.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/MetadataAdapter.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/RFC1123DateAdapter.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/RFC1123DateAdapter.java index 79387438534b..aff36b78c73e 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/RFC1123DateAdapter.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/RFC1123DateAdapter.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/RFC1123DateConverter.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/RFC1123DateConverter.java index 67d1738a3889..91d2acda79bb 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/RFC1123DateConverter.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/RFC1123DateConverter.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/SharedKeyFilter.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/SharedKeyFilter.java index 9072ead43564..b3ab2cd850ce 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/SharedKeyFilter.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/SharedKeyFilter.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/SharedKeyLiteFilter.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/SharedKeyLiteFilter.java index 37ff1321d5d9..696c73cd6d90 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/SharedKeyLiteFilter.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/SharedKeyLiteFilter.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/SharedKeyUtils.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/SharedKeyUtils.java index b3cfcecbf545..f54dcc170742 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/SharedKeyUtils.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/implementation/SharedKeyUtils.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/AccessCondition.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/AccessCondition.java index 90791bacfeb2..f9a24919bdc0 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/AccessCondition.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/AccessCondition.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/AccessConditionHeaderType.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/AccessConditionHeaderType.java index 34966982a9da..ecfea0b1da5a 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/AccessConditionHeaderType.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/AccessConditionHeaderType.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/AcquireLeaseOptions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/AcquireLeaseOptions.java index fe6e69ed8713..dce54430b538 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/AcquireLeaseOptions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/AcquireLeaseOptions.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/AcquireLeaseResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/AcquireLeaseResult.java index 785d10473f08..044833ada7ba 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/AcquireLeaseResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/AcquireLeaseResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/BlobProperties.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/BlobProperties.java index f5231d28254a..630e1a9fb269 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/BlobProperties.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/BlobProperties.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/BlobServiceOptions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/BlobServiceOptions.java index 3fc56c6d1ab6..1abb7d1984af 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/BlobServiceOptions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/BlobServiceOptions.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/BlockList.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/BlockList.java index 320066d06f80..71b1ef0f31a4 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/BlockList.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/BlockList.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/CommitBlobBlocksOptions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/CommitBlobBlocksOptions.java index 9aa632f80f60..477c4b4bc0e1 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/CommitBlobBlocksOptions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/CommitBlobBlocksOptions.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/ContainerACL.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/ContainerACL.java index 4fb40c128553..1668ff5fef8a 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/ContainerACL.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/ContainerACL.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/CopyBlobOptions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/CopyBlobOptions.java index 484829480329..dd5524eaba21 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/CopyBlobOptions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/CopyBlobOptions.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/CopyBlobResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/CopyBlobResult.java index d8dd1b665847..9d3395c2a722 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/CopyBlobResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/CopyBlobResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/CreateBlobBlockOptions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/CreateBlobBlockOptions.java index 98bdb31d5d99..24661cdbd6d5 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/CreateBlobBlockOptions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/CreateBlobBlockOptions.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/CreateBlobOptions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/CreateBlobOptions.java index e3afa134df8a..644f5e7b4718 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/CreateBlobOptions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/CreateBlobOptions.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/CreateBlobPagesOptions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/CreateBlobPagesOptions.java index e87466dd35c0..6d25af5908e7 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/CreateBlobPagesOptions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/CreateBlobPagesOptions.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/CreateBlobPagesResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/CreateBlobPagesResult.java index 20e98bd3f3cc..5c7711cc2500 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/CreateBlobPagesResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/CreateBlobPagesResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/CreateBlobResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/CreateBlobResult.java index 4ab963e26900..6181e7c7278f 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/CreateBlobResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/CreateBlobResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/CreateBlobSnapshotOptions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/CreateBlobSnapshotOptions.java index 4df9b3b1f7c5..76b41429f1c1 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/CreateBlobSnapshotOptions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/CreateBlobSnapshotOptions.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/CreateBlobSnapshotResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/CreateBlobSnapshotResult.java index 7965e60deedd..a35964af62d6 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/CreateBlobSnapshotResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/CreateBlobSnapshotResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/CreateContainerOptions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/CreateContainerOptions.java index b128296b61aa..42bc57b029fd 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/CreateContainerOptions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/CreateContainerOptions.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/DeleteBlobOptions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/DeleteBlobOptions.java index f678c6625aec..281f0d14979b 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/DeleteBlobOptions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/DeleteBlobOptions.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/DeleteContainerOptions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/DeleteContainerOptions.java index fc5c922de756..64bf97b199a5 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/DeleteContainerOptions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/DeleteContainerOptions.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/GetBlobMetadataOptions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/GetBlobMetadataOptions.java index 0c8cbbbc88f0..4471ddf1a3f5 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/GetBlobMetadataOptions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/GetBlobMetadataOptions.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/GetBlobMetadataResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/GetBlobMetadataResult.java index 14aa9fb13e62..272547f5d7e0 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/GetBlobMetadataResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/GetBlobMetadataResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/GetBlobOptions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/GetBlobOptions.java index 2edeca6dc264..eb944c04f1d9 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/GetBlobOptions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/GetBlobOptions.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/GetBlobPropertiesOptions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/GetBlobPropertiesOptions.java index 1e93569b8a77..6d1c433ca5fd 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/GetBlobPropertiesOptions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/GetBlobPropertiesOptions.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/GetBlobPropertiesResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/GetBlobPropertiesResult.java index 725ce6d3c78a..6bc1830d487d 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/GetBlobPropertiesResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/GetBlobPropertiesResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/GetBlobResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/GetBlobResult.java index dcdc580a79ea..850d509f48eb 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/GetBlobResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/GetBlobResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/GetContainerACLResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/GetContainerACLResult.java index 97597f8dbc01..68d2f677f1cd 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/GetContainerACLResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/GetContainerACLResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/GetContainerPropertiesResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/GetContainerPropertiesResult.java index 6a5cf9495ab0..09dbc31e85fe 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/GetContainerPropertiesResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/GetContainerPropertiesResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/GetServicePropertiesResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/GetServicePropertiesResult.java index c3773a69c671..a37e55400a08 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/GetServicePropertiesResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/GetServicePropertiesResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/ListBlobBlocksOptions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/ListBlobBlocksOptions.java index 13e7c9fe9e8e..ddd560c352a9 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/ListBlobBlocksOptions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/ListBlobBlocksOptions.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/ListBlobBlocksResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/ListBlobBlocksResult.java index 216322e4dd21..9dc09239113b 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/ListBlobBlocksResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/ListBlobBlocksResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/ListBlobRegionsOptions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/ListBlobRegionsOptions.java index c944d19e596c..a16c5a6be5d8 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/ListBlobRegionsOptions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/ListBlobRegionsOptions.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/ListBlobRegionsResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/ListBlobRegionsResult.java index c18ccb70c38b..a9b3fff40103 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/ListBlobRegionsResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/ListBlobRegionsResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/ListBlobsOptions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/ListBlobsOptions.java index ed46f9f71772..091d82907676 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/ListBlobsOptions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/ListBlobsOptions.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/ListBlobsResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/ListBlobsResult.java index 5245eea92427..fb55ed889d72 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/ListBlobsResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/ListBlobsResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/ListContainersOptions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/ListContainersOptions.java index 71a5a868c5ca..d1dcb76c3fd3 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/ListContainersOptions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/ListContainersOptions.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/ListContainersResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/ListContainersResult.java index 3b6508eb4a8a..17c6d23aea2b 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/ListContainersResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/ListContainersResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/PageRange.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/PageRange.java index 44a6fe568ca7..57fb592e24af 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/PageRange.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/PageRange.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/ServiceProperties.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/ServiceProperties.java index 24f92c559b2f..f9ee9985e50c 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/ServiceProperties.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/ServiceProperties.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. @@ -409,4 +409,4 @@ public RetentionPolicy setEnabled(boolean enabled) { return this; } } -} \ No newline at end of file +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/SetBlobMetadataOptions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/SetBlobMetadataOptions.java index 8c15e4c5c5ef..4baca8d1dc34 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/SetBlobMetadataOptions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/SetBlobMetadataOptions.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/SetBlobMetadataResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/SetBlobMetadataResult.java index c00f3d67d981..4fe30c077d1e 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/SetBlobMetadataResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/SetBlobMetadataResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/SetBlobPropertiesOptions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/SetBlobPropertiesOptions.java index 2dabb15421bc..c002057c15a7 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/SetBlobPropertiesOptions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/SetBlobPropertiesOptions.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/SetBlobPropertiesResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/SetBlobPropertiesResult.java index 599a9576b9ee..8180dd21db39 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/SetBlobPropertiesResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/SetBlobPropertiesResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/SetContainerMetadataOptions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/SetContainerMetadataOptions.java index 0830b04e3d04..25933e8a3e6f 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/SetContainerMetadataOptions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/blob/models/SetContainerMetadataOptions.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/Builder.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/Builder.java index 5b7459507322..f6a194e3349d 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/Builder.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/Builder.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/Configuration.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/Configuration.java index e5afff9047a2..764db7bab9b3 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/Configuration.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/Configuration.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. @@ -35,6 +35,12 @@ public class Configuration { */ public static final String PROPERTY_READ_TIMEOUT = "com.microsoft.windowsazure.services.core.Configuration.readTimeout"; + /** + * Property name to control if HTTP logging to console is on or off. If property is set, logging is on, regardless + * of value. + */ + public static final String PROPERTY_LOG_HTTP_REQUESTS = "com.microsoft.windowsazure.services.core.Configuration.logHttpRequests"; + private static Configuration instance; Map properties; Builder builder; diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/ConfigurationException.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/ConfigurationException.java index 90fae9f80a1b..b1787a666327 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/ConfigurationException.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/ConfigurationException.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/DefaultBuilder.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/DefaultBuilder.java index 9db58f641761..f72f4c935c37 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/DefaultBuilder.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/DefaultBuilder.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/ExponentialRetryPolicy.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/ExponentialRetryPolicy.java index a5ff7c5bbae4..a03c811eaf47 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/ExponentialRetryPolicy.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/ExponentialRetryPolicy.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/FilterableService.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/FilterableService.java index 0e9563b0131b..53f8efe2d1fd 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/FilterableService.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/FilterableService.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/IdempotentClientFilter.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/IdempotentClientFilter.java new file mode 100644 index 000000000000..f929716eec16 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/IdempotentClientFilter.java @@ -0,0 +1,64 @@ +/** + * 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.core; + +import com.sun.jersey.api.client.ClientHandlerException; +import com.sun.jersey.api.client.ClientRequest; +import com.sun.jersey.api.client.ClientResponse; +import com.sun.jersey.api.client.filter.ClientFilter; + +/** + * Base class for filters that enforces idempotency - the filter + * will only be applied once for a particular request, even + * if the request passes through this filter more than once. + * + */ +public abstract class IdempotentClientFilter extends ClientFilter { + /* (non-Javadoc) + * @see com.sun.jersey.api.client.filter.ClientFilter#handle(com.sun.jersey.api.client.ClientRequest) + */ + @Override + public ClientResponse handle(ClientRequest cr) throws ClientHandlerException { + String key = getKey(); + + if (cr.getProperties().containsKey(key)) { + return this.getNext().handle(cr); + } + cr.getProperties().put(key, this); + return doHandle(cr); + } + + /** + * Implemented by derived classes to provide the actual implementation for filtering. + * + * @param cr + * The ClientRequest being processed + * @return The returned ClientResponse + * @throws ClientHandlerException + */ + protected abstract ClientResponse doHandle(ClientRequest cr) throws ClientHandlerException; + + /** + * Get the key value used to detect multiple runs. By default, + * defaults to the class name for the filter. + * + * @return Key name as a string + */ + protected String getKey() { + return this.getClass().getName(); + } + +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/RetryPolicy.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/RetryPolicy.java index 26c6fbd0ca50..a3e1a6ac7418 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/RetryPolicy.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/RetryPolicy.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/RetryPolicyFilter.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/RetryPolicyFilter.java index 72686dcb2e20..7c0a56a69ff4 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/RetryPolicyFilter.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/RetryPolicyFilter.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/ServiceException.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/ServiceException.java index e9f292f180f9..2ea554ad89d1 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/ServiceException.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/ServiceException.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/ServiceFilter.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/ServiceFilter.java index 552202540bc3..b1e0029f567e 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/ServiceFilter.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/ServiceFilter.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/ServiceTimeoutException.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/ServiceTimeoutException.java index 9c3c5f7fcd13..4e67f7b21462 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/ServiceTimeoutException.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/ServiceTimeoutException.java @@ -1,5 +1,5 @@ /** - * Copyright 2012 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/AccessCondition.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/AccessCondition.java index c2a741ef3ed2..47397ee0ac67 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/AccessCondition.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/AccessCondition.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/AccessPolicyResponseBase.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/AccessPolicyResponseBase.java index 9e513711cdb3..7d03cb86b677 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/AccessPolicyResponseBase.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/AccessPolicyResponseBase.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/CloudStorageAccount.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/CloudStorageAccount.java index 8beb56163e4c..7cd92741ca6a 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/CloudStorageAccount.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/CloudStorageAccount.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/Constants.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/Constants.java index 61895ba9a162..021acc7a3ad8 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/Constants.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/Constants.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/Credentials.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/Credentials.java index 705075775610..db537f5414f7 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/Credentials.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/Credentials.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/DoesServiceRequest.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/DoesServiceRequest.java index 38a746f0058c..5bdcef196e7b 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/DoesServiceRequest.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/DoesServiceRequest.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/LeaseDuration.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/LeaseDuration.java index 8e795b831374..aef43c07da4b 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/LeaseDuration.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/LeaseDuration.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/LeaseState.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/LeaseState.java index 9bbd28f83ecd..39d192bffaff 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/LeaseState.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/LeaseState.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/LeaseStatus.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/LeaseStatus.java index b82ab088f0bc..15907a936e62 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/LeaseStatus.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/LeaseStatus.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/LoggingOperations.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/LoggingOperations.java index 026ac1bb7dd2..c862b6898518 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/LoggingOperations.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/LoggingOperations.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/LoggingProperties.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/LoggingProperties.java index 6bd41e128ac1..505145600910 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/LoggingProperties.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/LoggingProperties.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/MetricsLevel.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/MetricsLevel.java index 34d60db56b97..b702b05e4f0c 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/MetricsLevel.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/MetricsLevel.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/MetricsProperties.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/MetricsProperties.java index 1021376db038..e703379a73c0 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/MetricsProperties.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/MetricsProperties.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/OperationContext.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/OperationContext.java index 3a385289d1dd..7e6e3a3320da 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/OperationContext.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/OperationContext.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/RequestOptions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/RequestOptions.java index 9e6eb39b93c7..3dab216190a7 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/RequestOptions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/RequestOptions.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/RequestResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/RequestResult.java index 3a7e01045d6b..a6da602f8f4d 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/RequestResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/RequestResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/ResponseReceivedEvent.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/ResponseReceivedEvent.java index 3e8b028ad3de..f0b8419d1ab5 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/ResponseReceivedEvent.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/ResponseReceivedEvent.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/ResultContinuation.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/ResultContinuation.java index 618b05cf420c..13f4119312e2 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/ResultContinuation.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/ResultContinuation.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/ResultContinuationType.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/ResultContinuationType.java index 8e6497fae08f..02f564344f75 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/ResultContinuationType.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/ResultContinuationType.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/ResultSegment.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/ResultSegment.java index 39d2c8b73706..47f9648dc8e8 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/ResultSegment.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/ResultSegment.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/RetryExponentialRetry.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/RetryExponentialRetry.java index be5e2e96d37e..36b801ffb873 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/RetryExponentialRetry.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/RetryExponentialRetry.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/RetryLinearRetry.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/RetryLinearRetry.java index 27dc7184dbc3..7f6a5f312dac 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/RetryLinearRetry.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/RetryLinearRetry.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/RetryNoRetry.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/RetryNoRetry.java index 4fb976b0d876..b89c22e1acee 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/RetryNoRetry.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/RetryNoRetry.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/RetryPolicy.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/RetryPolicy.java index 8174c303b420..ade5dd23b56a 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/RetryPolicy.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/RetryPolicy.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/RetryPolicyFactory.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/RetryPolicyFactory.java index bda29486c9be..919c04d35a83 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/RetryPolicyFactory.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/RetryPolicyFactory.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/RetryResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/RetryResult.java index 30c3de7d38eb..92941950b3fa 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/RetryResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/RetryResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/SendingRequestEvent.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/SendingRequestEvent.java index 2e86fbe6166d..8b61f7e092ff 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/SendingRequestEvent.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/SendingRequestEvent.java @@ -1,5 +1,5 @@ /** - * Copyright 2012 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/ServiceClient.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/ServiceClient.java index baa4c1db0465..02f0322b2808 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/ServiceClient.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/ServiceClient.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/ServiceProperties.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/ServiceProperties.java index be0000a83643..6325e1af75ca 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/ServiceProperties.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/ServiceProperties.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/StorageCredentials.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/StorageCredentials.java index 84b4c194ac8f..009a71655746 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/StorageCredentials.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/StorageCredentials.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/StorageCredentialsAccountAndKey.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/StorageCredentialsAccountAndKey.java index 3406fc76c38b..2881295c1f26 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/StorageCredentialsAccountAndKey.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/StorageCredentialsAccountAndKey.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/StorageCredentialsAnonymous.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/StorageCredentialsAnonymous.java index e40a012049a5..baf4e16dd16d 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/StorageCredentialsAnonymous.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/StorageCredentialsAnonymous.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/StorageCredentialsSharedAccessSignature.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/StorageCredentialsSharedAccessSignature.java index 2f3e44a380ed..4702824027ff 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/StorageCredentialsSharedAccessSignature.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/StorageCredentialsSharedAccessSignature.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/StorageErrorCode.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/StorageErrorCode.java index 2482119f82bf..dabdb6069107 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/StorageErrorCode.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/StorageErrorCode.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/StorageErrorCodeStrings.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/StorageErrorCodeStrings.java index 624a31467311..3dee5cfadaea 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/StorageErrorCodeStrings.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/StorageErrorCodeStrings.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/StorageEvent.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/StorageEvent.java index 26dc212a185c..e6ecffbedadf 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/StorageEvent.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/StorageEvent.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/StorageEventMultiCaster.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/StorageEventMultiCaster.java index 844c7a04e899..f187a7ceb9c6 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/StorageEventMultiCaster.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/StorageEventMultiCaster.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/StorageException.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/StorageException.java index c01b13fbfdb9..a0a6f0f7349a 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/StorageException.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/StorageException.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/StorageExtendedErrorInformation.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/StorageExtendedErrorInformation.java index 0f261fa3d6b8..b70ced8c48a1 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/StorageExtendedErrorInformation.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/StorageExtendedErrorInformation.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/StorageKey.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/StorageKey.java index 915d8537828e..e2c2663069eb 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/StorageKey.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/StorageKey.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/Base64.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/Base64.java index 8062504e21c7..8e8c79aaaa2f 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/Base64.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/Base64.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/PathUtility.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/PathUtility.java index 7783f7e29548..b43d3144223c 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/PathUtility.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/PathUtility.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/StreamMd5AndLength.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/StreamMd5AndLength.java index 6df461d6df82..aac9c0819948 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/StreamMd5AndLength.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/StreamMd5AndLength.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/UriQueryBuilder.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/UriQueryBuilder.java index 60662b71c437..43b1865b1580 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/UriQueryBuilder.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/UriQueryBuilder.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/Utility.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/Utility.java index d290b1ec3a47..37c099517e7d 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/Utility.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/Utility.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/BaseRequest.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/BaseRequest.java index 910fb9f8958c..e5273db93f60 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/BaseRequest.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/BaseRequest.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/BaseResponse.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/BaseResponse.java index e47b64181ac9..e0412b996cda 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/BaseResponse.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/BaseResponse.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/BlobQueueFullCanonicalizer.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/BlobQueueFullCanonicalizer.java index ecd15ebc93e3..40bd6c148171 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/BlobQueueFullCanonicalizer.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/BlobQueueFullCanonicalizer.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/BlobQueueLiteCanonicalizer.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/BlobQueueLiteCanonicalizer.java index 0f795725f43c..5d36b8b7a169 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/BlobQueueLiteCanonicalizer.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/BlobQueueLiteCanonicalizer.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/Canonicalizer.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/Canonicalizer.java index d12785cbb8af..b78e9c258cd3 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/Canonicalizer.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/Canonicalizer.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/CanonicalizerFactory.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/CanonicalizerFactory.java index eb9cca300c04..54ae1d41fe3e 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/CanonicalizerFactory.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/CanonicalizerFactory.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/DeserializationHelper.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/DeserializationHelper.java index 18b561a6665f..99e9efae7d48 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/DeserializationHelper.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/DeserializationHelper.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/ExecutionEngine.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/ExecutionEngine.java index fd9ea785cffc..ba188fb37692 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/ExecutionEngine.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/ExecutionEngine.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/LazySegmentedIterable.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/LazySegmentedIterable.java index d57bb296fe28..02d2c76e3f09 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/LazySegmentedIterable.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/LazySegmentedIterable.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/LazySegmentedIterator.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/LazySegmentedIterator.java index e1f9f6ab116f..f43f0a41b8d5 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/LazySegmentedIterator.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/LazySegmentedIterator.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/LeaseAction.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/LeaseAction.java index b17a657c029d..91a1f7b95c08 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/LeaseAction.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/LeaseAction.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/ListingContext.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/ListingContext.java index fffe4ba5c296..6e28a1cddb5e 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/ListingContext.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/ListingContext.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/SegmentedStorageOperation.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/SegmentedStorageOperation.java index abdbc987ccc3..349428f12a72 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/SegmentedStorageOperation.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/SegmentedStorageOperation.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/StorageErrorResponse.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/StorageErrorResponse.java index 90a2713c5793..6a1cda8d4c22 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/StorageErrorResponse.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/StorageErrorResponse.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/StorageOperation.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/StorageOperation.java index 52d693f638dd..32ff5a00459a 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/StorageOperation.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/StorageOperation.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/TableLiteCanonicalizer.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/TableLiteCanonicalizer.java index d28fa2d96db4..913ed76d908a 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/TableLiteCanonicalizer.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/storage/utils/implementation/TableLiteCanonicalizer.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/CommaStringBuilder.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/CommaStringBuilder.java index ac8b9f45c519..55558ed7fd30 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/CommaStringBuilder.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/CommaStringBuilder.java @@ -1,5 +1,5 @@ /** - * Copyright 2012 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/DateFactory.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/DateFactory.java index 10db79d098ce..219a08a45ac9 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/DateFactory.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/DateFactory.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/DefaultDateFactory.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/DefaultDateFactory.java index 77e779fcf10b..b7fa4f4447df 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/DefaultDateFactory.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/DefaultDateFactory.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/Exports.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/Exports.java index c9960912fb97..179dafb31dcc 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/Exports.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/Exports.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/ServiceExceptionFactory.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/ServiceExceptionFactory.java index d11feceb6d20..2efac14c00b0 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/ServiceExceptionFactory.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/ServiceExceptionFactory.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/pipeline/Base64StringAdapter.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/pipeline/Base64StringAdapter.java index 7a28be44bed9..975bc675e4bb 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/pipeline/Base64StringAdapter.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/pipeline/Base64StringAdapter.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/pipeline/ClientConfigSettings.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/pipeline/ClientConfigSettings.java new file mode 100644 index 000000000000..b7421b9ed656 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/pipeline/ClientConfigSettings.java @@ -0,0 +1,99 @@ +/** + * 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.core.utils.pipeline; + +import com.sun.jersey.api.client.Client; +import com.sun.jersey.api.client.config.ClientConfig; +import com.sun.jersey.api.client.filter.LoggingFilter; + +/** + * Class used for injecting timeout settings into the various places that need it. + * + */ +public class ClientConfigSettings { + private static final int DEFAULT_TIMEOUT_MS = 90 * 1000; + + private final Integer connectTimeout; + private final Integer readTimeout; + private final boolean shouldLog; + + /** + * Construct a {@link ClientConfigSettings} object with the default + * settings. + */ + public ClientConfigSettings() { + connectTimeout = Integer.valueOf(null); + readTimeout = Integer.valueOf(null); + shouldLog = false; + } + + /** + * Construct a {@link ClientConfigSettings} object wit the given + * settings. + * + * @param connectTimeout + * Connection timeout in milliseconds + * @param readTimeout + * read timeout in milliseconds + * @param shouldLog + * if true, add logging filter to clients. + */ + public ClientConfigSettings(Object connectTimeout, Object readTimeout, boolean shouldLog) { + this.connectTimeout = getTimeout(connectTimeout); + this.readTimeout = getTimeout(readTimeout); + this.shouldLog = shouldLog; + } + + /** + * Update the given {@link ClientConfig} object with the appropriate + * settings from configuration. + * + * @param clientConfig + * object to update. + */ + public void applyConfig(ClientConfig clientConfig) { + clientConfig.getProperties().put(ClientConfig.PROPERTY_CONNECT_TIMEOUT, connectTimeout); + clientConfig.getProperties().put(ClientConfig.PROPERTY_READ_TIMEOUT, readTimeout); + } + + /** + * Update the given {@link client} object with the appropriate settings + * from configuration. + * + * @param client + */ + public void applyConfig(Client client) { + if (shouldLog) { + client.addFilter(new LoggingFilter()); + } + } + + private Integer getTimeout(Object timeoutValue) { + if (timeoutValue == null) { + return new Integer(DEFAULT_TIMEOUT_MS); + } + + if (timeoutValue instanceof Integer) { + return (Integer) timeoutValue; + } + + if (timeoutValue instanceof String) { + return Integer.valueOf((String) timeoutValue); + } + + throw new IllegalArgumentException("timeoutValue"); + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/pipeline/ClientFilterAdapter.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/pipeline/ClientFilterAdapter.java index f486cbbf1401..4af39301fccf 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/pipeline/ClientFilterAdapter.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/pipeline/ClientFilterAdapter.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/pipeline/EntityStreamingListener.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/pipeline/EntityStreamingListener.java index c3366788b5de..f0a2b98cfe68 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/pipeline/EntityStreamingListener.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/pipeline/EntityStreamingListener.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/pipeline/Exports.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/pipeline/Exports.java index d5b9ddc05ce9..23b7ae821526 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/pipeline/Exports.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/pipeline/Exports.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. @@ -15,7 +15,6 @@ package com.microsoft.windowsazure.services.core.utils.pipeline; import java.util.Map; -import java.util.Map.Entry; import com.microsoft.windowsazure.services.core.Builder; import com.microsoft.windowsazure.services.core.Builder.Registry; @@ -32,39 +31,21 @@ public void register(Registry registry) { @Override public ClientConfig create(String profile, Builder builder, Map properties) { ClientConfig clientConfig = new DefaultClientConfig(); - profile = normalizeProfile(profile); - - // Lower levels of the stack assume timeouts are set. - // Set default timeout on clientConfig in case user - // hasn't set it yet in their configuration - - clientConfig.getProperties().put(ClientConfig.PROPERTY_CONNECT_TIMEOUT, new Integer(90 * 1000)); - clientConfig.getProperties().put(ClientConfig.PROPERTY_READ_TIMEOUT, new Integer(90 * 1000)); + ClientConfigSettings settings = builder.build(profile, ClientConfigSettings.class, properties); + settings.applyConfig(clientConfig); + return clientConfig; + } + }); - for (Entry entry : properties.entrySet()) { - Object propertyValue = entry.getValue(); - String propertyKey = entry.getKey(); + registry.add(new Builder.Factory() { - if (propertyKey.equals(profile + Configuration.PROPERTY_CONNECT_TIMEOUT)) { - propertyKey = ClientConfig.PROPERTY_CONNECT_TIMEOUT; - } - if (propertyKey.equals(profile + Configuration.PROPERTY_READ_TIMEOUT)) { - propertyKey = ClientConfig.PROPERTY_READ_TIMEOUT; - } + @Override + public ClientConfigSettings create(String profile, Builder builder, Map properties) { + Object connectTimeout = getPropertyIfExists(profile, properties, Configuration.PROPERTY_CONNECT_TIMEOUT); + Object readTimeout = getPropertyIfExists(profile, properties, Configuration.PROPERTY_READ_TIMEOUT); - // ClientConfig requires instance of Integer to properly set - // timeouts, but config file will deliver strings. Special - // case these timeout properties and convert them to Integer - // if necessary. - if (propertyKey.equals(ClientConfig.PROPERTY_CONNECT_TIMEOUT) - || propertyKey.equals(ClientConfig.PROPERTY_READ_TIMEOUT)) { - if (propertyValue instanceof String) { - propertyValue = Integer.valueOf((String) propertyValue); - } - } - clientConfig.getProperties().put(propertyKey, propertyValue); - } - return clientConfig; + return new ClientConfigSettings(connectTimeout, readTimeout, getPropertyIfExists(profile, properties, + Configuration.PROPERTY_LOG_HTTP_REQUESTS) != null); } }); @@ -72,7 +53,9 @@ public ClientConfig create(String profile, Builder builder, Map @Override public Client create(String profile, Builder builder, Map properties) { ClientConfig clientConfig = builder.build(profile, ClientConfig.class, properties); + ClientConfigSettings settings = builder.build(profile, ClientConfigSettings.class, properties); Client client = Client.create(clientConfig); + settings.applyConfig(client); return client; } }); @@ -81,15 +64,16 @@ public Client create(String profile, Builder builder, Map proper @Override public HttpURLConnectionClient create(String profile, Builder builder, Map properties) { ClientConfig clientConfig = builder.build(profile, ClientConfig.class, properties); + ClientConfigSettings settings = builder.build(profile, ClientConfigSettings.class, properties); HttpURLConnectionClient client = HttpURLConnectionClient.create(clientConfig); - //client.addFilter(new LoggingFilter()); + settings.applyConfig(client); return client; } }); } private static String normalizeProfile(String profile) { - if (profile == null) { + if (profile == null || profile.equals("")) { return ""; } @@ -99,4 +83,13 @@ private static String normalizeProfile(String profile) { return profile + "."; } + + private static Object getPropertyIfExists(String profile, Map properties, String propertyName) { + String fullPropertyName = normalizeProfile(profile) + propertyName; + + if (properties.containsKey(fullPropertyName)) { + return properties.get(fullPropertyName); + } + return null; + } } diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/pipeline/HttpURLConnectionClient.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/pipeline/HttpURLConnectionClient.java index f996e5edc642..a5751d7480b5 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/pipeline/HttpURLConnectionClient.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/pipeline/HttpURLConnectionClient.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/pipeline/HttpURLConnectionClientHandler.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/pipeline/HttpURLConnectionClientHandler.java index 83e0822264e4..4cd755578a75 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/pipeline/HttpURLConnectionClientHandler.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/pipeline/HttpURLConnectionClientHandler.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/pipeline/PipelineHelpers.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/pipeline/PipelineHelpers.java index 7f117707aafc..c022ab06a799 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/pipeline/PipelineHelpers.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/core/utils/pipeline/PipelineHelpers.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/Exports.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/Exports.java new file mode 100644 index 000000000000..dfd199c90b9b --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/Exports.java @@ -0,0 +1,80 @@ +/** + * 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; + +import java.util.Map; + +import javax.xml.bind.JAXBException; +import javax.xml.parsers.ParserConfigurationException; + +import com.microsoft.windowsazure.services.core.Builder; +import com.microsoft.windowsazure.services.media.implementation.MediaContentProvider; +import com.microsoft.windowsazure.services.media.implementation.MediaExceptionProcessor; +import com.microsoft.windowsazure.services.media.implementation.MediaRestProxy; +import com.microsoft.windowsazure.services.media.implementation.OAuthContract; +import com.microsoft.windowsazure.services.media.implementation.OAuthFilter; +import com.microsoft.windowsazure.services.media.implementation.OAuthRestProxy; +import com.microsoft.windowsazure.services.media.implementation.OAuthTokenManager; +import com.microsoft.windowsazure.services.media.implementation.ODataEntityCollectionProvider; +import com.microsoft.windowsazure.services.media.implementation.ODataEntityProvider; +import com.microsoft.windowsazure.services.media.implementation.RedirectFilter; +import com.microsoft.windowsazure.services.media.implementation.ResourceLocationManager; +import com.microsoft.windowsazure.services.media.implementation.VersionHeadersFilter; +import com.sun.jersey.api.client.config.ClientConfig; +import com.sun.jersey.api.json.JSONConfiguration; + +public class Exports implements Builder.Exports { + + /** + * register the Media services. + */ + @Override + public void register(Builder.Registry registry) { + registry.add(MediaContract.class, MediaExceptionProcessor.class); + registry.add(MediaRestProxy.class); + registry.add(OAuthContract.class, OAuthRestProxy.class); + registry.add(OAuthTokenManager.class); + registry.add(OAuthFilter.class); + registry.add(ResourceLocationManager.class); + registry.add(RedirectFilter.class); + registry.add(VersionHeadersFilter.class); + + registry.alter(ClientConfig.class, new Builder.Alteration() { + @SuppressWarnings("rawtypes") + @Override + public ClientConfig alter(ClientConfig instance, Builder builder, Map properties) { + + instance.getProperties().put(JSONConfiguration.FEATURE_POJO_MAPPING, true); + + // Turn off auto-follow redirects, because Media Services rest calls break if it's on + instance.getProperties().put(ClientConfig.PROPERTY_FOLLOW_REDIRECTS, false); + + try { + instance.getSingletons().add(new ODataEntityProvider()); + instance.getSingletons().add(new ODataEntityCollectionProvider()); + instance.getSingletons().add(new MediaContentProvider()); + } + catch (JAXBException e) { + throw new RuntimeException(e); + } + catch (ParserConfigurationException e) { + throw new RuntimeException(e); + } + + return instance; + } + }); + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/MediaConfiguration.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/MediaConfiguration.java new file mode 100644 index 000000000000..f25537df87f4 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/MediaConfiguration.java @@ -0,0 +1,165 @@ +/** + * 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; + +import com.microsoft.windowsazure.services.core.Configuration; + +/** + * Provides functionality to create a media services configuration. + * + */ +public class MediaConfiguration { + + /** + * Defines the media service configuration URI constant. + * + */ + public static final String URI = "media.uri"; + + /** + * Defines the OAUTH configuration URI constant. + * + */ + public static final String OAUTH_URI = "media.oauth.uri"; + + /** + * Defines the OAUTH configuration client ID constant. + * + */ + public static final String OAUTH_CLIENT_ID = "media.oauth.client.id"; + + /** + * Defines the OAUTH configuration client secret constant. + * + */ + public static final String OAUTH_CLIENT_SECRET = "media.oauth.client.secret"; + + /** + * Defines the SCOPE of the media service sent to OAUTH. + */ + public static final String OAUTH_SCOPE = "media.oauth.scope"; + + /** + * Creates a media service configuration using the specified media service base URI, OAUTH URI, + * client ID, and client secret. + * + * @param mediaServiceUri + * A String object that represents the media service URI. + * + * @param oAuthUri + * A String object that represents the OAUTH URI. + * + * @param clientId + * A String object that represents the client ID. + * + * @param clientSecret + * A String object that represents the client secret. + * + * @param scope + * A String object that represents the scope. + * + * @return + * A Configuration object that can be used when creating an instance of the + * MediaService class. + * + */ + public static Configuration configureWithOAuthAuthentication(String mediaServiceUri, String oAuthUri, + String clientId, String clientSecret, String scope) { + return configureWithOAuthAuthentication(null, Configuration.getInstance(), mediaServiceUri, oAuthUri, clientId, + clientSecret, scope); + } + + /** + * Creates a media service configuration using the specified configuration, media service base URI, OAuth URI, + * client ID, and client secret. + * + * @param configuration + * A previously instantiated Configuration object. + * + * @param mediaServiceUri + * A String object that represents the URI of media service. + * + * @param oAuthUri + * A String object that represents the URI of OAuth service. + * + * @param clientId + * A String object that represents the client ID. + * + * @param clientSecret + * A String object that represents the client secret. + * + * @param scope + * A String object that represents the scope. + * + * @return + * A Configuration object that can be used when creating an instance of the + * MediaService class. + * + */ + public static Configuration configureWithOAuthAuthentication(Configuration configuration, String mediaServiceUri, + String oAuthUri, String clientId, String clientSecret, String scope) { + return configureWithOAuthAuthentication(null, configuration, mediaServiceUri, oAuthUri, clientId, clientSecret, + scope); + } + + /** + * Creates a media service configuration using the specified profile, configuration, media service base URI, + * OAuth URI, client ID, and client secret. + * + * @param profile + * A String object that represents the profile. + * + * @param configuration + * A previously instantiated Configuration object. + * + * @param mediaServiceUri + * A String object that represents the URI of media service. + * + * @param oAuthUri + * A String object that represents the URI of OAUTH service. + * + * @param clientId + * A String object that represents the client ID. + * + * @param clientSecret + * A String object that represents the client secret. + * + * @param scope + * A String object that represents the scope. + * + * @return + * A Configuration object that can be used when creating an instance of the + * MediaService class. + * + */ + public static Configuration configureWithOAuthAuthentication(String profile, Configuration configuration, + String mediaServiceUri, String oAuthUri, String clientId, String clientSecret, String scope) { + + if (profile == null) { + profile = ""; + } + else if (profile.length() != 0 && !profile.endsWith(".")) { + profile = profile + "."; + } + + configuration.setProperty(profile + URI, mediaServiceUri); + configuration.setProperty(profile + OAUTH_URI, oAuthUri); + configuration.setProperty(profile + OAUTH_CLIENT_ID, clientId); + configuration.setProperty(profile + OAUTH_CLIENT_SECRET, clientSecret); + configuration.setProperty(profile + OAUTH_SCOPE, scope); + + return configuration; + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/MediaContract.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/MediaContract.java new file mode 100644 index 000000000000..a6affe44503d --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/MediaContract.java @@ -0,0 +1,36 @@ +/** + * 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; + +import com.microsoft.windowsazure.services.core.FilterableService; +import com.microsoft.windowsazure.services.media.entityoperations.EntityContract; +import com.microsoft.windowsazure.services.media.models.LocatorInfo; + +/** + * Contract for interacting with the back end of Media Services + * + */ +public interface MediaContract extends FilterableService, EntityContract { + /** + * Creates an instance of the WritableBlobContainerContract API that will + * write to the blob container given by the provided locator. + * + * @param locator + * locator specifying where to upload to + * @return the implementation of WritableBlobContainerContract + */ + WritableBlobContainerContract createBlobWriter(LocatorInfo locator); +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/MediaService.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/MediaService.java new file mode 100644 index 000000000000..8a90501dc2fe --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/MediaService.java @@ -0,0 +1,67 @@ +/** + * 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; + +import com.microsoft.windowsazure.services.core.Configuration; + +/** + * + * Access media services functionality. This class cannot + * be instantiated. + * + */ +public class MediaService { + + private MediaService() { + } + + /** + * Creates an instance of the MediaServicesContract API. + * + */ + public static MediaContract create() { + return Configuration.getInstance().create(MediaContract.class); + } + + /** + * Creates an instance of the MediaServicesContract API using the specified configuration. + * + * @param config + * A Configuration object that represents the configuration for the service bus service. + * + */ + public static MediaContract create(Configuration config) { + return config.create(MediaContract.class); + } + + /** + * Creates an instance of the MediaServicesContract API. + * + */ + public static MediaContract create(String profile) { + return Configuration.getInstance().create(profile, MediaContract.class); + } + + /** + * Creates an instance of the MediaServicesContract API using the specified configuration. + * + * @param config + * A Configuration object that represents the configuration for the service bus service. + * + */ + public static MediaContract create(String profile, Configuration config) { + return config.create(profile, MediaContract.class); + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/WritableBlobContainerContract.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/WritableBlobContainerContract.java new file mode 100644 index 000000000000..835cc2ec8954 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/WritableBlobContainerContract.java @@ -0,0 +1,118 @@ +/** + * 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; + +import java.io.InputStream; + +import com.microsoft.windowsazure.services.blob.models.BlockList; +import com.microsoft.windowsazure.services.blob.models.CommitBlobBlocksOptions; +import com.microsoft.windowsazure.services.blob.models.CreateBlobBlockOptions; +import com.microsoft.windowsazure.services.blob.models.CreateBlobOptions; +import com.microsoft.windowsazure.services.blob.models.CreateBlobResult; +import com.microsoft.windowsazure.services.core.FilterableService; +import com.microsoft.windowsazure.services.core.ServiceException; + +/** + * The Interface WritableBlobContainerContract. + */ +public interface WritableBlobContainerContract extends FilterableService { + + /** + * Creates the block blob. + * + * @param blob + * the blob + * @param contentStream + * the content stream + * @return the creates the blob result + * @throws ServiceException + * the service exception + */ + CreateBlobResult createBlockBlob(String blob, InputStream contentStream) throws ServiceException; + + /** + * Creates the block blob. + * + * @param blob + * the blob + * @param contentStream + * the content stream + * @param options + * the options + * @return the creates the blob result + * @throws ServiceException + * the service exception + */ + CreateBlobResult createBlockBlob(String blob, InputStream contentStream, CreateBlobOptions options) + throws ServiceException; + + /** + * Creates the blob block. + * + * @param blob + * the blob + * @param blockId + * the block id + * @param contentStream + * the content stream + * @throws ServiceException + * the service exception + */ + void createBlobBlock(String blob, String blockId, InputStream contentStream) throws ServiceException; + + /** + * Creates the blob block. + * + * @param blob + * the blob + * @param blockId + * the block id + * @param contentStream + * the content stream + * @param options + * the options + * @throws ServiceException + * the service exception + */ + void createBlobBlock(String blob, String blockId, InputStream contentStream, CreateBlobBlockOptions options) + throws ServiceException; + + /** + * Commit blob blocks. + * + * @param blob + * the blob + * @param blockList + * the block list + * @throws ServiceException + * the service exception + */ + void commitBlobBlocks(String blob, BlockList blockList) throws ServiceException; + + /** + * Commit blob blocks. + * + * @param blob + * the blob + * @param blockList + * the block list + * @param options + * the options + * @throws ServiceException + * the service exception + */ + void commitBlobBlocks(String blob, BlockList blockList, CommitBlobBlocksOptions options) throws ServiceException; +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/DefaultActionOperation.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/DefaultActionOperation.java new file mode 100644 index 000000000000..df08ea0e749a --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/DefaultActionOperation.java @@ -0,0 +1,172 @@ +/** + * 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.entityoperations; + +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedMap; + +import com.microsoft.windowsazure.services.core.ServiceException; +import com.microsoft.windowsazure.services.core.utils.pipeline.PipelineHelpers; +import com.sun.jersey.api.client.ClientResponse; +import com.sun.jersey.core.util.MultivaluedMapImpl; + +/** + * Generic implementation of Delete operation usable by most entities. + */ +public class DefaultActionOperation implements EntityActionOperation { + + /** The proxy data. */ + private EntityProxyData proxyData; + + /** The name. */ + protected String name; + + /** The content type. */ + private MediaType contentType = MediaType.APPLICATION_ATOM_XML_TYPE; + + /** The accept type. */ + private MediaType acceptType = MediaType.APPLICATION_ATOM_XML_TYPE; + + /** The query parameters. */ + protected MultivaluedMap queryParameters; + + /** + * The default action operation. + * + * @param name + * the name + */ + public DefaultActionOperation(String name) { + this(); + this.name = name; + } + + /** + * Instantiates a new default action operation. + */ + public DefaultActionOperation() { + this.queryParameters = new MultivaluedMapImpl(); + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityOperation#setProxyData(com.microsoft.windowsazure.services.media.entityoperations.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 + public String getUri() { + return name; + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityActionOperation#getQueryParameters() + */ + @Override + public MultivaluedMap getQueryParameters() { + return this.queryParameters; + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityActionOperation#addQueryParameter(java.lang.String, java.lang.String) + */ + @Override + public DefaultActionOperation addQueryParameter(String key, String value) { + this.queryParameters.add(key, value); + return this; + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityOperation#getContentType() + */ + @Override + public MediaType getContentType() { + return this.contentType; + } + + /** + * Sets the content type. + * + * @param contentType + * the content type + * @return the default action operation + */ + @Override + public DefaultActionOperation setContentType(MediaType contentType) { + this.contentType = contentType; + return this; + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityOperation#getAcceptType() + */ + @Override + public MediaType getAcceptType() { + return this.acceptType; + } + + /** + * Sets the accept type. + * + * @param acceptType + * the accept type + * @return the default action operation + */ + public DefaultActionOperation setAcceptType(MediaType acceptType) { + this.acceptType = acceptType; + return this; + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityActionOperation#getVerb() + */ + @Override + public String getVerb() { + return "GET"; + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityActionOperation#getRequestContents() + */ + @Override + public Object getRequestContents() { + return null; + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityOperation#processResponse(java.lang.Object) + */ + @Override + public Object processResponse(Object rawResponse) throws ServiceException { + PipelineHelpers.ThrowIfNotSuccess((ClientResponse) rawResponse); + return rawResponse; + } + +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/DefaultDeleteOperation.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/DefaultDeleteOperation.java new file mode 100644 index 000000000000..352e4b362d11 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/DefaultDeleteOperation.java @@ -0,0 +1,57 @@ +/** + * 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.entityoperations; + +/** + * Generic implementation of Delete operation usable by most entities + * + */ +public class DefaultDeleteOperation implements EntityDeleteOperation { + private final EntityOperationBase.EntityUriBuilder uriBuilder; + private EntityProxyData proxyData; + + /** + * + */ + public DefaultDeleteOperation(String entityUri, String entityId) { + uriBuilder = new EntityOperationBase.EntityIdUriBuilder(entityUri, entityId); + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityDeleteOperation#setProxyData(com.microsoft.windowsazure.services.media.entityoperations.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 + public String getUri() { + return uriBuilder.getUri(); + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/DefaultEntityTypeActionOperation.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/DefaultEntityTypeActionOperation.java new file mode 100644 index 000000000000..d5e480a3bf9d --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/DefaultEntityTypeActionOperation.java @@ -0,0 +1,165 @@ +/** + * 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.entityoperations; + +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedMap; + +import com.microsoft.windowsazure.services.core.ServiceException; +import com.sun.jersey.api.client.ClientResponse; +import com.sun.jersey.core.util.MultivaluedMapImpl; + +/** + * The Class DefaultTypeActionOperation. + * + * @param + * the generic type + */ +public class DefaultEntityTypeActionOperation implements EntityTypeActionOperation { + + /** The name. */ + private String name; + + /** The content type. */ + private MediaType contentType = MediaType.APPLICATION_ATOM_XML_TYPE; + + /** The accept type. */ + private MediaType acceptType = MediaType.APPLICATION_ATOM_XML_TYPE; + + /** The query parameters. */ + private final MultivaluedMap queryParameters; + + /** The proxy data. */ + protected EntityProxyData proxyData; + + /** + * Instantiates a new default type action operation. + * + * @param name + * the name + */ + public DefaultEntityTypeActionOperation(String name) { + this(); + this.name = name; + } + + /** + * Instantiates a new default type action operation. + */ + public DefaultEntityTypeActionOperation() { + this.queryParameters = new MultivaluedMapImpl(); + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityTypeActionOperation#processTypeResponse(com.sun.jersey.api.client.ClientResponse) + */ + @Override + public T processTypeResponse(ClientResponse clientResponse) { + return null; + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityTypeActionOperation#getQueryParameters() + */ + @Override + public MultivaluedMap getQueryParameters() { + return this.queryParameters; + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityTypeActionOperation#getVerb() + */ + @Override + public String getVerb() { + return "GET"; + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityTypeActionOperation#getRequestContents() + */ + @Override + public Object getRequestContents() { + return null; + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityOperation#setProxyData(com.microsoft.windowsazure.services.media.entityoperations.EntityProxyData) + */ + @Override + public void setProxyData(EntityProxyData proxyData) { + this.proxyData = proxyData; + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityOperation#getUri() + */ + @Override + public String getUri() { + return this.name; + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityOperation#getContentType() + */ + @Override + public MediaType getContentType() { + return this.contentType; + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityOperation#getAcceptType() + */ + @Override + public MediaType getAcceptType() { + return this.acceptType; + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityOperation#processResponse(java.lang.Object) + */ + @Override + public Object processResponse(Object rawResponse) throws ServiceException { + return null; + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityTypeActionOperation#addQueryParameter(java.lang.String, java.lang.String) + */ + @Override + public DefaultEntityTypeActionOperation addQueryParameter(String key, String value) { + this.queryParameters.add(key, value); + return this; + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityTypeActionOperation#setContentType(javax.ws.rs.core.MediaType) + */ + @Override + public EntityTypeActionOperation setContentType(MediaType contentType) { + this.contentType = contentType; + return this; + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityTypeActionOperation#setAcceptType(javax.ws.rs.core.MediaType) + */ + @Override + public EntityTypeActionOperation setAcceptType(MediaType acceptType) { + this.acceptType = acceptType; + return this; + } + +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/DefaultGetOperation.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/DefaultGetOperation.java new file mode 100644 index 000000000000..29a5f2650207 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/DefaultGetOperation.java @@ -0,0 +1,49 @@ +/** + * 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.entityoperations; + +/** + * Generic implementation of the get operation usable for most entities + * + */ +public class DefaultGetOperation extends EntityOperationSingleResultBase implements EntityGetOperation { + + /** + * 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 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 responseClass) { + super(uri, responseClass); + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/DefaultListOperation.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/DefaultListOperation.java new file mode 100644 index 000000000000..0aa1ab4eec67 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/DefaultListOperation.java @@ -0,0 +1,106 @@ +/** + * 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.entityoperations; + +import javax.ws.rs.core.MultivaluedMap; + +import com.microsoft.windowsazure.services.core.ServiceException; +import com.microsoft.windowsazure.services.media.models.ListResult; +import com.sun.jersey.api.client.GenericType; +import com.sun.jersey.core.util.MultivaluedMapImpl; + +/** + * Generic implementation of the list operation, usable by most entities + * + */ +public class DefaultListOperation extends EntityOperationBase implements EntityListOperation { + private final MultivaluedMap queryParameters; + private final GenericType> responseType; + + public DefaultListOperation(String entityUri, GenericType> responseType) { + super(entityUri); + queryParameters = new MultivaluedMapImpl(); + this.responseType = responseType; + } + + public DefaultListOperation(String entityUri, GenericType> responseType, + MultivaluedMap queryParameters) { + this(entityUri, responseType); + 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 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 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 set(String parameterName, String parameterValue) { + queryParameters.add(parameterName, parameterValue); + return this; + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entities.EntityListOperation#getQueryParameters() + */ + @Override + public MultivaluedMap getQueryParameters() { + return queryParameters; + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entities.EntityListOperation#getResponseGenericType() + */ + @Override + public GenericType> getResponseGenericType() { + return responseType; + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityOperationBase#processResponse(java.lang.Object) + */ + @Override + public Object processResponse(Object rawResponse) throws ServiceException { + return rawResponse; + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityActionOperation.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityActionOperation.java new file mode 100644 index 000000000000..25e272ca8269 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityActionOperation.java @@ -0,0 +1,67 @@ +/** + * 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.entityoperations; + +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedMap; + +/** + * Action operation for Entities. + */ +public interface EntityActionOperation extends EntityOperation { + + /** + * Gets the query parameters. + * + * @return the query parameters + */ + MultivaluedMap getQueryParameters(); + + /** + * Adds the query parameter. + * + * @param key + * the key + * @param value + * the value + * @return the entity action operation + */ + EntityActionOperation addQueryParameter(String key, String value); + + /** + * Gets the verb. + * + * @return the verb + */ + String getVerb(); + + /** + * Gets the request contents. + * + * @return the request contents + */ + Object getRequestContents(); + + /** + * Sets the content type. + * + * @param contentType + * the content type + * @return the default action operation + */ + EntityActionOperation setContentType(MediaType contentType); + +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityBatchOperation.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityBatchOperation.java new file mode 100644 index 000000000000..ec29588bd649 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityBatchOperation.java @@ -0,0 +1,79 @@ +/* + * 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.entityoperations; + +import javax.xml.bind.JAXBElement; +import javax.xml.namespace.QName; + +import com.microsoft.windowsazure.services.media.implementation.atom.ContentType; +import com.microsoft.windowsazure.services.media.implementation.atom.EntryType; +import com.microsoft.windowsazure.services.media.implementation.atom.LinkType; +import com.microsoft.windowsazure.services.media.implementation.content.Constants; + +public class EntityBatchOperation { + + protected String verb; + protected EntryType entryType; + + public EntityBatchOperation() { + this.entryType = new EntryType(); + } + + public EntryType getEntryType() { + return entryType; + } + + public EntityBatchOperation setEntityType(EntryType entryType) { + this.entryType = entryType; + return this; + } + + protected EntityBatchOperation setVerb(String verb) { + this.verb = verb; + return this; + } + + public String getVerb() { + return this.verb; + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + public EntityBatchOperation addContentObject(Object contentObject) { + ContentType atomContent = new ContentType(); + atomContent.setType("application/xml"); + atomContent.getContent().add( + new JAXBElement(new QName(Constants.ODATA_METADATA_NS, "properties"), contentObject.getClass(), + contentObject)); + + this.entryType.getEntryChildren().add( + new JAXBElement(new QName(Constants.ATOM_NS, "content"), ContentType.class, atomContent)); + return this; + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + protected EntityBatchOperation addLink(String title, String href, String type, String rel) { + LinkType linkType = new LinkType(); + linkType.setTitle(title); + linkType.setHref(href); + linkType.setType(type); + linkType.setRel(rel); + this.entryType.getEntryChildren().add( + new JAXBElement(new QName(Constants.ATOM_NS, "link"), LinkType.class, linkType)); + return this; + + } + +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityContract.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityContract.java new file mode 100644 index 000000000000..d42fcdc14d30 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityContract.java @@ -0,0 +1,112 @@ +/** + * 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.entityoperations; + +import com.microsoft.windowsazure.services.core.ServiceException; +import com.microsoft.windowsazure.services.media.models.ListResult; + +/** + * Contract for interacting with the back end service + * providing various odata entities. + * + */ +public interface EntityContract { + + /** + * Create a new instance of an entity. + * + * @param + * the generic type + * @param creator + * Object providing the details of the entity to be + * created + * @return the t + * @throws ServiceException + * the service exception + * The created entity + */ + public abstract T create(EntityCreateOperation creator) throws ServiceException; + + /** + * Retrieve an existing entity by id. + * + * @param + * the generic type + * @param getter + * object providing the details of the entity to be retrieved + * @return The retrieved entity + * @throws ServiceException + * the service exception + */ + public abstract T get(EntityGetOperation getter) throws ServiceException; + + /** + * Retrieve a list of entities. + * + * @param + * the generic type + * @param lister + * object providing details of entities to list + * @return The resulting list + * @throws ServiceException + * the service exception + */ + public abstract ListResult list(EntityListOperation lister) throws ServiceException; + + /** + * Update an existing entity. + * + * @param updater + * Object providing details of the update + * @throws ServiceException + * the service exception + */ + public abstract void update(EntityUpdateOperation updater) throws ServiceException; + + /** + * Delete an entity. + * + * @param deleter + * Object providing details of the delete + * @throws ServiceException + * the service exception + */ + public abstract void delete(EntityDeleteOperation deleter) throws ServiceException; + + /** + * Perform an action on an entity. + * + * @param action + * Object providing details of the action + * @throws ServiceException + * the service exception + */ + public abstract void action(EntityActionOperation action) throws ServiceException; + + /** + * Action. + * + * @param + * the generic type + * @param entityActionOperation + * the entity action operation + * @return the t + * @throws ServiceException + * the service exception + */ + public abstract T action(EntityTypeActionOperation entityActionOperation) throws ServiceException; + +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityCreateOperation.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityCreateOperation.java new file mode 100644 index 000000000000..f4bae23cf56c --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityCreateOperation.java @@ -0,0 +1,38 @@ +/** + * 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.entityoperations; + +import com.microsoft.windowsazure.services.core.ServiceException; + +/** + * The Interface EntityCreateOperation. + * + * @param + * the generic type + */ +public interface EntityCreateOperation extends EntityOperationSingleResult { + + /** + * Get the object to be sent to the server containing + * the request data for entity creation. + * + * @return The payload to be marshalled and sent to the server. + * @throws ServiceException + * the service exception + */ + Object getRequestContents() throws ServiceException; + +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityDeleteOperation.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityDeleteOperation.java new file mode 100644 index 000000000000..c0203287e094 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityDeleteOperation.java @@ -0,0 +1,33 @@ +/** + * 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.entityoperations; + +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 + * + * @return The uri + */ + String getUri(); +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityGetOperation.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityGetOperation.java new file mode 100644 index 000000000000..b39759add5f3 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityGetOperation.java @@ -0,0 +1,24 @@ +/** + * 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.entityoperations; + + +/** + * Get operation for Entities + * + */ +public interface EntityGetOperation extends EntityOperationSingleResult { +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityLinkOperation.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityLinkOperation.java new file mode 100644 index 000000000000..19503c49548f --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityLinkOperation.java @@ -0,0 +1,149 @@ +/** + * 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.entityoperations; + +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.net.URLEncoder; +import java.security.InvalidParameterException; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBElement; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Marshaller; +import javax.xml.namespace.QName; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.w3c.dom.Document; + +import com.microsoft.windowsazure.services.media.implementation.content.Constants; +import com.microsoft.windowsazure.services.media.implementation.content.MediaUriType; + +/** + * Generic implementation of $link operation of two entities. + */ +public class EntityLinkOperation extends DefaultActionOperation { + + /** The primary entity set. */ + private final String primaryEntitySet; + + /** The primary entity id. */ + private final String primaryEntityId; + + /** The secondary entity set. */ + private final String secondaryEntitySet; + + /** The secondary entity uri. */ + private final URI secondaryEntityUri; + + /** The jaxb context. */ + private final JAXBContext jaxbContext; + + /** The marshaller. */ + private final Marshaller marshaller; + + /** The document builder. */ + private final DocumentBuilder documentBuilder; + + /** The document builder factory. */ + private final DocumentBuilderFactory documentBuilderFactory; + + /** + * Instantiates a new entity link operation. + * + * @param primaryEntitySet + * the primary entity set + * @param primaryEntityId + * the primary entity id + * @param secondaryEntitySet + * the secondary entity set + * @param secondaryEntityUri + * the secondary entity uri + */ + public EntityLinkOperation(String primaryEntitySet, String primaryEntityId, String secondaryEntitySet, + URI secondaryEntityUri) { + super(); + this.primaryEntitySet = primaryEntitySet; + this.primaryEntityId = primaryEntityId; + this.secondaryEntitySet = secondaryEntitySet; + this.secondaryEntityUri = secondaryEntityUri; + try { + jaxbContext = JAXBContext.newInstance(MediaUriType.class); + } + catch (JAXBException e) { + throw new RuntimeException(e); + } + try { + marshaller = jaxbContext.createMarshaller(); + } + catch (JAXBException e) { + throw new RuntimeException(e); + } + documentBuilderFactory = DocumentBuilderFactory.newInstance(); + try { + documentBuilder = documentBuilderFactory.newDocumentBuilder(); + } + catch (ParserConfigurationException e) { + throw new RuntimeException(e); + } + + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entities.EntityDeleteOperation#getUri() + */ + @Override + public String getUri() { + String escapedEntityId; + try { + escapedEntityId = URLEncoder.encode(primaryEntityId, "UTF-8"); + } + catch (UnsupportedEncodingException e) { + throw new InvalidParameterException("UTF-8 encoding is not supported."); + } + return String.format("%s('%s')/$links/%s", primaryEntitySet, escapedEntityId, secondaryEntitySet); + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.DefaultActionOperation#getVerb() + */ + @Override + public String getVerb() { + return "POST"; + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.DefaultActionOperation#getRequestContents() + */ + @Override + public Object getRequestContents() { + MediaUriType mediaUriType = new MediaUriType(); + mediaUriType.setUri(getProxyData().getServiceUri().toString() + this.secondaryEntityUri.toString()); + JAXBElement mediaUriTypeElement = new JAXBElement(new QName( + Constants.ODATA_DATA_NS, "uri"), MediaUriType.class, mediaUriType); + Document document = documentBuilder.newDocument(); + document.setXmlStandalone(true); + try { + marshaller.marshal(mediaUriTypeElement, document); + } + catch (JAXBException e) { + throw new RuntimeException(e); + } + return document; + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityListOperation.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityListOperation.java new file mode 100644 index 000000000000..80d0d146a89b --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityListOperation.java @@ -0,0 +1,42 @@ +/** + * 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.entityoperations; + +import javax.ws.rs.core.MultivaluedMap; + +import com.microsoft.windowsazure.services.media.models.ListResult; +import com.sun.jersey.api.client.GenericType; + +/** + * Operation class to retrieve a list of entities + * + */ +public interface EntityListOperation extends EntityOperation { + + /** + * Get query parameters to add to the uri + * + * @return The query parameters collection + */ + MultivaluedMap getQueryParameters(); + + /** + * Get a GenericType object representing the result list type + * + * @return the type of the operation's result + */ + GenericType> getResponseGenericType(); +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityOperation.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityOperation.java new file mode 100644 index 000000000000..6ac4b38c6f08 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityOperation.java @@ -0,0 +1,62 @@ +/** + * 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.entityoperations; + +import javax.ws.rs.core.MediaType; + +import com.microsoft.windowsazure.services.core.ServiceException; + +public interface EntityOperation { + + /** + * Supplies the current proxy information to the action. + * + * @param proxyData + * @return + */ + public void setProxyData(EntityProxyData proxyData); + + /** + * Get the URI the creation request should be sent to. + * + * @return The uri + */ + public abstract String getUri(); + + /** + * Get the MIME type for the content that's being sent to the server. + * + * @return The MIME type + * @throws ServiceException + */ + public abstract MediaType getContentType(); + + /** + * Get the MIME type that we're expecting the server to send back. + */ + public abstract MediaType getAcceptType(); + + /** + * Process response process. + * + * @param rawResponse + * the raw response + * @return the object + * @throws ServiceException + * the service exception + */ + public abstract Object processResponse(Object rawResponse) throws ServiceException; +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityOperationBase.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityOperationBase.java new file mode 100644 index 000000000000..013181e32de4 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityOperationBase.java @@ -0,0 +1,166 @@ +/** + * 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.entityoperations; + +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.security.InvalidParameterException; + +import javax.ws.rs.core.MediaType; + +import com.microsoft.windowsazure.services.core.ServiceException; + +/** + * Default implementation of EntityOperation to provide + * default values for common methods. + * + */ +public abstract class EntityOperationBase implements EntityOperation { + + /** The uri builder. */ + private final EntityUriBuilder uriBuilder; + + /** The proxy data. */ + private EntityProxyData proxyData; + + /** + * Instantiates a new entity operation base. + * + * @param uri + * the uri + */ + protected EntityOperationBase(final String uri) { + this.uriBuilder = new EntityUriBuilder() { + @Override + public String getUri() { + return uri; + } + }; + } + + /** + * Instantiates a new entity operation base. + * + * @param uriBuilder + * the uri builder + */ + protected EntityOperationBase(EntityUriBuilder uriBuilder) { + this.uriBuilder = uriBuilder; + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityOperation#setProxyData(com.microsoft.windowsazure.services.media.entityoperations.EntityProxyData) + */ + @Override + public void setProxyData(EntityProxyData proxyData) { + this.proxyData = proxyData; + } + + /** + * Get the currently set proxy data. + * + * @return the proxy data + */ + protected EntityProxyData getProxyData() { + return proxyData; + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entities.EntityOperation#getUri() + */ + @Override + public String getUri() { + return uriBuilder.getUri(); + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entities.EntityOperation#getContentType() + */ + @Override + public MediaType getContentType() { + return MediaType.APPLICATION_ATOM_XML_TYPE; + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entities.EntityOperation#getAcceptType() + */ + @Override + public MediaType getAcceptType() { + return MediaType.APPLICATION_ATOM_XML_TYPE; + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityOperation#processResponse(java.lang.Object) + */ + @Override + public Object processResponse(Object rawResponse) throws ServiceException { + return rawResponse; + } + + /** + * The Interface EntityUriBuilder. + */ + public interface EntityUriBuilder { + + /** + * Gets the uri. + * + * @return the uri + */ + String getUri(); + } + + /** + * The Class EntityIdUriBuilder. + */ + public static class EntityIdUriBuilder implements EntityUriBuilder { + + /** The entity type. */ + private final String entityType; + + /** The entity id. */ + private final String entityId; + + /** + * Instantiates a new entity id uri builder. + * + * @param entityName + * the entity name + * @param entityId + * the entity id + */ + public EntityIdUriBuilder(String entityName, String entityId) { + super(); + this.entityType = entityName; + this.entityId = entityId; + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entities.EntityOperationBase.EntityUriBuilder#getUri() + */ + @Override + public String getUri() { + String escapedEntityId; + try { + escapedEntityId = URLEncoder.encode(entityId, "UTF-8"); + } + catch (UnsupportedEncodingException e) { + throw new InvalidParameterException(entityId); + } + return String.format("%s('%s')", entityType, escapedEntityId); + } + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityOperationSingleResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityOperationSingleResult.java new file mode 100644 index 000000000000..f3eeb0141d63 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityOperationSingleResult.java @@ -0,0 +1,26 @@ +/** + * 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.entityoperations; + +public interface EntityOperationSingleResult extends EntityOperation { + /** + * Get the Java class object for the type that the response should + * be unmarshalled into. + * + * @return Class object for response. + */ + public abstract Class getResponseClass(); +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityOperationSingleResultBase.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityOperationSingleResultBase.java new file mode 100644 index 000000000000..65b82a98b36b --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityOperationSingleResultBase.java @@ -0,0 +1,51 @@ +/** + * 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.entityoperations; + +import com.microsoft.windowsazure.services.core.ServiceException; + +/** + * + * + */ +public class EntityOperationSingleResultBase extends EntityOperationBase implements EntityOperationSingleResult { + private final Class responseClass; + + /** + * + */ + public EntityOperationSingleResultBase(String uri, Class responseClass) { + super(uri); + this.responseClass = responseClass; + } + + public EntityOperationSingleResultBase(EntityOperationBase.EntityUriBuilder uriBuilder, Class responseClass) { + super(uriBuilder); + this.responseClass = responseClass; + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entities.EntityOperationSingleResult#getResponseClass() + */ + @Override + public Class getResponseClass() { + return responseClass; + } + + public Object processResponse(Object rawResponse) throws ServiceException { + return rawResponse; + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityProxyData.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityProxyData.java new file mode 100644 index 000000000000..d0c21b9ec01a --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityProxyData.java @@ -0,0 +1,33 @@ +/** + * 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.entityoperations; + +import java.net.URI; + +/** + * Interface used to communicate details about the proxy to + * the operations, if they need it. + * + */ +public interface EntityProxyData { + /** + * Gets the absolute URI currently being + * used by proxy. + * + * @return The URI + */ + URI getServiceUri(); +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityRestProxy.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityRestProxy.java new file mode 100644 index 000000000000..c99273aaabf3 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityRestProxy.java @@ -0,0 +1,202 @@ +/** + * 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.entityoperations; + +import javax.ws.rs.core.MediaType; + +import com.microsoft.windowsazure.services.core.ServiceException; +import com.microsoft.windowsazure.services.core.ServiceFilter; +import com.microsoft.windowsazure.services.core.utils.pipeline.ClientFilterAdapter; +import com.microsoft.windowsazure.services.core.utils.pipeline.PipelineHelpers; +import com.microsoft.windowsazure.services.media.models.ListResult; +import com.sun.jersey.api.client.Client; +import com.sun.jersey.api.client.ClientResponse; +import com.sun.jersey.api.client.WebResource; +import com.sun.jersey.api.client.WebResource.Builder; + +/** + * The Class EntityRestProxy. + */ +public abstract class EntityRestProxy implements EntityContract { + + /** The channel. */ + private final Client channel; + /** The filters. */ + private final ServiceFilter[] filters; + + /** + * Instantiates a new entity rest proxy. + * + * @param channel + * the channel + * @param filters + * the filters + */ + public EntityRestProxy(Client channel, ServiceFilter[] filters) { + this.channel = channel; + this.filters = filters; + } + + /** + * Gets the channel. + * + * @return the channel + */ + protected Client getChannel() { + return channel; + } + + /** + * Gets the filters. + * + * @return the filters + */ + protected ServiceFilter[] getFilters() { + return filters; + } + + /** + * Get the proxy data to pass to operations. + * + * @return The proxy data. + */ + protected abstract EntityProxyData createProxyData(); + + /** + * Gets the resource. + * + * @param entityName + * the entity name + * @return the resource + */ + private WebResource getResource(String entityName) { + WebResource resource = channel.resource(entityName); + for (ServiceFilter filter : filters) { + resource.addFilter(new ClientFilterAdapter(filter)); + } + return resource; + } + + /** + * Gets the resource. + * + * @param operation + * 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()); + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityContract#create(com.microsoft.windowsazure.services.media.entityoperations.EntityCreateOperation) + */ + @SuppressWarnings("unchecked") + @Override + public T create(EntityCreateOperation creator) throws ServiceException { + creator.setProxyData(createProxyData()); + Object rawResponse = getResource(creator).post(creator.getResponseClass(), creator.getRequestContents()); + Object processedResponse = creator.processResponse(rawResponse); + return (T) processedResponse; + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityContract#get(com.microsoft.windowsazure.services.media.entityoperations.EntityGetOperation) + */ + @SuppressWarnings("unchecked") + @Override + public T get(EntityGetOperation getter) throws ServiceException { + getter.setProxyData(createProxyData()); + Object rawResponse = getResource(getter).get(getter.getResponseClass()); + Object processedResponse = getter.processResponse(rawResponse); + return (T) processedResponse; + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityContract#list(com.microsoft.windowsazure.services.media.entityoperations.EntityListOperation) + */ + @SuppressWarnings("unchecked") + @Override + public ListResult list(EntityListOperation lister) throws ServiceException { + lister.setProxyData(createProxyData()); + Object rawResponse = getResource(lister.getUri()).queryParams(lister.getQueryParameters()) + .type(lister.getContentType()).accept(lister.getAcceptType()).get(lister.getResponseGenericType()); + Object processedResponse = lister.processResponse(rawResponse); + return (ListResult) processedResponse; + + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityContract#update(com.microsoft.windowsazure.services.media.entityoperations.EntityUpdateOperation) + */ + @Override + public void update(EntityUpdateOperation updater) throws ServiceException { + updater.setProxyData(createProxyData()); + Object rawResponse = getResource(updater).header("X-HTTP-METHOD", "MERGE").post(ClientResponse.class, + updater.getRequestContents()); + PipelineHelpers.ThrowIfNotSuccess((ClientResponse) rawResponse); + updater.processResponse(rawResponse); + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityContract#delete(com.microsoft.windowsazure.services.media.entityoperations.EntityDeleteOperation) + */ + @Override + public void delete(EntityDeleteOperation deleter) throws ServiceException { + deleter.setProxyData(createProxyData()); + getResource(deleter.getUri()).delete(); + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityContract#action(com.microsoft.windowsazure.services.media.entityoperations.EntityActionOperation) + */ + @Override + public T action(EntityTypeActionOperation entityTypeActionOperation) throws ServiceException { + entityTypeActionOperation.setProxyData(createProxyData()); + Builder webResource = getResource(entityTypeActionOperation.getUri()) + .queryParams(entityTypeActionOperation.getQueryParameters()) + .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); + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityContract#action(com.microsoft.windowsazure.services.media.entityoperations.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()) + .queryParams(entityActionOperation.getQueryParameters()).accept(entityActionOperation.getAcceptType()) + .accept(MediaType.APPLICATION_XML_TYPE) + .entity(entityActionOperation.getRequestContents(), MediaType.APPLICATION_XML_TYPE); + return webResource.method(entityActionOperation.getVerb(), ClientResponse.class); + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityTypeActionOperation.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityTypeActionOperation.java new file mode 100644 index 000000000000..d089aaff24c3 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityTypeActionOperation.java @@ -0,0 +1,90 @@ +/** + * 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.entityoperations; + +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedMap; + +import com.sun.jersey.api.client.ClientResponse; + +/** + * The Interface EntityTypeActionOperation. + * + * @param + * the generic type + */ +public interface EntityTypeActionOperation extends EntityOperation { + + /** + * Process type response. + * + * @param clientResponse + * the client response + * @return the t + */ + T processTypeResponse(ClientResponse clientResponse); + + /** + * Gets the query parameters. + * + * @return the query parameters + */ + MultivaluedMap getQueryParameters(); + + /** + * Adds the query parameter. + * + * @param key + * the key + * @param value + * the value + * @return the entity action operation + */ + EntityTypeActionOperation addQueryParameter(String key, String value); + + /** + * Gets the verb. + * + * @return the verb + */ + String getVerb(); + + /** + * Gets the request contents. + * + * @return the request contents + */ + Object getRequestContents(); + + /** + * Sets the content type. + * + * @param contentType + * the content type + * @return the entity type action operation + */ + EntityTypeActionOperation setContentType(MediaType contentType); + + /** + * Sets the accept type. + * + * @param acceptType + * the accept type + * @return the entity type action operation + */ + EntityTypeActionOperation setAcceptType(MediaType acceptType); + +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityUpdateOperation.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityUpdateOperation.java new file mode 100644 index 000000000000..89e474bc8e41 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/entityoperations/EntityUpdateOperation.java @@ -0,0 +1,30 @@ +/** + * 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.entityoperations; + +/** + * + * + */ +public interface EntityUpdateOperation extends EntityOperation { + /** + * Get the contents of the merge request that will + * be sent to the server. + * + * @return The payload object + */ + Object getRequestContents(); +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/ActiveToken.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/ActiveToken.java new file mode 100644 index 000000000000..062fa73b09c3 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/ActiveToken.java @@ -0,0 +1,64 @@ +/** + * 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; + +import java.util.Date; + +/** + * A class representing active token. + * + */ +public class ActiveToken { + + private Date expiresUtc; + private String accessToken; + + /** + * Gets the expiration time in UTC. + * + * @return The token expiration time in UTC. + */ + public Date getExpiresUtc() { + return expiresUtc; + } + + /** + * Sets the token expiration time in UTC. + * + * @param expiresUtc + */ + public void setExpiresUtc(Date expiresUtc) { + this.expiresUtc = expiresUtc; + } + + /** + * Gets access token. + * + * @return String + */ + public String getAccessToken() { + return this.accessToken; + } + + /** + * Sets the access token. + * + * @param accessToken + */ + public void setAccessToken(String accessToken) { + this.accessToken = accessToken; + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/MediaBatchOperations.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/MediaBatchOperations.java new file mode 100644 index 000000000000..85a9dce36971 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/MediaBatchOperations.java @@ -0,0 +1,551 @@ +/** + * 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; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import javax.activation.DataHandler; +import javax.activation.DataSource; +import javax.mail.BodyPart; +import javax.mail.Header; +import javax.mail.MessagingException; +import javax.mail.internet.InternetHeaders; +import javax.mail.internet.MimeBodyPart; +import javax.mail.internet.MimeMultipart; +import javax.mail.internet.MimePartDataSource; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.UriBuilder; +import javax.xml.bind.JAXBException; +import javax.xml.parsers.ParserConfigurationException; + +import com.microsoft.windowsazure.services.core.ServiceException; +import com.microsoft.windowsazure.services.media.entityoperations.EntityBatchOperation; +import com.microsoft.windowsazure.services.media.implementation.atom.EntryType; +import com.microsoft.windowsazure.services.media.models.Job; +import com.microsoft.windowsazure.services.media.models.JobInfo; +import com.microsoft.windowsazure.services.media.models.Task; +import com.microsoft.windowsazure.services.media.models.TaskInfo; +import com.microsoft.windowsazure.services.table.implementation.InputStreamDataSource; +import com.sun.jersey.api.client.ClientResponse; +import com.sun.jersey.api.client.UniformInterfaceException; +import com.sun.jersey.core.header.InBoundHeaders; +import com.sun.jersey.core.util.ReaderWriter; + +/** + * The Class MediaBatchOperations. + */ +public class MediaBatchOperations { + + /** The operations. */ + private final List entityBatchOperations; + + /** The service uri. */ + private final URI serviceURI; + + /** The Odata atom marshaller. */ + private final ODataAtomMarshaller oDataAtomMarshaller; + + /** The o data atom unmarshaller. */ + private final ODataAtomUnmarshaller oDataAtomUnmarshaller; + + private final String batchId; + + /** + * Instantiates a new media batch operations. + * + * @param serviceURI + * the service uri + * @throws ParserConfigurationException + * @throws JAXBException + */ + public MediaBatchOperations(URI serviceURI) throws JAXBException, ParserConfigurationException { + if (serviceURI == null) { + throw new IllegalArgumentException("The service URI cannot be null."); + } + this.serviceURI = serviceURI; + this.oDataAtomMarshaller = new ODataAtomMarshaller(); + this.oDataAtomUnmarshaller = new ODataAtomUnmarshaller(); + this.entityBatchOperations = new ArrayList(); + batchId = String.format("batch_%s", UUID.randomUUID().toString()); + } + + /** + * Gets the mime multipart. + * + * @return the mime multipart + * @throws MessagingException + * the messaging exception + * @throws IOException + * Signals that an I/O exception has occurred. + * @throws JAXBException + * the jAXB exception + */ + public MimeMultipart getMimeMultipart() throws MessagingException, IOException, JAXBException { + List bodyPartContents = createRequestBody(); + return toMimeMultipart(bodyPartContents); + + } + + private List createRequestBody() throws JAXBException { + List bodyPartContents = new ArrayList(); + int contentId = 1; + + URI jobURI = UriBuilder.fromUri(serviceURI).path("Jobs").build(); + int jobContentId = addJobPart(bodyPartContents, jobURI, contentId); + contentId++; + + URI taskURI = UriBuilder.fromUri(serviceURI).path(String.format("$%d", jobContentId)).path("Tasks").build(); + addTaskPart(bodyPartContents, taskURI, contentId); + return bodyPartContents; + + } + + /** + * Adds the job part. + * + * @param bodyPartContents + * the body part contents + * @param contentId + * the content id + * @return the int + * @throws JAXBException + * the jAXB exception + */ + private int addJobPart(List bodyPartContents, URI jobURI, int contentId) throws JAXBException { + int jobContentId = contentId; + ValidateJobOperation(); + + for (EntityBatchOperation entityBatchOperation : entityBatchOperations) { + DataSource bodyPartContent = null; + if (entityBatchOperation instanceof Job.CreateBatchOperation) { + Job.CreateBatchOperation jobCreateBatchOperation = (Job.CreateBatchOperation) entityBatchOperation; + jobContentId = contentId; + bodyPartContent = createBatchCreateEntityPart(jobCreateBatchOperation.getVerb(), "Jobs", + jobCreateBatchOperation.getEntryType(), jobURI, contentId); + contentId++; + if (bodyPartContent != null) { + bodyPartContents.add(bodyPartContent); + break; + } + } + } + return jobContentId; + } + + private void ValidateJobOperation() { + int jobCount = 0; + for (EntityBatchOperation entityBatchOperation : entityBatchOperations) { + if (entityBatchOperation instanceof Job.CreateBatchOperation) { + jobCount++; + } + } + + if (jobCount != 1) { + throw new IllegalArgumentException(String.format( + "The Job operation is invalid, expect 1 but get %s job(s). ", jobCount)); + } + } + + /** + * Adds the task part. + * + * @param bodyPartContents + * the body part contents + * @param taskURI + * the task uri + * @param contentId + * the content id + * @throws JAXBException + * the jAXB exception + */ + private void addTaskPart(List bodyPartContents, URI taskURI, int contentId) throws JAXBException { + for (EntityBatchOperation entityBatchOperation : entityBatchOperations) { + DataSource bodyPartContent = null; + if (entityBatchOperation instanceof Task.CreateBatchOperation) { + Task.CreateBatchOperation createTaskOperation = (Task.CreateBatchOperation) entityBatchOperation; + bodyPartContent = createBatchCreateEntityPart(createTaskOperation.getVerb(), "Tasks", + createTaskOperation.getEntryType(), taskURI, contentId); + contentId++; + } + + if (bodyPartContent != null) { + bodyPartContents.add(bodyPartContent); + } + } + } + + /** + * To mime multipart. + * + * @param bodyPartContents + * the body part contents + * @return the mime multipart + * @throws MessagingException + * the messaging exception + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private MimeMultipart toMimeMultipart(List bodyPartContents) throws MessagingException, IOException { + String changeSetId = String.format("changeset_%s", UUID.randomUUID().toString()); + MimeMultipart changeSets = createChangeSets(bodyPartContents, changeSetId); + MimeBodyPart mimeBodyPart = createMimeBodyPart(changeSets, changeSetId); + + MimeMultipart mimeMultipart = new MimeMultipart(new SetBoundaryMultipartDataSource(batchId)); + mimeMultipart.addBodyPart(mimeBodyPart); + return mimeMultipart; + + } + + private MimeBodyPart createMimeBodyPart(MimeMultipart changeSets, String changeSetId) throws MessagingException { + MimeBodyPart mimeBodyPart = new MimeBodyPart(); + mimeBodyPart.setContent(changeSets); + String contentType = String.format("multipart/mixed; boundary=%s", changeSetId); + mimeBodyPart.setHeader("Content-Type", contentType); + return mimeBodyPart; + } + + private MimeMultipart createChangeSets(List bodyPartContents, String changeSetId) + throws MessagingException { + + MimeMultipart changeSets = new MimeMultipart(new SetBoundaryMultipartDataSource(changeSetId)); + + for (DataSource bodyPart : bodyPartContents) { + MimeBodyPart mimeBodyPart = new MimeBodyPart(); + + mimeBodyPart.setDataHandler(new DataHandler(bodyPart)); + mimeBodyPart.setHeader("Content-Type", bodyPart.getContentType()); + mimeBodyPart.setHeader("Content-Transfer-Encoding", "binary"); + + changeSets.addBodyPart(mimeBodyPart); + } + + return changeSets; + } + + /** + * Creates the batch create entity part. + * + * @param entityName + * the entity name + * @param entity + * the entity + * @param uri + * the uri + * @param contentId + * the content id + * @return the data source + * @throws JAXBException + * the jAXB exception + */ + private DataSource createBatchCreateEntityPart(String verb, String entityName, EntryType entryType, URI uri, + int contentId) throws JAXBException { + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + this.oDataAtomMarshaller.marshalEntryType(entryType, stream); + byte[] bytes = stream.toByteArray(); + + // adds header + InternetHeaders headers = new InternetHeaders(); + headers.addHeader("Content-ID", Integer.toString(contentId)); + headers.addHeader("Content-Type", "application/atom+xml;type=entry"); + headers.addHeader("Content-Length", Integer.toString(bytes.length)); + headers.addHeader("DataServiceVersion", "1.0;NetFx"); + headers.addHeader("MaxDataServiceVersion", "3.0;NetFx"); + + // adds body + ByteArrayOutputStream httpRequest = new ByteArrayOutputStream(); + addHttpMethod(httpRequest, verb, uri); + appendHeaders(httpRequest, headers); + appendEntity(httpRequest, new ByteArrayInputStream(bytes)); + + DataSource bodyPartContent = new InputStreamDataSource(new ByteArrayInputStream(httpRequest.toByteArray()), + "application/http"); + return bodyPartContent; + } + + /** + * Parses the batch result. + * + * @param response + * the response + * @param mediaBatchOperations + * the media batch operations + * @throws IOException + * Signals that an I/O exception has occurred. + * @throws ServiceException + * the service exception + */ + public void parseBatchResult(ClientResponse response) throws IOException, ServiceException { + ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); + InputStream inputStream = response.getEntityInputStream(); + ReaderWriter.writeTo(inputStream, byteArrayOutputStream); + response.setEntityInputStream(new ByteArrayInputStream(byteArrayOutputStream.toByteArray())); + JobInfo jobInfo; + + List parts = parseParts(response.getEntityInputStream(), + response.getHeaders().getFirst("Content-Type")); + + if (parts.size() == 0 || parts.size() > entityBatchOperations.size()) { + throw new UniformInterfaceException(String.format( + "Batch response from server does not contain the correct amount " + + "of parts (expecting %d, received %d instead)", parts.size(), + entityBatchOperations.size()), response); + } + + for (int i = 0; i < parts.size(); i++) { + DataSource ds = parts.get(i); + EntityBatchOperation entityBatchOperation = entityBatchOperations.get(i); + + StatusLine status = StatusLine.create(ds); + InternetHeaders headers = parseHeaders(ds); + InputStream content = parseEntity(ds); + + if (status.getStatus() >= 400) { + + InBoundHeaders inBoundHeaders = new InBoundHeaders(); + @SuppressWarnings("unchecked") + Enumeration
e = headers.getAllHeaders(); + while (e.hasMoreElements()) { + Header header = e.nextElement(); + inBoundHeaders.putSingle(header.getName(), header.getValue()); + } + + ClientResponse clientResponse = new ClientResponse(status.getStatus(), inBoundHeaders, content, null); + + UniformInterfaceException uniformInterfaceException = new UniformInterfaceException(clientResponse); + throw uniformInterfaceException; + } + else if (entityBatchOperation instanceof Job.CreateBatchOperation) { + + try { + jobInfo = oDataAtomUnmarshaller.unmarshalEntry(content, JobInfo.class); + Job.CreateBatchOperation jobCreateBatchOperation = (Job.CreateBatchOperation) entityBatchOperation; + jobCreateBatchOperation.setJobInfo(jobInfo); + } + catch (JAXBException e) { + throw new ServiceException(e); + } + } + else if (entityBatchOperation instanceof Task.CreateBatchOperation) { + try { + oDataAtomUnmarshaller.unmarshalEntry(content, TaskInfo.class); + } + catch (JAXBException e) { + throw new ServiceException(e); + } + } + } + } + + /** + * Parses the headers. + * + * @param ds + * the ds + * @return the internet headers + */ + private InternetHeaders parseHeaders(DataSource ds) { + try { + return new InternetHeaders(ds.getInputStream()); + } + catch (MessagingException e) { + throw new RuntimeException(e); + } + catch (IOException e) { + throw new RuntimeException(e); + } + } + + /** + * Parses the entity. + * + * @param ds + * the ds + * @return the input stream + */ + private InputStream parseEntity(DataSource ds) { + try { + return ds.getInputStream(); + } + catch (IOException e) { + throw new RuntimeException(e); + } + } + + /** + * Parses the parts. + * + * @param entityInputStream + * the entity input stream + * @param contentType + * the content type + * @return the list + */ + private List parseParts(final InputStream entityInputStream, final String contentType) { + try { + return parsePartsCore(entityInputStream, contentType); + } + catch (IOException e) { + throw new RuntimeException(e); + } + catch (MessagingException e) { + throw new RuntimeException(e); + } + } + + /** + * Parses the parts core. + * + * @param entityInputStream + * the entity input stream + * @param contentType + * the content type + * @return the list + * @throws MessagingException + * the messaging exception + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private List parsePartsCore(InputStream entityInputStream, String contentType) + throws MessagingException, IOException { + DataSource dataSource = new InputStreamDataSource(entityInputStream, contentType); + MimeMultipart batch = new MimeMultipart(dataSource); + MimeBodyPart batchBody = (MimeBodyPart) batch.getBodyPart(0); + + MimeMultipart changeSets = new MimeMultipart(new MimePartDataSource(batchBody)); + + List result = new ArrayList(); + for (int i = 0; i < changeSets.getCount(); i++) { + BodyPart part = changeSets.getBodyPart(i); + + result.add(new InputStreamDataSource(part.getInputStream(), part.getContentType())); + } + return result; + } + + /** + * Adds the operation. + * + * @param entityBatchOperation + * the operation + */ + public void addOperation(EntityBatchOperation entityBatchOperation) { + this.entityBatchOperations.add(entityBatchOperation); + } + + /** + * Adds the http method. + * + * @param outputStream + * the output stream + * @param verb + * the verb + * @param uri + * the uri + */ + private void addHttpMethod(ByteArrayOutputStream outputStream, String verb, URI uri) { + try { + String method = String.format("%s %s HTTP/1.1\r\n", verb, uri); + outputStream.write(method.getBytes("UTF-8")); + } + catch (UnsupportedEncodingException e) { + throw new RuntimeException(e); + } + catch (IOException e) { + throw new RuntimeException(e); + } + } + + /** + * Append headers. + * + * @param outputStream + * the output stream + * @param internetHeaders + * the internet headers + */ + private void appendHeaders(OutputStream outputStream, InternetHeaders internetHeaders) { + try { + // Headers + @SuppressWarnings("unchecked") + Enumeration
headers = internetHeaders.getAllHeaders(); + while (headers.hasMoreElements()) { + Header header = headers.nextElement(); + String headerLine = String.format("%s: %s\r\n", header.getName(), header.getValue()); + outputStream.write(headerLine.getBytes("UTF-8")); + } + + // Empty line + outputStream.write("\r\n".getBytes("UTF-8")); + } + catch (UnsupportedEncodingException e) { + throw new RuntimeException(e); + } + catch (IOException e) { + throw new RuntimeException(e); + } + } + + /** + * Append entity. + * + * @param outputStream + * the output stream + * @param byteArrayInputStream + * the byte array input stream + */ + private void appendEntity(OutputStream outputStream, ByteArrayInputStream byteArrayInputStream) { + try { + byte[] buffer = new byte[1024]; + while (true) { + int bytesRead = byteArrayInputStream.read(buffer); + if (bytesRead <= 0) + break; + outputStream.write(buffer, 0, bytesRead); + } + } + catch (IOException e) { + throw new RuntimeException(e); + } + } + + public List getOperations() { + return entityBatchOperations; + } + + public String getBatchId() { + return this.batchId; + } + + public MediaType getContentType() { + Map parameters = new Hashtable(); + parameters.put("boundary", this.batchId); + MediaType contentType = new MediaType("multipart", "mixed", parameters); + return contentType; + } + +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/MediaBlobContainerWriter.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/MediaBlobContainerWriter.java new file mode 100644 index 000000000000..87c4f66dde5e --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/MediaBlobContainerWriter.java @@ -0,0 +1,118 @@ +/** + * 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; + +import java.io.InputStream; + +import com.microsoft.windowsazure.services.blob.BlobContract; +import com.microsoft.windowsazure.services.blob.implementation.BlobExceptionProcessor; +import com.microsoft.windowsazure.services.blob.models.BlockList; +import com.microsoft.windowsazure.services.blob.models.CommitBlobBlocksOptions; +import com.microsoft.windowsazure.services.blob.models.CreateBlobBlockOptions; +import com.microsoft.windowsazure.services.blob.models.CreateBlobOptions; +import com.microsoft.windowsazure.services.blob.models.CreateBlobResult; +import com.microsoft.windowsazure.services.core.ServiceException; +import com.microsoft.windowsazure.services.core.ServiceFilter; +import com.microsoft.windowsazure.services.media.WritableBlobContainerContract; +import com.sun.jersey.api.client.Client; + +/** + * Implementation of WritableBlobContainerContract, used to upload blobs to the + * Media Services storage. + * + */ +public class MediaBlobContainerWriter implements WritableBlobContainerContract { + + private final BlobContract blobService; + private final BlobContract restProxy; + private final String containerName; + + /** + * + */ + public MediaBlobContainerWriter(Client client, String accountName, String blobServiceUri, String containerName, + String sasToken) { + this.containerName = containerName; + this.restProxy = new MediaBlobRestProxy(client, accountName, blobServiceUri, new SASTokenFilter(sasToken)); + this.blobService = new BlobExceptionProcessor(this.restProxy); + } + + private MediaBlobContainerWriter(MediaBlobContainerWriter baseWriter, ServiceFilter filter) { + this.containerName = baseWriter.containerName; + this.restProxy = baseWriter.restProxy.withFilter(filter); + this.blobService = new BlobExceptionProcessor(this.restProxy); + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.core.FilterableService#withFilter(com.microsoft.windowsazure.services.core.ServiceFilter) + */ + @Override + public WritableBlobContainerContract withFilter(ServiceFilter filter) { + return new MediaBlobContainerWriter(this, filter); + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.WritableBlobContainerContract#createBlockBlob(java.lang.String, java.io.InputStream) + */ + @Override + public CreateBlobResult createBlockBlob(String blob, InputStream contentStream) throws ServiceException { + return blobService.createBlockBlob(containerName, blob, contentStream); + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.WritableBlobContainerContract#createBlockBlob(java.lang.String, java.io.InputStream, com.microsoft.windowsazure.services.blob.models.CreateBlobOptions) + */ + @Override + public CreateBlobResult createBlockBlob(String blob, InputStream contentStream, CreateBlobOptions options) + throws ServiceException { + return blobService.createBlockBlob(containerName, blob, contentStream, options); + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.WritableBlobContainerContract#createBlobBlock(java.lang.String, java.lang.String, java.io.InputStream) + */ + @Override + public void createBlobBlock(String blob, String blockId, InputStream contentStream) throws ServiceException { + blobService.createBlobBlock(containerName, blob, blockId, contentStream); + + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.WritableBlobContainerContract#createBlobBlock(java.lang.String, java.lang.String, java.io.InputStream, com.microsoft.windowsazure.services.blob.models.CreateBlobBlockOptions) + */ + @Override + public void createBlobBlock(String blob, String blockId, InputStream contentStream, CreateBlobBlockOptions options) + throws ServiceException { + blobService.createBlobBlock(containerName, blob, blockId, contentStream, options); + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.WritableBlobContainerContract#commitBlobBlocks(java.lang.String, com.microsoft.windowsazure.services.blob.models.BlockList) + */ + @Override + public void commitBlobBlocks(String blob, BlockList blockList) throws ServiceException { + blobService.commitBlobBlocks(containerName, blob, blockList); + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.WritableBlobContainerContract#commitBlobBlocks(java.lang.String, com.microsoft.windowsazure.services.blob.models.BlockList, com.microsoft.windowsazure.services.blob.models.CommitBlobBlocksOptions) + */ + @Override + public void commitBlobBlocks(String blob, BlockList blockList, CommitBlobBlocksOptions options) + throws ServiceException { + blobService.commitBlobBlocks(containerName, blob, blockList, options); + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/MediaBlobRestProxy.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/MediaBlobRestProxy.java new file mode 100644 index 000000000000..46d0ba286ee9 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/MediaBlobRestProxy.java @@ -0,0 +1,85 @@ +/** + * 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; + +import java.util.Arrays; + +import com.microsoft.windowsazure.services.blob.BlobContract; +import com.microsoft.windowsazure.services.blob.implementation.BlobOperationRestProxy; +import com.microsoft.windowsazure.services.blob.implementation.RFC1123DateConverter; +import com.microsoft.windowsazure.services.core.ServiceFilter; +import com.sun.jersey.api.client.Client; + +/** + * Rest proxy for blob operations that's specialized for working + * with the blobs created by and for Media Services storage. + * + */ +class MediaBlobRestProxy extends BlobOperationRestProxy { + private final SASTokenFilter tokenFilter; + + /** + * Construct instance of MediaBlobRestProxy with given parameters. + * + * @param channel + * Jersey Client object used to communicate with blob service + * @param accountName + * Account name for blob storage + * @param url + * URL for blob storage + * @param tokenFilter + * filter used to add SAS tokens to requests. + */ + public MediaBlobRestProxy(Client channel, String accountName, String url, SASTokenFilter tokenFilter) { + super(channel, accountName, url); + + this.tokenFilter = tokenFilter; + channel.addFilter(tokenFilter); + } + + /** + * Construct instance of MediaBlobRestProxy with given parameters. + * + * @param channel + * Jersey Client object used to communicate with blob service + * @param filters + * Additional ServiceFilters to manipulate requests and responses + * @param accountName + * Account name for blob storage + * @param url + * URL for blob storage + * @param dateMapper + * date conversion helper object + */ + public MediaBlobRestProxy(Client channel, ServiceFilter[] filters, String accountName, String url, + SASTokenFilter tokenFilter, RFC1123DateConverter dateMapper) { + super(channel, filters, accountName, url, dateMapper); + + this.tokenFilter = tokenFilter; + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.blob.implementation.BlobOperationRestProxy#withFilter(com.microsoft.windowsazure.services.core.ServiceFilter) + */ + @Override + public BlobContract withFilter(ServiceFilter filter) { + ServiceFilter[] currentFilters = getFilters(); + ServiceFilter[] newFilters = Arrays.copyOf(currentFilters, currentFilters.length + 1); + newFilters[currentFilters.length] = filter; + return new MediaBlobRestProxy(getChannel(), newFilters, getAccountName(), getUrl(), this.tokenFilter, + getDateMapper()); + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/MediaContentProvider.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/MediaContentProvider.java new file mode 100644 index 000000000000..9e04edf56d03 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/MediaContentProvider.java @@ -0,0 +1,80 @@ +/** + * 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; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; + +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedMap; +import javax.xml.bind.JAXBException; +import javax.xml.parsers.ParserConfigurationException; + +import com.microsoft.windowsazure.services.media.implementation.content.MediaServiceDTO; +import com.sun.jersey.core.provider.AbstractMessageReaderWriterProvider; + +/** + * Class to plug into Jersey to properly serialize + * raw Media Services DTO types. + * + */ +public class MediaContentProvider extends AbstractMessageReaderWriterProvider { + private final ODataAtomMarshaller marshaller; + + /** + * Creates the instance + * + * @throws JAXBException + * @throws ParserConfigurationException + */ + public MediaContentProvider() throws JAXBException, ParserConfigurationException { + marshaller = new ODataAtomMarshaller(); + } + + @Override + public boolean isReadable(Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { + // This class only does marshalling, not unmarshalling. + return false; + } + + @Override + public T readFrom(Class type, Type genericType, Annotation[] annotations, MediaType mediaType, + MultivaluedMap httpHeaders, InputStream entityStream) throws IOException, + WebApplicationException { + throw new UnsupportedOperationException(); + } + + @Override + public boolean isWriteable(Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { + return MediaServiceDTO.class.isAssignableFrom(type); + } + + @Override + public void writeTo(T t, Class type, Type genericType, Annotation[] annotations, MediaType mediaType, + MultivaluedMap httpHeaders, OutputStream entityStream) throws IOException, + WebApplicationException { + try { + marshaller.marshalEntry(t, entityStream); + } + catch (JAXBException e) { + throw new RuntimeException(e); + } + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/MediaExceptionProcessor.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/MediaExceptionProcessor.java new file mode 100644 index 000000000000..cc2808e7bdc6 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/MediaExceptionProcessor.java @@ -0,0 +1,216 @@ +/** + * 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; + +import javax.inject.Inject; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import com.microsoft.windowsazure.services.core.ServiceException; +import com.microsoft.windowsazure.services.core.ServiceFilter; +import com.microsoft.windowsazure.services.core.utils.ServiceExceptionFactory; +import com.microsoft.windowsazure.services.media.MediaContract; +import com.microsoft.windowsazure.services.media.WritableBlobContainerContract; +import com.microsoft.windowsazure.services.media.entityoperations.EntityActionOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityCreateOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityDeleteOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityGetOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityListOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityTypeActionOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityUpdateOperation; +import com.microsoft.windowsazure.services.media.models.ListResult; +import com.microsoft.windowsazure.services.media.models.LocatorInfo; +import com.sun.jersey.api.client.ClientHandlerException; +import com.sun.jersey.api.client.UniformInterfaceException; + +/** + * /** + * Wrapper implementation of MediaEntityContract that + * translates exceptions into ServiceExceptions. + * + */ +public class MediaExceptionProcessor implements MediaContract { + + /** The service. */ + private final MediaContract service; + + /** The log. */ + private static Log log = LogFactory.getLog(MediaContract.class); + + /** + * Instantiates a new media exception processor. + * + * @param service + * the service + */ + public MediaExceptionProcessor(MediaContract service) { + this.service = service; + } + + /** + * Instantiates a new media exception processor. + * + * @param service + * the service + */ + @Inject + public MediaExceptionProcessor(MediaRestProxy service) { + this.service = service; + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.core.FilterableService#withFilter(com.microsoft.windowsazure.services.core.ServiceFilter) + */ + @Override + public MediaContract withFilter(ServiceFilter filter) { + return new MediaExceptionProcessor(service.withFilter(filter)); + } + + /** + * Process a catch. + * + * @param e + * the e + * @return the service exception + */ + private ServiceException processCatch(ServiceException e) { + log.warn(e.getMessage(), e.getCause()); + return ServiceExceptionFactory.process("MediaServices", e); + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityContract#create(com.microsoft.windowsazure.services.media.entityoperations.EntityCreateOperation) + */ + @Override + public T create(EntityCreateOperation creator) throws ServiceException { + try { + return service.create(creator); + } + catch (UniformInterfaceException e) { + throw processCatch(new ServiceException(e)); + } + catch (ClientHandlerException e) { + throw processCatch(new ServiceException(e)); + } + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityContract#get(com.microsoft.windowsazure.services.media.entityoperations.EntityGetOperation) + */ + @Override + public T get(EntityGetOperation getter) throws ServiceException { + try { + return service.get(getter); + } + catch (UniformInterfaceException e) { + throw processCatch(new ServiceException(e)); + } + catch (ClientHandlerException e) { + throw processCatch(new ServiceException(e)); + } + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityContract#list(com.microsoft.windowsazure.services.media.entityoperations.EntityListOperation) + */ + @Override + public ListResult list(EntityListOperation lister) throws ServiceException { + try { + return service.list(lister); + } + catch (UniformInterfaceException e) { + throw processCatch(new ServiceException(e)); + } + catch (ClientHandlerException e) { + throw processCatch(new ServiceException(e)); + } + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityContract#update(com.microsoft.windowsazure.services.media.entityoperations.EntityUpdateOperation) + */ + @Override + public void update(EntityUpdateOperation updater) throws ServiceException { + try { + service.update(updater); + } + catch (UniformInterfaceException e) { + throw processCatch(new ServiceException(e)); + } + catch (ClientHandlerException e) { + throw processCatch(new ServiceException(e)); + } + + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityContract#delete(com.microsoft.windowsazure.services.media.entityoperations.EntityDeleteOperation) + */ + @Override + public void delete(EntityDeleteOperation deleter) throws ServiceException { + try { + service.delete(deleter); + } + catch (UniformInterfaceException e) { + throw processCatch(new ServiceException(e)); + } + catch (ClientHandlerException e) { + throw processCatch(new ServiceException(e)); + } + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityContract#action(com.microsoft.windowsazure.services.media.entityoperations.EntityActionOperation) + */ + @Override + public void action(EntityActionOperation entityActionOperation) throws ServiceException { + try { + service.action(entityActionOperation); + } + catch (UniformInterfaceException e) { + throw processCatch(new ServiceException(e)); + } + catch (ClientHandlerException e) { + throw processCatch(new ServiceException(e)); + } + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityContract#action(com.microsoft.windowsazure.services.media.entityoperations.EntityTypeActionOperation) + */ + @Override + public T action(EntityTypeActionOperation entityTypeActionOperation) throws ServiceException { + try { + return service.action(entityTypeActionOperation); + } + catch (UniformInterfaceException e) { + throw processCatch(new ServiceException(e)); + } + catch (ClientHandlerException e) { + throw processCatch(new ServiceException(e)); + } + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.MediaContract#createBlobWriter(com.microsoft.windowsazure.services.media.models.LocatorInfo) + */ + @Override + public WritableBlobContainerContract createBlobWriter(LocatorInfo locator) { + return service.createBlobWriter(locator); + } + +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/MediaRestProxy.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/MediaRestProxy.java new file mode 100644 index 000000000000..cb8480f28920 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/MediaRestProxy.java @@ -0,0 +1,165 @@ +/** + * 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; + +import java.net.URI; +import java.util.Arrays; + +import javax.inject.Inject; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import com.microsoft.windowsazure.services.core.ServiceFilter; +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.entityoperations.EntityProxyData; +import com.microsoft.windowsazure.services.media.entityoperations.EntityRestProxy; +import com.microsoft.windowsazure.services.media.models.LocatorInfo; +import com.microsoft.windowsazure.services.media.models.LocatorType; +import com.sun.jersey.api.client.Client; +import com.sun.jersey.api.client.config.ClientConfig; +import com.sun.jersey.api.client.config.DefaultClientConfig; + +/** + * The Class MediaRestProxy. + */ +public class MediaRestProxy extends EntityRestProxy implements MediaContract { + /** The log. */ + static Log log = LogFactory.getLog(MediaContract.class); + + /** The redirect filter. */ + private RedirectFilter redirectFilter; + + private final ClientConfigSettings clientConfigSettings; + + /** + * Instantiates a new media rest proxy. + * + * @param channel + * the channel + * @param authFilter + * the auth filter + * @param redirectFilter + * the redirect filter + * @param versionHeadersFilter + * the version headers filter + * @param clientConfigSettings + * Currently configured HTTP client settings + * + */ + @Inject + public MediaRestProxy(Client channel, OAuthFilter authFilter, RedirectFilter redirectFilter, + VersionHeadersFilter versionHeadersFilter, ClientConfigSettings clientConfigSettings) { + super(channel, new ServiceFilter[0]); + + this.clientConfigSettings = clientConfigSettings; + this.redirectFilter = redirectFilter; + channel.addFilter(redirectFilter); + channel.addFilter(authFilter); + channel.addFilter(versionHeadersFilter); + } + + /** + * Instantiates a new media rest proxy. + * + * @param channel + * the channel + * @param filters + * the filters + * @param clientConfigSettings + * currently configured HTTP client settings + */ + private MediaRestProxy(Client channel, ServiceFilter[] filters, ClientConfigSettings clientConfigSettings) { + super(channel, filters); + this.clientConfigSettings = clientConfigSettings; + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.core.FilterableService#withFilter(com.microsoft.windowsazure.services.core.ServiceFilter) + */ + @Override + public MediaContract withFilter(ServiceFilter filter) { + ServiceFilter[] filters = getFilters(); + ServiceFilter[] newFilters = Arrays.copyOf(filters, filters.length + 1); + newFilters[filters.length] = filter; + return new MediaRestProxy(getChannel(), newFilters, clientConfigSettings); + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityRestProxy#createProxyData() + */ + @Override + protected EntityProxyData createProxyData() { + return new EntityProxyData() { + @Override + public URI getServiceUri() { + return redirectFilter.getBaseURI(); + } + }; + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.MediaContract#createBlobWriter(com.microsoft.windowsazure.services.media.models.LocatorInfo) + */ + @Override + public WritableBlobContainerContract createBlobWriter(LocatorInfo locator) { + if (locator.getLocatorType() != LocatorType.SAS) { + throw new IllegalArgumentException("Can only write to SAS locators"); + } + + LocatorParser p = new LocatorParser(locator); + + return new MediaBlobContainerWriter(createUploaderClient(), p.getAccountName(), p.getStorageUri(), + p.getContainer(), p.getSASToken()); + } + + /** + * Helper class to encapsulate pulling information out of the locator. + */ + private static class LocatorParser { + URI locatorPath; + + LocatorParser(LocatorInfo locator) { + locatorPath = URI.create(locator.getPath()); + } + + String getAccountName() { + return locatorPath.getHost().split("\\.")[0]; + } + + String getStorageUri() { + return locatorPath.getScheme() + "://" + locatorPath.getAuthority(); + } + + String getContainer() { + return locatorPath.getPath().substring(1); + } + + String getSASToken() { + return locatorPath.getRawQuery(); + } + } + + private Client createUploaderClient() { + ClientConfig clientConfig = new DefaultClientConfig(); + clientConfigSettings.applyConfig(clientConfig); + Client client = Client.create(clientConfig); + clientConfigSettings.applyConfig(client); + return client; + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/OAuthContract.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/OAuthContract.java new file mode 100644 index 000000000000..ef2982aa2c17 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/OAuthContract.java @@ -0,0 +1,44 @@ +/** + * 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; + +import java.net.URI; + +import com.microsoft.windowsazure.services.core.ServiceException; + +public interface OAuthContract { + /** + * Gets an OAuth access token with specified OAUTH URI, client ID, client secret, and scope. + * + * @param oAuthUri + * A URI object which represents an OAUTH URI. + * + * @param clientId + * A String object which represents a client ID. + * + * @param clientSecret + * A String object which represents a client secret. + * + * @param scope + * A String object which represents the scope. + * + * @return OAuthTokenResponse + * @throws ServiceException + */ + public OAuthTokenResponse getAccessToken(URI oAuthUri, String clientId, String clientSecret, String scope) + throws ServiceException; + +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/OAuthFilter.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/OAuthFilter.java new file mode 100644 index 000000000000..81d50e6a6bfc --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/OAuthFilter.java @@ -0,0 +1,62 @@ +/* + * 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; + +import java.net.URISyntaxException; + +import com.microsoft.windowsazure.services.core.IdempotentClientFilter; +import com.microsoft.windowsazure.services.core.ServiceException; +import com.sun.jersey.api.client.ClientHandlerException; +import com.sun.jersey.api.client.ClientRequest; +import com.sun.jersey.api.client.ClientResponse; + +/** + * The Jersey filter for OAuth. + * + */ +public class OAuthFilter extends IdempotentClientFilter { + private final OAuthTokenManager oAuthTokenManager; + + /** + * Creates an OAuthFilter object with specified OAuthTokenManager instance. + * + * @param oAuthTokenManager + */ + public OAuthFilter(OAuthTokenManager oAuthTokenManager) { + this.oAuthTokenManager = oAuthTokenManager; + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.core.IdempotentClientFilter#doHandle(com.sun.jersey.api.client.ClientRequest) + */@Override + public ClientResponse doHandle(ClientRequest clientRequest) throws ClientHandlerException { + String accessToken; + try { + accessToken = oAuthTokenManager.getAccessToken(); + } + catch (ServiceException e) { + // must wrap exception because of base class signature + throw new ClientHandlerException(e); + } + catch (URISyntaxException e) { + // must wrap exception because of base class signature + throw new ClientHandlerException(e); + } + + clientRequest.getHeaders().add("Authorization", "Bearer " + accessToken); + + return this.getNext().handle(clientRequest); + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/OAuthRestProxy.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/OAuthRestProxy.java new file mode 100644 index 000000000000..ecf179072bc5 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/OAuthRestProxy.java @@ -0,0 +1,120 @@ +/** + * 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; + +import java.io.IOException; +import java.net.URI; + +import javax.inject.Inject; +import javax.ws.rs.core.MediaType; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.codehaus.jackson.JsonParseException; +import org.codehaus.jackson.map.JsonMappingException; +import org.codehaus.jackson.map.ObjectMapper; +import org.codehaus.jackson.type.TypeReference; + +import com.microsoft.windowsazure.services.core.ServiceException; +import com.microsoft.windowsazure.services.core.utils.ServiceExceptionFactory; +import com.sun.jersey.api.client.Client; +import com.sun.jersey.api.client.ClientResponse; +import com.sun.jersey.api.client.UniformInterfaceException; +import com.sun.jersey.api.representation.Form; + +/** + * The OAuth rest proxy. + * + */ +public class OAuthRestProxy implements OAuthContract { + Client channel; + + private final String _grantType = "client_credentials"; + + static Log log = LogFactory.getLog(OAuthContract.class); + + @Inject + public OAuthRestProxy(Client channel) { + this.channel = channel; + } + + /** + * Gets an OAuth access token with specified OAUTH URI, client ID, client secret, and scope. + * + * @param oAuthUri + * A URI object which represents an OAUTH URI. + * + * @param clientId + * A String object which represents a client ID. + * + * @param clientSecret + * A String object which represents a client secret. + * + * @param scope + * A String object which represents the scope. + * + * @return OAuthTokenResponse + * @throws ServiceException + */ + @Override + public OAuthTokenResponse getAccessToken(URI oAuthUri, String clientId, String clientSecret, String scope) + throws ServiceException { + OAuthTokenResponse response = null; + Form requestForm = new Form(); + ClientResponse clientResponse; + String responseJson; + + requestForm.add("grant_type", _grantType); + requestForm.add("client_id", clientId); + requestForm.add("client_secret", clientSecret); + requestForm.add("scope", scope); + + try { + clientResponse = channel.resource(oAuthUri).accept(MediaType.APPLICATION_FORM_URLENCODED) + .type(MediaType.APPLICATION_FORM_URLENCODED).post(ClientResponse.class, requestForm); + } + catch (UniformInterfaceException e) { + log.warn("OAuth server returned error acquiring access_token", e); + throw ServiceExceptionFactory.process("OAuth", new ServiceException( + "OAuth server returned error acquiring access_token", e)); + } + + responseJson = clientResponse.getEntity(String.class); + + try { + ObjectMapper mapper = new ObjectMapper(); + TypeReference typeReference = new TypeReference() { + }; + response = mapper.readValue(responseJson, typeReference); + } + catch (JsonParseException e) { + log.warn("The response from OAuth server cannot be parsed correctly", e); + throw ServiceExceptionFactory.process("OAuth", new ServiceException( + "The response from OAuth server cannot be parsed correctly", e)); + } + catch (JsonMappingException e) { + log.warn("The response from OAuth server cannot be mapped to OAuthResponse object", e); + throw ServiceExceptionFactory.process("OAuth", new ServiceException( + "The response from OAuth server cannot be mapped to OAuthResponse object", e)); + } + catch (IOException e) { + log.warn("Cannot map the response from OAuth server correctly.", e); + throw ServiceExceptionFactory.process("OAuth", new ServiceException( + "Cannot map the response from OAuth server correctly.", e)); + } + + return response; + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/OAuthTokenManager.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/OAuthTokenManager.java new file mode 100644 index 000000000000..7e80474ed2b3 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/OAuthTokenManager.java @@ -0,0 +1,102 @@ +/** + * 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; + +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Date; + +import javax.inject.Named; +import javax.management.timer.Timer; + +import com.microsoft.windowsazure.services.core.ServiceException; +import com.microsoft.windowsazure.services.core.utils.DateFactory; +import com.microsoft.windowsazure.services.media.MediaConfiguration; + +/** + * An OAuth token manager class. + * + */ +public class OAuthTokenManager { + private final DateFactory dateFactory; + private final URI acsBaseUri; + private final String clientId; + private final String clientSecret; + private final OAuthContract contract; + private ActiveToken activeToken; + private final String scope; + + /** + * Creates an OAuth token manager instance with specified contract, date factory, ACS base URI, client ID, + * and client secret. + * + * @param contract + * A OAuthContract object instance that represents the OAUTH contract. + * + * @param dateFactory + * A DateFactory object instance that represents the date factory. + * + * @param oAuthUri + * A String object instance that represents the ACS base URI. + * + * @param clientId + * A String object instance that represents the client ID. + * + * @param clientSecret + * A String object instance that represents the client secret. + * @throws URISyntaxException + * + */ + public OAuthTokenManager(OAuthContract contract, DateFactory dateFactory, + @Named(MediaConfiguration.OAUTH_URI) String oAuthUri, + @Named(MediaConfiguration.OAUTH_CLIENT_ID) String clientId, + @Named(MediaConfiguration.OAUTH_CLIENT_SECRET) String clientSecret, + @Named(MediaConfiguration.OAUTH_SCOPE) String scope) throws URISyntaxException { + this.contract = contract; + this.dateFactory = dateFactory; + this.acsBaseUri = new URI(oAuthUri); + this.clientId = clientId; + this.clientSecret = clientSecret; + this.scope = scope; + this.activeToken = null; + } + + /** + * Gets an OAuth access token with specified media service scope. + * + * @param mediaServiceScope + * A String instance that represents the media service scope. + * + * @return String + * + * @throws ServiceException + * @throws URISyntaxException + */ + public String getAccessToken() throws ServiceException, URISyntaxException { + Date now = dateFactory.getDate(); + if (this.activeToken == null || now.after(this.activeToken.getExpiresUtc())) { + OAuthTokenResponse oAuth2TokenResponse = contract.getAccessToken(acsBaseUri, clientId, clientSecret, scope); + Date expiresUtc = new Date(now.getTime() + oAuth2TokenResponse.getExpiresIn() * Timer.ONE_SECOND / 2); + + ActiveToken newToken = new ActiveToken(); + newToken.setAccessToken(oAuth2TokenResponse.getAccessToken()); + newToken.setExpiresUtc(expiresUtc); + + this.activeToken = newToken; + } + return this.activeToken.getAccessToken(); + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/OAuthTokenResponse.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/OAuthTokenResponse.java new file mode 100644 index 000000000000..bc8d3622e068 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/OAuthTokenResponse.java @@ -0,0 +1,75 @@ +/** + * 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; + +import org.codehaus.jackson.annotate.JsonProperty; + +/** + * A class representing OAuth token response. + * + */ +public class OAuthTokenResponse { + + private String _accessToken; + private String _scope; + private String _tokenType; + private long _expiresIn; + + /** + * Sets the token type. + * + * @param tokenType + */ + @JsonProperty("token_type") + public void setTokenType(String tokenType) { + _tokenType = tokenType; + } + + @JsonProperty("token_type") + public String getTokenType() { + return _tokenType; + } + + @JsonProperty("expires_in") + public long getExpiresIn() { + return _expiresIn; + } + + @JsonProperty("expires_in") + public void setExpiresIn(long expiresIn) { + _expiresIn = expiresIn; + } + + @JsonProperty("access_token") + public String getAccessToken() { + return _accessToken; + } + + @JsonProperty("access_token") + public void setAccessToken(String accessToken) { + _accessToken = accessToken; + } + + @JsonProperty("scope") + public String getScope() { + return _scope; + } + + @JsonProperty("scope") + public void setScope(String scope) { + _scope = scope; + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/ODataAtomMarshaller.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/ODataAtomMarshaller.java new file mode 100644 index 000000000000..5f8a41ccbd96 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/ODataAtomMarshaller.java @@ -0,0 +1,138 @@ +/** + * 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; + +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.List; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBElement; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Marshaller; +import javax.xml.namespace.QName; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.w3c.dom.Document; + +import com.microsoft.windowsazure.services.media.implementation.atom.ContentType; +import com.microsoft.windowsazure.services.media.implementation.atom.EntryType; +import com.microsoft.windowsazure.services.media.implementation.atom.FeedType; +import com.microsoft.windowsazure.services.media.implementation.content.AccessPolicyType; +import com.microsoft.windowsazure.services.media.implementation.content.AssetFileType; +import com.microsoft.windowsazure.services.media.implementation.content.AssetType; +import com.microsoft.windowsazure.services.media.implementation.content.Constants; +import com.microsoft.windowsazure.services.media.implementation.content.ContentKeyRestType; +import com.microsoft.windowsazure.services.media.implementation.content.JobType; +import com.microsoft.windowsazure.services.media.implementation.content.LocatorRestType; +import com.microsoft.windowsazure.services.media.implementation.content.TaskType; + +/** + * A class to manage marshalling of request parameters into + * ATOM entry elements for sending to the Media Services REST + * endpoints. + * + */ +public class ODataAtomMarshaller { + private final Marshaller marshaller; + private final DocumentBuilder documentBuilder; + + public ODataAtomMarshaller() throws JAXBException, ParserConfigurationException { + JAXBContext context = JAXBContext.newInstance(getMarshalledClasses(), null); + marshaller = context.createMarshaller(); + + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + dbf.setNamespaceAware(true); + documentBuilder = dbf.newDocumentBuilder(); + } + + /** + * Convert the given content object into an ATOM entry + * (represented as a DOM document) suitable for sending + * up to the Media Services service. + * + * @param content + * The content object to send + * @return The generated DOM + * @throws JAXBException + * if content is malformed/not marshallable + */ + public Document marshalEntry(Object content) throws JAXBException { + JAXBElement entryElement = createEntry(content); + + Document doc = documentBuilder.newDocument(); + doc.setXmlStandalone(true); + + marshaller.marshal(entryElement, doc); + + return doc; + + } + + /** + * Convert the given content into an ATOM entry + * and write it to the given stream. + * + * @param content + * Content object to send + * @param stream + * Stream to write to + * @throws JAXBException + * if content is malformed/not marshallable + */ + public void marshalEntry(Object content, OutputStream stream) throws JAXBException { + marshaller.marshal(createEntry(content), stream); + } + + public void marshalEntryType(EntryType entryType, OutputStream stream) throws JAXBException { + marshaller.marshal( + new JAXBElement(new QName(Constants.ATOM_NS, "entry"), EntryType.class, entryType), stream); + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + private JAXBElement createEntry(Object content) { + ContentType atomContent = new ContentType(); + EntryType atomEntry = new EntryType(); + + atomContent.setType("application/xml"); + atomContent.getContent().add( + new JAXBElement(new QName(Constants.ODATA_METADATA_NS, "properties"), content.getClass(), content)); + + atomEntry.getEntryChildren().add( + new JAXBElement(new QName(Constants.ATOM_NS, "content"), ContentType.class, atomContent)); + + JAXBElement entryElement = new JAXBElement(new QName(Constants.ATOM_NS, "entry"), + EntryType.class, atomEntry); + + return entryElement; + } + + private static Class[] getMarshalledClasses() { + List> classes = new ArrayList>(); + classes.add(AccessPolicyType.class); + classes.add(AssetType.class); + classes.add(EntryType.class); + classes.add(FeedType.class); + classes.add(JobType.class); + classes.add(LocatorRestType.class); + classes.add(TaskType.class); + classes.add(ContentKeyRestType.class); + classes.add(AssetFileType.class); + return classes.toArray(new Class[0]); + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/ODataAtomUnmarshaller.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/ODataAtomUnmarshaller.java new file mode 100644 index 000000000000..2543722eb0a5 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/ODataAtomUnmarshaller.java @@ -0,0 +1,244 @@ +/** + * 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; + +import java.io.InputStream; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.ParameterizedType; +import java.util.ArrayList; +import java.util.List; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBElement; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Unmarshaller; +import javax.xml.namespace.QName; +import javax.xml.transform.stream.StreamSource; + +import org.w3c.dom.Element; + +import com.microsoft.windowsazure.services.core.ServiceException; +import com.microsoft.windowsazure.services.media.implementation.atom.ContentType; +import com.microsoft.windowsazure.services.media.implementation.atom.EntryType; +import com.microsoft.windowsazure.services.media.implementation.atom.FeedType; +import com.microsoft.windowsazure.services.media.implementation.content.AssetType; +import com.microsoft.windowsazure.services.media.implementation.content.Constants; +import com.microsoft.windowsazure.services.media.implementation.content.ODataActionType; +import com.microsoft.windowsazure.services.media.models.ListResult; + +/** + * This class implements unmarshalling from OData over Atom into Java + * classes. + * + */ +public class ODataAtomUnmarshaller { + private final JAXBContext atomContext; + private final JAXBContext mediaContentContext; + private final Unmarshaller atomUnmarshaller; + private final Unmarshaller mediaContentUnmarshaller; + + /** + * @throws JAXBException + */ + public ODataAtomUnmarshaller() throws JAXBException { + atomContext = JAXBContext.newInstance(FeedType.class.getPackage().getName()); + atomUnmarshaller = atomContext.createUnmarshaller(); + mediaContentContext = JAXBContext.newInstance(AssetType.class.getPackage().getName()); + mediaContentUnmarshaller = mediaContentContext.createUnmarshaller(); + } + + /** + * Given a stream that contains XML with an atom Feed element at the root, + * unmarshal it into Java objects with the given content type in the entries. + * + * @param + * + * @param stream + * - stream containing the XML data + * @param contentType + * - Java type to unmarshal the entry contents into + * @return an instance of contentType that contains the unmarshalled data. + * @throws JAXBException + * @throws ServiceException + */ + @SuppressWarnings("rawtypes") + public ListResult unmarshalFeed(InputStream stream, Class contentType) + throws JAXBException, ServiceException { + validateNotNull(stream, "stream"); + validateNotNull(contentType, "contentType"); + + List entries = new ArrayList(); + FeedType feed = unmarshalFeed(stream); + Class marshallingContentType = getMarshallingContentType(contentType); + + for (Object feedChild : feed.getFeedChildren()) { + EntryType entry = asEntry(feedChild); + if (entry != null) { + entries.add(contentFromEntry(contentType, marshallingContentType, entry)); + } + } + return new ListResult(entries); + } + + /** + * Given a stream containing XML with an Atom entry element at the root, + * unmarshal it into an instance of contentType + * + * @param stream + * - stream containing XML data + * @param contentType + * - type of object to return + * @return An instance of contentType + * @throws JAXBException + * @throws ServiceException + */ + @SuppressWarnings("rawtypes") + public T unmarshalEntry(InputStream stream, Class contentType) throws JAXBException, + ServiceException { + validateNotNull(stream, "stream"); + validateNotNull(contentType, "contentType"); + + Class marshallingContentType = getMarshallingContentType(contentType); + + EntryType entry = unmarshalEntry(stream); + return contentFromEntry(contentType, marshallingContentType, entry); + } + + @SuppressWarnings("rawtypes") + private T contentFromEntry(Class contentType, Class marshallingContentType, + EntryType entry) throws JAXBException, ServiceException { + unmarshalODataContent(entry, contentType); + ContentType contentElement = getFirstOfType(ContentType.class, entry.getEntryChildren()); + Object contentObject = getFirstOfType(marshallingContentType, contentElement.getContent()); + return constructResultObject(contentType, entry, contentObject); + } + + private EntryType asEntry(Object o) { + if (o instanceof JAXBElement) { + @SuppressWarnings("rawtypes") + JAXBElement e = (JAXBElement) o; + if (e.getDeclaredType() == EntryType.class) { + return (EntryType) e.getValue(); + } + } + return null; + } + + private void unmarshalODataContent(EntryType entry, Class contentType) throws JAXBException { + unmarshalEntryActions(entry); + unmarshalEntryContent(entry, contentType); + } + + private void unmarshalEntryActions(EntryType entry) throws JAXBException { + List children = entry.getEntryChildren(); + for (int i = 0; i < children.size(); ++i) { + Object child = children.get(i); + if (child instanceof Element) { + Element e = (Element) child; + if (qnameFromElement(e).equals(Constants.ODATA_ACTION_ELEMENT_NAME)) { + JAXBElement actionElement = mediaContentUnmarshaller.unmarshal(e, + ODataActionType.class); + children.set(i, actionElement); + } + } + } + } + + @SuppressWarnings("rawtypes") + private void unmarshalEntryContent(EntryType entry, Class contentType) throws JAXBException { + Class marshallingContentType = getMarshallingContentType(contentType); + ContentType contentElement = getFirstOfType(ContentType.class, entry.getEntryChildren()); + List contentChildren = contentElement.getContent(); + for (int i = 0; i < contentChildren.size(); ++i) { + Object child = contentChildren.get(i); + if (child instanceof Element) { + Element e = (Element) child; + if (qnameFromElement(e).equals(Constants.ODATA_PROPERTIES_ELEMENT_NAME)) { + JAXBElement actualContentElement = mediaContentUnmarshaller.unmarshal(e, marshallingContentType); + contentChildren.set(i, actualContentElement); + } + } + } + } + + @SuppressWarnings("unchecked") + private T getFirstOfType(Class targetType, List collection) { + for (Object c : collection) { + if (c instanceof JAXBElement) { + @SuppressWarnings("rawtypes") + JAXBElement e = (JAXBElement) c; + if (e.getDeclaredType() == targetType) { + return (T) e.getValue(); + } + } + } + return null; + } + + @SuppressWarnings("rawtypes") + private T constructResultObject(Class contentType, EntryType entry, Object contentObject) + throws ServiceException { + Class marshallingType = getMarshallingContentType(contentType); + try { + Constructor resultCtor = contentType.getConstructor(EntryType.class, marshallingType); + return resultCtor.newInstance(entry, contentObject); + } + catch (IllegalArgumentException e) { + throw new ServiceException(e); + } + catch (SecurityException e) { + throw new ServiceException(e); + } + catch (InstantiationException e) { + throw new ServiceException(e); + } + catch (IllegalAccessException e) { + throw new ServiceException(e); + } + catch (InvocationTargetException e) { + throw new ServiceException(e); + } + catch (NoSuchMethodException e) { + throw new ServiceException(e); + } + } + + public EntryType unmarshalEntry(InputStream stream) throws JAXBException { + JAXBElement entryElement = atomUnmarshaller.unmarshal(new StreamSource(stream), EntryType.class); + return entryElement.getValue(); + } + + private FeedType unmarshalFeed(InputStream stream) throws JAXBException { + JAXBElement feedElement = atomUnmarshaller.unmarshal(new StreamSource(stream), FeedType.class); + return feedElement.getValue(); + } + + private static QName qnameFromElement(Element e) { + return new QName(e.getLocalName(), e.getNamespaceURI()); + } + + private static Class getMarshallingContentType(Class contentType) { + ParameterizedType pt = (ParameterizedType) contentType.getGenericSuperclass(); + return (Class) pt.getActualTypeArguments()[0]; + } + + private static void validateNotNull(Object param, String paramName) { + if (param == null) { + throw new IllegalArgumentException(paramName); + } + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/ODataDateAdapter.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/ODataDateAdapter.java new file mode 100644 index 000000000000..c09aa98d873d --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/ODataDateAdapter.java @@ -0,0 +1,63 @@ +/** + * 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; + +import java.util.Calendar; +import java.util.Date; +import java.util.TimeZone; +import java.util.regex.Pattern; + +import javax.xml.bind.DatatypeConverter; +import javax.xml.bind.annotation.adapters.XmlAdapter; + +/** + * Adapter to convert OData time zone conventions into Java + * Dates and back. + * + */ +public class ODataDateAdapter extends XmlAdapter { + + private final static Pattern hasTimezoneRegex; + private final static TimeZone utc; + + static { + hasTimezoneRegex = Pattern.compile("^.*(\\+|-)\\d\\d:\\d\\d$"); + + utc = TimeZone.getDefault(); + utc.setRawOffset(0); + } + + @Override + public Date unmarshal(String dateString) throws Exception { + if (!hasTimezone(dateString)) { + dateString += "Z"; + } + Calendar parsedDate = DatatypeConverter.parseDateTime(dateString); + return parsedDate.getTime(); + } + + @Override + public String marshal(Date date) throws Exception { + Calendar dateToMarshal = Calendar.getInstance(); + dateToMarshal.setTime(date); + dateToMarshal.setTimeZone(utc); + return DatatypeConverter.printDateTime(dateToMarshal); + } + + private boolean hasTimezone(String dateString) { + return dateString.endsWith("Z") || hasTimezoneRegex.matcher(dateString).matches(); + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/ODataEntity.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/ODataEntity.java new file mode 100644 index 000000000000..c89f3453c89d --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/ODataEntity.java @@ -0,0 +1,177 @@ +/** + * 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; + +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; + +import javax.xml.bind.JAXBElement; + +import com.microsoft.windowsazure.services.media.implementation.atom.ContentType; +import com.microsoft.windowsazure.services.media.implementation.atom.EntryType; +import com.microsoft.windowsazure.services.media.implementation.atom.LinkType; +import com.microsoft.windowsazure.services.media.implementation.content.Constants; +import com.microsoft.windowsazure.services.media.models.LinkInfo; +import com.microsoft.windowsazure.services.media.models.ListResult; + +/** + * Class wrapping deserialized OData entities. Allows easy + * access to entry and content types. + * + */ +public abstract class ODataEntity { + + private final EntryType entry; + private final T content; + + protected ODataEntity(EntryType entry, T content) { + this.entry = entry; + this.content = content; + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + protected ODataEntity(T content) { + this.content = content; + + ContentType contentElement = new ContentType(); + contentElement.getContent().add( + new JAXBElement(Constants.ODATA_PROPERTIES_ELEMENT_NAME, content.getClass(), content)); + entry = new EntryType(); + entry.getEntryChildren().add( + new JAXBElement(Constants.ATOM_CONTENT_ELEMENT_NAME, ContentType.class, contentElement)); + } + + /** + * @return the entry + */ + protected EntryType getEntry() { + return entry; + } + + /** + * @return the content + */ + protected T getContent() { + return content; + } + + /** + * Test if the entity contains a link with the given rel attribute. + * + * @param rel + * Rel of link to check for + * @return True if link is found, false if not. + */ + public boolean hasLink(String rel) { + return getLink(rel) != null; + } + + /** + * Get the link with the given rel attribute + * + * @param rel + * rel of link to retrieve + * @return The link if found, null if not. + */ + public > LinkInfo getLink(String rel) { + for (Object child : entry.getEntryChildren()) { + + LinkType link = LinkFromChild(child); + if (link != null && link.getRel().equals(rel)) { + return new LinkInfo(link); + } + } + return null; + } + + /** + * 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 this. getLink(Constants.ODATA_DATA_NS + "/related/" + relationName); + } + + @SuppressWarnings("rawtypes") + private static LinkType LinkFromChild(Object child) { + if (child instanceof JAXBElement) { + return LinkFromElement((JAXBElement) child); + } + return null; + } + + private static LinkType LinkFromElement(@SuppressWarnings("rawtypes") JAXBElement element) { + if (element.getDeclaredType() == LinkType.class) { + return (LinkType) element.getValue(); + } + return null; + } + + /** + * Is the given type inherited from ODataEntity + * + * @param type + * Type to check + * @return true if derived from ODataEntity + */ + public static boolean isODataEntityType(Class type) { + return ODataEntity.class.isAssignableFrom(type); + } + + /** + * Is the given type a collection of ODataEntity + * + * @param type + * Base type + * @param genericType + * Generic type + * @return true if it's List<OEntity> or derive from. + */ + public static boolean isODataEntityCollectionType(Class type, Type genericType) { + if (ListResult.class != type) { + return false; + } + + ParameterizedType pt = (ParameterizedType) genericType; + + if (pt.getActualTypeArguments().length != 1) { + return false; + } + + Class typeClass = getCollectedType(genericType); + + return isODataEntityType(typeClass); + } + + /** + * Reflection helper to pull out the type parameter for + * a List, where T is a ODataEntity derived type. + * + * @param genericType + * type object for collection + * @return The class object for the type parameter. + */ + public static Class getCollectedType(Type genericType) { + ParameterizedType pt = (ParameterizedType) genericType; + if (pt.getActualTypeArguments().length != 1) { + throw new IllegalArgumentException("genericType"); + } + return (Class) pt.getActualTypeArguments()[0]; + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/ODataEntityCollectionProvider.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/ODataEntityCollectionProvider.java new file mode 100644 index 000000000000..5b04e13ce4e7 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/ODataEntityCollectionProvider.java @@ -0,0 +1,97 @@ +/** + * 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; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; + +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedMap; +import javax.xml.bind.JAXBException; + +import com.microsoft.windowsazure.services.core.ServiceException; +import com.microsoft.windowsazure.services.media.models.ListResult; +import com.sun.jersey.core.provider.AbstractMessageReaderWriterProvider; + +/** + * Jersey provider to unmarshal lists of entities from Media Services. + * + */ +public class ODataEntityCollectionProvider extends AbstractMessageReaderWriterProvider>> { + private final ODataAtomUnmarshaller unmarshaller; + + public ODataEntityCollectionProvider() throws JAXBException { + unmarshaller = new ODataAtomUnmarshaller(); + } + + @Override + public boolean isReadable(Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { + return ODataEntity.isODataEntityCollectionType(type, genericType); + } + + @SuppressWarnings("unchecked") + @Override + public ListResult> readFrom(Class>> type, Type genericType, + Annotation[] annotations, MediaType mediaType, MultivaluedMap httpHeaders, + InputStream entityStream) throws IOException, WebApplicationException { + + String responseType = mediaType.getParameters().get("type"); + try { + if (responseType == null || responseType.equals("feed")) { + return unmarshaller.unmarshalFeed(entityStream, + (Class>) ODataEntity.getCollectedType(genericType)); + } + else { + throw new RuntimeException(); + } + } + catch (JAXBException e) { + throw new RuntimeException(e); + } + catch (ServiceException e) { + throw new RuntimeException(e); + } + } + + /** + * Can this type be written by this provider? + * + * @return false - we don't support writing + */ + @Override + public boolean isWriteable(Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { + return false; + } + + /** + * Write the given object to the stream. + * This method implementation throws, we don't support writing. + * + * @throws UnsupportedOperationException + */ + @Override + public void writeTo(ListResult> t, Class type, Type genericType, Annotation[] annotations, + MediaType mediaType, MultivaluedMap httpHeaders, OutputStream entityStream) + throws IOException, WebApplicationException { + + throw new UnsupportedOperationException(); + } + +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/ODataEntityProvider.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/ODataEntityProvider.java new file mode 100644 index 000000000000..0a2150608560 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/ODataEntityProvider.java @@ -0,0 +1,103 @@ +/** + * 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; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; +import java.util.List; + +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedMap; +import javax.xml.bind.JAXBException; +import javax.xml.parsers.ParserConfigurationException; + +import com.microsoft.windowsazure.services.core.ServiceException; +import com.sun.jersey.core.provider.AbstractMessageReaderWriterProvider; + +/** + * An implementation of {@link AbstractMessageReaderWriterProvider } that + * is used to marshal and unmarshal instances of the ODataEntity type. + * + */ +public class ODataEntityProvider extends AbstractMessageReaderWriterProvider> { + private final ODataAtomUnmarshaller unmarshaller; + + public ODataEntityProvider() throws JAXBException, ParserConfigurationException { + unmarshaller = new ODataAtomUnmarshaller(); + } + + /* (non-Javadoc) + * @see javax.ws.rs.ext.MessageBodyReader#isReadable(java.lang.Class, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType) + */ + @Override + public boolean isReadable(Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { + return ODataEntity.isODataEntityType(type); + } + + /* (non-Javadoc) + * @see javax.ws.rs.ext.MessageBodyReader#readFrom(java.lang.Class, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType, javax.ws.rs.core.MultivaluedMap, java.io.InputStream) + */ + @Override + public ODataEntity readFrom(Class> type, Type genericType, Annotation[] annotations, + MediaType mediaType, MultivaluedMap httpHeaders, InputStream entityStream) + throws IOException, WebApplicationException { + + ODataEntity result = null; + String responseType = mediaType.getParameters().get("type"); + try { + if (responseType == null || responseType.equals("feed")) { + List> feedContents = unmarshaller.unmarshalFeed(entityStream, type); + return feedContents.get(0); + } + else if (responseType.equals("entry")) { + result = unmarshaller.unmarshalEntry(entityStream, type); + } + else { + throw new RuntimeException(); + } + } + catch (JAXBException e) { + throw new RuntimeException(e); + } + catch (ServiceException e) { + throw new RuntimeException(e); + } + + return result; + } + + /* (non-Javadoc) + * @see javax.ws.rs.ext.MessageBodyWriter#isWriteable(java.lang.Class, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType) + */ + @Override + public boolean isWriteable(Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { + return false; + } + + /* (non-Javadoc) + * @see javax.ws.rs.ext.MessageBodyWriter#writeTo(java.lang.Object, java.lang.Class, java.lang.reflect.Type, java.lang.annotation.Annotation[], javax.ws.rs.core.MediaType, javax.ws.rs.core.MultivaluedMap, java.io.OutputStream) + */ + @Override + public void writeTo(ODataEntity t, Class type, Type genericType, Annotation[] annotations, + MediaType mediaType, MultivaluedMap httpHeaders, OutputStream entityStream) + throws IOException, WebApplicationException { + throw new UnsupportedOperationException(); + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/RedirectFilter.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/RedirectFilter.java new file mode 100644 index 000000000000..433e5ec7e6e8 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/RedirectFilter.java @@ -0,0 +1,66 @@ +/** + * 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; + +import java.net.URI; +import java.net.URISyntaxException; + +import com.microsoft.windowsazure.services.core.IdempotentClientFilter; +import com.sun.jersey.api.client.ClientHandlerException; +import com.sun.jersey.api.client.ClientRequest; +import com.sun.jersey.api.client.ClientResponse; + +public class RedirectFilter extends IdempotentClientFilter { + private final ResourceLocationManager locationManager; + + public RedirectFilter(ResourceLocationManager locationManager) { + this.locationManager = locationManager; + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.core.IdempotentClientFilter#doHandle(com.sun.jersey.api.client.ClientRequest) + */ + @Override + public ClientResponse doHandle(ClientRequest request) throws ClientHandlerException { + if (request == null) { + throw new IllegalArgumentException("Request should not be null"); + } + + URI originalURI = request.getURI(); + request.setURI(locationManager.getRedirectedURI(originalURI)); + + ClientResponse response = getNext().handle(request); + while (response.getClientResponseStatus() == ClientResponse.Status.MOVED_PERMANENTLY) { + try { + locationManager.setRedirectedURI(response.getHeaders().getFirst("Location")); + } + catch (NullPointerException e) { + throw new ClientHandlerException("HTTP Redirect did not include Location header"); + } + catch (URISyntaxException e) { + throw new ClientHandlerException("HTTP Redirect location is not a valid URI"); + } + + request.setURI(locationManager.getRedirectedURI(originalURI)); + response = getNext().handle(request); + } + return response; + } + + public URI getBaseURI() { + return this.locationManager.getBaseURI(); + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/ResourceLocationManager.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/ResourceLocationManager.java new file mode 100644 index 000000000000..e1d4807f51a2 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/ResourceLocationManager.java @@ -0,0 +1,50 @@ +/** + * 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; + +import java.net.URI; +import java.net.URISyntaxException; + +import javax.inject.Named; +import javax.ws.rs.core.UriBuilder; + +import com.microsoft.windowsazure.services.media.MediaConfiguration; + +public class ResourceLocationManager { + private URI baseURI; + + public ResourceLocationManager(@Named(MediaConfiguration.URI) String baseUri) throws URISyntaxException { + this.baseURI = new URI(baseUri); + } + + public URI getBaseURI() { + return baseURI; + } + + public URI getRedirectedURI(URI originalURI) { + UriBuilder uriBuilder = UriBuilder.fromUri(baseURI).path(originalURI.getPath()); + String queryString = originalURI.getQuery(); + + if (queryString != null && !queryString.isEmpty()) { + uriBuilder.replaceQuery(queryString); + } + return uriBuilder.build(); + } + + public void setRedirectedURI(String newURI) throws URISyntaxException { + baseURI = new URI(newURI); + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/SASTokenFilter.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/SASTokenFilter.java new file mode 100644 index 000000000000..f5c3ef493a68 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/SASTokenFilter.java @@ -0,0 +1,66 @@ +/** + * 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; + +import java.net.URISyntaxException; + +import javax.ws.rs.core.UriBuilder; + +import com.microsoft.windowsazure.services.core.IdempotentClientFilter; +import com.sun.jersey.api.client.ClientHandlerException; +import com.sun.jersey.api.client.ClientRequest; +import com.sun.jersey.api.client.ClientResponse; + +/** + * Filter responsible for adding SAS tokens to outgoing requests. + * + */ +public class SASTokenFilter extends IdempotentClientFilter { + private final String sasToken; + + /** + * Construct a SASTokenFilter that will insert the tokens given + * in the provided sasUrl. + * + * @param sasUrl + * URL containing authentication information + * @throws URISyntaxException + */ + public SASTokenFilter(String sasToken) { + this.sasToken = sasToken; + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.core.IdempotentClientFilter#doHandle(com.sun.jersey.api.client.ClientRequest) + */ + @Override + public ClientResponse doHandle(ClientRequest cr) throws ClientHandlerException { + UriBuilder newUri = UriBuilder.fromUri(cr.getURI()); + String currentQuery = cr.getURI().getRawQuery(); + if (currentQuery == null) { + currentQuery = ""; + } + else if (currentQuery.length() > 0) { + currentQuery += "&"; + } + currentQuery += sasToken; + + newUri.replaceQuery(currentQuery); + cr.setURI(newUri.build()); + + return getNext().handle(cr); + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/SetBoundaryMultipartDataSource.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/SetBoundaryMultipartDataSource.java new file mode 100644 index 000000000000..98af8d57b125 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/SetBoundaryMultipartDataSource.java @@ -0,0 +1,63 @@ +/** + * 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; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; + +import javax.mail.BodyPart; +import javax.mail.MessagingException; +import javax.mail.MultipartDataSource; + +public class SetBoundaryMultipartDataSource implements MultipartDataSource { + + private final String boundary; + + public SetBoundaryMultipartDataSource(String boundary) { + this.boundary = boundary; + } + + @Override + public String getContentType() { + return "multipart/mixed; boundary=" + boundary; + } + + @Override + public InputStream getInputStream() throws IOException { + return null; + } + + @Override + public String getName() { + return null; + } + + @Override + public OutputStream getOutputStream() throws IOException { + return null; + } + + @Override + public int getCount() { + return 0; + } + + @Override + public BodyPart getBodyPart(int index) throws MessagingException { + return null; + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/StatusLine.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/StatusLine.java new file mode 100644 index 000000000000..d3fabaa0c460 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/StatusLine.java @@ -0,0 +1,104 @@ +/** + * 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; + +import java.io.IOException; +import java.io.Reader; +import java.io.StringReader; + +import javax.activation.DataSource; + +import com.sun.mail.util.LineInputStream; + +public class StatusLine { + private int status; + private String reason; + + public static StatusLine create(DataSource dataSource) { + try { + LineInputStream stream = new LineInputStream(dataSource.getInputStream()); + try { + String line = stream.readLine(); + StringReader lineReader = new StringReader(line); + + expect(lineReader, "HTTP/1.1"); + expect(lineReader, " "); + String statusString = extractInput(lineReader, ' '); + String reason = extractInput(lineReader, -1); + + return new StatusLine().setStatus(Integer.parseInt(statusString)).setReason(reason); + } + finally { + stream.close(); + } + } + catch (IOException e) { + throw new RuntimeException(e); + } + } + + private static void expect(Reader reader, String string) { + try { + byte[] byteArray = string.getBytes(); + int ch; + for (int i = 0; i < string.length(); i++) { + ch = reader.read(); + if (ch != byteArray[i]) { + throw new RuntimeException(String.format("Expected '%s', found '%s' instead", string, + string.substring(0, i) + ch)); + } + } + } + catch (IOException e) { + throw new RuntimeException(e); + } + } + + private static String extractInput(Reader reader, int delimiter) { + try { + StringBuilder sb = new StringBuilder(); + while (true) { + int ch = reader.read(); + if (ch == -1 || ch == delimiter) + break; + + sb.append((char) ch); + } + return sb.toString(); + } + catch (IOException e) { + throw new RuntimeException(e); + } + } + + public int getStatus() { + return status; + } + + public StatusLine setStatus(int status) { + this.status = status; + return this; + } + + public String getReason() { + return reason; + } + + public StatusLine setReason(String reason) { + this.reason = reason; + return this; + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/VersionHeadersFilter.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/VersionHeadersFilter.java new file mode 100644 index 000000000000..d21e3852162c --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/VersionHeadersFilter.java @@ -0,0 +1,43 @@ +/** + * 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; + +import javax.ws.rs.core.MultivaluedMap; + +import com.microsoft.windowsazure.services.core.IdempotentClientFilter; +import com.sun.jersey.api.client.ClientHandlerException; +import com.sun.jersey.api.client.ClientRequest; +import com.sun.jersey.api.client.ClientResponse; + +/** + * A small filter that adds the required Media services/OData 3 + * version headers to the request as it goes through. + * + */ +public class VersionHeadersFilter extends IdempotentClientFilter { + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.core.IdempotentClientFilter#doHandle(com.sun.jersey.api.client.ClientRequest) + */ + @Override + public ClientResponse doHandle(ClientRequest cr) throws ClientHandlerException { + MultivaluedMap headers = cr.getHeaders(); + headers.add("DataServiceVersion", "3.0"); + headers.add("MaxDataServiceVersion", "3.0"); + headers.add("x-ms-version", "2.0"); + return getNext().handle(cr); + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/CategoryType.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/CategoryType.java new file mode 100644 index 000000000000..985521f1baf6 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/CategoryType.java @@ -0,0 +1,223 @@ +/** + * 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. + */ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2012.09.17 at 02:31:28 PM PDT +// + + +package com.microsoft.windowsazure.services.media.implementation.atom; + +import java.util.HashMap; +import java.util.Map; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAnyAttribute; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import javax.xml.namespace.QName; + + +/** + * + * The Atom cagegory construct is defined in section 4.2.2 of the format spec. + * + * + *

Java class for categoryType complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="categoryType">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <attGroup ref="{http://www.w3.org/2005/Atom}commonAttributes"/>
+ *       <attribute name="term" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *       <attribute name="scheme" type="{http://www.w3.org/2001/XMLSchema}anyURI" />
+ *       <attribute name="label" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *       <anyAttribute namespace='##other'/>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "categoryType") +public class CategoryType { + + @XmlAttribute(required = true) + protected String term; + @XmlAttribute + @XmlSchemaType(name = "anyURI") + protected String scheme; + @XmlAttribute + protected String label; + @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace") + @XmlSchemaType(name = "anyURI") + protected String base; + @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + @XmlSchemaType(name = "language") + protected String lang; + @XmlAnyAttribute + private Map otherAttributes = new HashMap(); + + /** + * Gets the value of the term property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTerm() { + return term; + } + + /** + * Sets the value of the term property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTerm(String value) { + this.term = value; + } + + /** + * Gets the value of the scheme property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getScheme() { + return scheme; + } + + /** + * Sets the value of the scheme property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setScheme(String value) { + this.scheme = value; + } + + /** + * Gets the value of the label property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getLabel() { + return label; + } + + /** + * Sets the value of the label property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setLabel(String value) { + this.label = value; + } + + /** + * Gets the value of the base property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getBase() { + return base; + } + + /** + * Sets the value of the base property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setBase(String value) { + this.base = value; + } + + /** + * Gets the value of the lang property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getLang() { + return lang; + } + + /** + * Sets the value of the lang property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setLang(String value) { + this.lang = value; + } + + /** + * Gets a map that contains attributes that aren't bound to any typed property on this class. + * + *

+ * the map is keyed by the name of the attribute and + * the value is the string value of the attribute. + * + * the map returned by this method is live, and you can add new attribute + * by updating the map directly. Because of this design, there's no setter. + * + * + * @return + * always non-null + */ + public Map getOtherAttributes() { + return otherAttributes; + } + +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/ContentType.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/ContentType.java new file mode 100644 index 000000000000..d828ce6a922e --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/ContentType.java @@ -0,0 +1,240 @@ +/** + * 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. + */ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2012.09.17 at 02:31:28 PM PDT +// + + +package com.microsoft.windowsazure.services.media.implementation.atom; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAnyAttribute; +import javax.xml.bind.annotation.XmlAnyElement; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlMixed; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import javax.xml.namespace.QName; + + +/** + * + * The Atom content construct is defined in section 4.1.3 of the format spec. + * + * + *

Java class for contentType complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="contentType">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <any namespace='##other' maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *       <attGroup ref="{http://www.w3.org/2005/Atom}commonAttributes"/>
+ *       <attribute name="type" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *       <attribute name="src" type="{http://www.w3.org/2001/XMLSchema}anyURI" />
+ *       <anyAttribute namespace='##other'/>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "contentType", propOrder = { + "content" +}) +public class ContentType { + + @XmlMixed + @XmlAnyElement(lax = true) + protected List content; + @XmlAttribute + protected String type; + @XmlAttribute + @XmlSchemaType(name = "anyURI") + protected String src; + @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace") + @XmlSchemaType(name = "anyURI") + protected String base; + @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + @XmlSchemaType(name = "language") + protected String lang; + @XmlAnyAttribute + private Map otherAttributes = new HashMap(); + + /** + * + * The Atom content construct is defined in section 4.1.3 of the format spec. + * Gets the value of the content property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the content property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getContent().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link Object } + * {@link String } + * + * + */ + public List getContent() { + if (content == null) { + content = new ArrayList(); + } + return this.content; + } + + /** + * Gets the value of the type property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getType() { + return type; + } + + /** + * Sets the value of the type property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setType(String value) { + this.type = value; + } + + /** + * Gets the value of the src property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getSrc() { + return src; + } + + /** + * Sets the value of the src property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setSrc(String value) { + this.src = value; + } + + /** + * Gets the value of the base property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getBase() { + return base; + } + + /** + * Sets the value of the base property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setBase(String value) { + this.base = value; + } + + /** + * Gets the value of the lang property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getLang() { + return lang; + } + + /** + * Sets the value of the lang property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setLang(String value) { + this.lang = value; + } + + /** + * Gets a map that contains attributes that aren't bound to any typed property on this class. + * + *

+ * the map is keyed by the name of the attribute and + * the value is the string value of the attribute. + * + * the map returned by this method is live, and you can add new attribute + * by updating the map directly. Because of this design, there's no setter. + * + * + * @return + * always non-null + */ + public Map getOtherAttributes() { + return otherAttributes; + } + +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/DateTimeType.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/DateTimeType.java new file mode 100644 index 000000000000..8097815ad187 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/DateTimeType.java @@ -0,0 +1,168 @@ +/** + * 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. + */ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2012.09.17 at 02:31:28 PM PDT +// + + +package com.microsoft.windowsazure.services.media.implementation.atom; + +import java.util.HashMap; +import java.util.Map; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAnyAttribute; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlValue; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import javax.xml.datatype.XMLGregorianCalendar; +import javax.xml.namespace.QName; + + +/** + *

Java class for dateTimeType complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="dateTimeType">
+ *   <simpleContent>
+ *     <extension base="<http://www.w3.org/2001/XMLSchema>dateTime">
+ *       <attGroup ref="{http://www.w3.org/2005/Atom}commonAttributes"/>
+ *       <anyAttribute namespace='##other'/>
+ *     </extension>
+ *   </simpleContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "dateTimeType", propOrder = { + "value" +}) +public class DateTimeType { + + @XmlValue + @XmlSchemaType(name = "dateTime") + protected XMLGregorianCalendar value; + @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace") + @XmlSchemaType(name = "anyURI") + protected String base; + @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + @XmlSchemaType(name = "language") + protected String lang; + @XmlAnyAttribute + private Map otherAttributes = new HashMap(); + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link XMLGregorianCalendar } + * + */ + public XMLGregorianCalendar getValue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link XMLGregorianCalendar } + * + */ + public void setValue(XMLGregorianCalendar value) { + this.value = value; + } + + /** + * Gets the value of the base property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getBase() { + return base; + } + + /** + * Sets the value of the base property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setBase(String value) { + this.base = value; + } + + /** + * Gets the value of the lang property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getLang() { + return lang; + } + + /** + * Sets the value of the lang property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setLang(String value) { + this.lang = value; + } + + /** + * Gets a map that contains attributes that aren't bound to any typed property on this class. + * + *

+ * the map is keyed by the name of the attribute and + * the value is the string value of the attribute. + * + * the map returned by this method is live, and you can add new attribute + * by updating the map directly. Because of this design, there's no setter. + * + * + * @return + * always non-null + */ + public Map getOtherAttributes() { + return otherAttributes; + } + +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/EntryType.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/EntryType.java new file mode 100644 index 000000000000..6b391b9cdd08 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/EntryType.java @@ -0,0 +1,221 @@ +/** + * 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. + */ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2012.09.17 at 02:31:28 PM PDT +// + + +package com.microsoft.windowsazure.services.media.implementation.atom; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAnyAttribute; +import javax.xml.bind.annotation.XmlAnyElement; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlElementRefs; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import javax.xml.namespace.QName; + + +/** + * + * The Atom entry construct is defined in section 4.1.2 of the format spec. + * + * + *

Java class for entryType complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="entryType">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <choice maxOccurs="unbounded">
+ *         <element name="author" type="{http://www.w3.org/2005/Atom}personType" maxOccurs="unbounded" minOccurs="0"/>
+ *         <element name="category" type="{http://www.w3.org/2005/Atom}categoryType" maxOccurs="unbounded" minOccurs="0"/>
+ *         <element name="content" type="{http://www.w3.org/2005/Atom}contentType" minOccurs="0"/>
+ *         <element name="contributor" type="{http://www.w3.org/2005/Atom}personType" maxOccurs="unbounded" minOccurs="0"/>
+ *         <element name="id" type="{http://www.w3.org/2005/Atom}idType"/>
+ *         <element name="link" type="{http://www.w3.org/2005/Atom}linkType" maxOccurs="unbounded" minOccurs="0"/>
+ *         <element name="published" type="{http://www.w3.org/2005/Atom}dateTimeType" minOccurs="0"/>
+ *         <element name="rights" type="{http://www.w3.org/2005/Atom}textType" minOccurs="0"/>
+ *         <element name="source" type="{http://www.w3.org/2005/Atom}textType" minOccurs="0"/>
+ *         <element name="summary" type="{http://www.w3.org/2005/Atom}textType" minOccurs="0"/>
+ *         <element name="title" type="{http://www.w3.org/2005/Atom}textType"/>
+ *         <element name="updated" type="{http://www.w3.org/2005/Atom}dateTimeType"/>
+ *         <any namespace='##other' maxOccurs="unbounded" minOccurs="0"/>
+ *       </choice>
+ *       <attGroup ref="{http://www.w3.org/2005/Atom}commonAttributes"/>
+ *       <anyAttribute namespace='##other'/>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "entryType", propOrder = { + "entryChildren" +}) +public class EntryType { + + @XmlElementRefs({ + @XmlElementRef(name = "category", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class), + @XmlElementRef(name = "rights", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class), + @XmlElementRef(name = "published", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class), + @XmlElementRef(name = "author", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class), + @XmlElementRef(name = "link", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class), + @XmlElementRef(name = "title", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class), + @XmlElementRef(name = "summary", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class), + @XmlElementRef(name = "id", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class), + @XmlElementRef(name = "source", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class), + @XmlElementRef(name = "content", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class), + @XmlElementRef(name = "updated", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class), + @XmlElementRef(name = "contributor", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class) + }) + @XmlAnyElement(lax = true) + protected List entryChildren; + @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace") + @XmlSchemaType(name = "anyURI") + protected String base; + @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + @XmlSchemaType(name = "language") + protected String lang; + @XmlAnyAttribute + private Map otherAttributes = new HashMap(); + + /** + * Gets the value of the entryChildren property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the entryChildren property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getEntryChildren().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link JAXBElement }{@code <}{@link CategoryType }{@code >} + * {@link JAXBElement }{@code <}{@link TextType }{@code >} + * {@link JAXBElement }{@code <}{@link DateTimeType }{@code >} + * {@link JAXBElement }{@code <}{@link PersonType }{@code >} + * {@link JAXBElement }{@code <}{@link LinkType }{@code >} + * {@link JAXBElement }{@code <}{@link TextType }{@code >} + * {@link JAXBElement }{@code <}{@link DateTimeType }{@code >} + * {@link JAXBElement }{@code <}{@link PersonType }{@code >} + * {@link JAXBElement }{@code <}{@link TextType }{@code >} + * {@link JAXBElement }{@code <}{@link TextType }{@code >} + * {@link JAXBElement }{@code <}{@link IdType }{@code >} + * {@link JAXBElement }{@code <}{@link ContentType }{@code >} + * {@link Object } + * + * + */ + public List getEntryChildren() { + if (entryChildren == null) { + entryChildren = new ArrayList(); + } + return this.entryChildren; + } + + /** + * Gets the value of the base property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getBase() { + return base; + } + + /** + * Sets the value of the base property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setBase(String value) { + this.base = value; + } + + /** + * Gets the value of the lang property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getLang() { + return lang; + } + + /** + * Sets the value of the lang property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setLang(String value) { + this.lang = value; + } + + /** + * Gets a map that contains attributes that aren't bound to any typed property on this class. + * + *

+ * the map is keyed by the name of the attribute and + * the value is the string value of the attribute. + * + * the map returned by this method is live, and you can add new attribute + * by updating the map directly. Because of this design, there's no setter. + * + * + * @return + * always non-null + */ + public Map getOtherAttributes() { + return otherAttributes; + } + +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/FeedType.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/FeedType.java new file mode 100644 index 000000000000..38d8fd73331b --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/FeedType.java @@ -0,0 +1,224 @@ +/** + * 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. + */ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2012.09.18 at 11:05:53 AM PDT +// + + +package com.microsoft.windowsazure.services.media.implementation.atom; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAnyAttribute; +import javax.xml.bind.annotation.XmlAnyElement; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlElementRefs; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import javax.xml.namespace.QName; + + +/** + * + * The Atom feed construct is defined in section 4.1.1 of the format spec. + * + * + *

Java class for feedType complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="feedType">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <choice maxOccurs="unbounded" minOccurs="3">
+ *         <element name="author" type="{http://www.w3.org/2005/Atom}personType" maxOccurs="unbounded" minOccurs="0"/>
+ *         <element name="category" type="{http://www.w3.org/2005/Atom}categoryType" maxOccurs="unbounded" minOccurs="0"/>
+ *         <element name="contributor" type="{http://www.w3.org/2005/Atom}personType" maxOccurs="unbounded" minOccurs="0"/>
+ *         <element name="generator" type="{http://www.w3.org/2005/Atom}generatorType" minOccurs="0"/>
+ *         <element name="icon" type="{http://www.w3.org/2005/Atom}iconType" minOccurs="0"/>
+ *         <element name="id" type="{http://www.w3.org/2005/Atom}idType"/>
+ *         <element name="link" type="{http://www.w3.org/2005/Atom}linkType" maxOccurs="unbounded" minOccurs="0"/>
+ *         <element name="logo" type="{http://www.w3.org/2005/Atom}logoType" minOccurs="0"/>
+ *         <element name="rights" type="{http://www.w3.org/2005/Atom}textType" minOccurs="0"/>
+ *         <element name="subtitle" type="{http://www.w3.org/2005/Atom}textType" minOccurs="0"/>
+ *         <element name="title" type="{http://www.w3.org/2005/Atom}textType"/>
+ *         <element name="updated" type="{http://www.w3.org/2005/Atom}dateTimeType"/>
+ *         <element name="entry" type="{http://www.w3.org/2005/Atom}entryType" maxOccurs="unbounded" minOccurs="0"/>
+ *         <any namespace='##other' maxOccurs="unbounded" minOccurs="0"/>
+ *       </choice>
+ *       <attGroup ref="{http://www.w3.org/2005/Atom}commonAttributes"/>
+ *       <anyAttribute namespace='##other'/>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "feedType", propOrder = { + "feedChildren" +}) +public class FeedType { + + @XmlElementRefs({ + @XmlElementRef(name = "updated", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class), + @XmlElementRef(name = "generator", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class), + @XmlElementRef(name = "rights", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class), + @XmlElementRef(name = "id", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class), + @XmlElementRef(name = "link", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class), + @XmlElementRef(name = "subtitle", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class), + @XmlElementRef(name = "contributor", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class), + @XmlElementRef(name = "entry", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class), + @XmlElementRef(name = "logo", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class), + @XmlElementRef(name = "icon", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class), + @XmlElementRef(name = "author", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class), + @XmlElementRef(name = "category", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class), + @XmlElementRef(name = "title", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class) + }) + @XmlAnyElement(lax = true) + protected List feedChildren; + @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace") + @XmlSchemaType(name = "anyURI") + protected String base; + @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + @XmlSchemaType(name = "language") + protected String lang; + @XmlAnyAttribute + private Map otherAttributes = new HashMap(); + + /** + * Gets the value of the feedChildren property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the feedChildren property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getFeedChildren().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link JAXBElement }{@code <}{@link DateTimeType }{@code >} + * {@link JAXBElement }{@code <}{@link GeneratorType }{@code >} + * {@link JAXBElement }{@code <}{@link TextType }{@code >} + * {@link JAXBElement }{@code <}{@link IdType }{@code >} + * {@link JAXBElement }{@code <}{@link LinkType }{@code >} + * {@link JAXBElement }{@code <}{@link TextType }{@code >} + * {@link JAXBElement }{@code <}{@link PersonType }{@code >} + * {@link Object } + * {@link JAXBElement }{@code <}{@link EntryType }{@code >} + * {@link JAXBElement }{@code <}{@link LogoType }{@code >} + * {@link JAXBElement }{@code <}{@link IconType }{@code >} + * {@link JAXBElement }{@code <}{@link PersonType }{@code >} + * {@link JAXBElement }{@code <}{@link CategoryType }{@code >} + * {@link JAXBElement }{@code <}{@link TextType }{@code >} + * + * + */ + public List getFeedChildren() { + if (feedChildren == null) { + feedChildren = new ArrayList(); + } + return this.feedChildren; + } + + /** + * Gets the value of the base property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getBase() { + return base; + } + + /** + * Sets the value of the base property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setBase(String value) { + this.base = value; + } + + /** + * Gets the value of the lang property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getLang() { + return lang; + } + + /** + * Sets the value of the lang property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setLang(String value) { + this.lang = value; + } + + /** + * Gets a map that contains attributes that aren't bound to any typed property on this class. + * + *

+ * the map is keyed by the name of the attribute and + * the value is the string value of the attribute. + * + * the map returned by this method is live, and you can add new attribute + * by updating the map directly. Because of this design, there's no setter. + * + * + * @return + * always non-null + */ + public Map getOtherAttributes() { + return otherAttributes; + } + +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/GeneratorType.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/GeneratorType.java new file mode 100644 index 000000000000..884122c1dbe0 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/GeneratorType.java @@ -0,0 +1,225 @@ +/** + * 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. + */ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2012.09.17 at 02:31:28 PM PDT +// + + +package com.microsoft.windowsazure.services.media.implementation.atom; + +import java.util.HashMap; +import java.util.Map; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAnyAttribute; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlValue; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import javax.xml.namespace.QName; + + +/** + * + * The Atom generator element is defined in section 4.2.4 of the format spec. + * + * + *

Java class for generatorType complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="generatorType">
+ *   <simpleContent>
+ *     <extension base="<http://www.w3.org/2001/XMLSchema>string">
+ *       <attGroup ref="{http://www.w3.org/2005/Atom}commonAttributes"/>
+ *       <attribute name="uri" type="{http://www.w3.org/2001/XMLSchema}anyURI" />
+ *       <attribute name="version" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *       <anyAttribute namespace='##other'/>
+ *     </extension>
+ *   </simpleContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "generatorType", propOrder = { + "value" +}) +public class GeneratorType { + + @XmlValue + protected String value; + @XmlAttribute + @XmlSchemaType(name = "anyURI") + protected String uri; + @XmlAttribute + protected String version; + @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace") + @XmlSchemaType(name = "anyURI") + protected String base; + @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + @XmlSchemaType(name = "language") + protected String lang; + @XmlAnyAttribute + private Map otherAttributes = new HashMap(); + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getValue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setValue(String value) { + this.value = value; + } + + /** + * Gets the value of the uri property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getUri() { + return uri; + } + + /** + * Sets the value of the uri property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setUri(String value) { + this.uri = value; + } + + /** + * Gets the value of the version property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVersion() { + return version; + } + + /** + * Sets the value of the version property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVersion(String value) { + this.version = value; + } + + /** + * Gets the value of the base property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getBase() { + return base; + } + + /** + * Sets the value of the base property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setBase(String value) { + this.base = value; + } + + /** + * Gets the value of the lang property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getLang() { + return lang; + } + + /** + * Sets the value of the lang property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setLang(String value) { + this.lang = value; + } + + /** + * Gets a map that contains attributes that aren't bound to any typed property on this class. + * + *

+ * the map is keyed by the name of the attribute and + * the value is the string value of the attribute. + * + * the map returned by this method is live, and you can add new attribute + * by updating the map directly. Because of this design, there's no setter. + * + * + * @return + * always non-null + */ + public Map getOtherAttributes() { + return otherAttributes; + } + +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/IconType.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/IconType.java new file mode 100644 index 000000000000..5ceea0b56e0c --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/IconType.java @@ -0,0 +1,171 @@ +/** + * 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. + */ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2012.09.17 at 02:31:28 PM PDT +// + + +package com.microsoft.windowsazure.services.media.implementation.atom; + +import java.util.HashMap; +import java.util.Map; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAnyAttribute; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlValue; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import javax.xml.namespace.QName; + + +/** + * + * The Atom icon construct is defined in section 4.2.5 of the format spec. + * + * + *

Java class for iconType complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="iconType">
+ *   <simpleContent>
+ *     <extension base="<http://www.w3.org/2001/XMLSchema>anyURI">
+ *       <attGroup ref="{http://www.w3.org/2005/Atom}commonAttributes"/>
+ *       <anyAttribute namespace='##other'/>
+ *     </extension>
+ *   </simpleContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "iconType", propOrder = { + "value" +}) +public class IconType { + + @XmlValue + @XmlSchemaType(name = "anyURI") + protected String value; + @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace") + @XmlSchemaType(name = "anyURI") + protected String base; + @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + @XmlSchemaType(name = "language") + protected String lang; + @XmlAnyAttribute + private Map otherAttributes = new HashMap(); + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getValue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setValue(String value) { + this.value = value; + } + + /** + * Gets the value of the base property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getBase() { + return base; + } + + /** + * Sets the value of the base property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setBase(String value) { + this.base = value; + } + + /** + * Gets the value of the lang property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getLang() { + return lang; + } + + /** + * Sets the value of the lang property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setLang(String value) { + this.lang = value; + } + + /** + * Gets a map that contains attributes that aren't bound to any typed property on this class. + * + *

+ * the map is keyed by the name of the attribute and + * the value is the string value of the attribute. + * + * the map returned by this method is live, and you can add new attribute + * by updating the map directly. Because of this design, there's no setter. + * + * + * @return + * always non-null + */ + public Map getOtherAttributes() { + return otherAttributes; + } + +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/IdType.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/IdType.java new file mode 100644 index 000000000000..a32ff13c3543 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/IdType.java @@ -0,0 +1,171 @@ +/** + * 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. + */ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2012.09.17 at 02:31:28 PM PDT +// + + +package com.microsoft.windowsazure.services.media.implementation.atom; + +import java.util.HashMap; +import java.util.Map; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAnyAttribute; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlValue; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import javax.xml.namespace.QName; + + +/** + * + * The Atom id construct is defined in section 4.2.6 of the format spec. + * + * + *

Java class for idType complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="idType">
+ *   <simpleContent>
+ *     <extension base="<http://www.w3.org/2001/XMLSchema>anyURI">
+ *       <attGroup ref="{http://www.w3.org/2005/Atom}commonAttributes"/>
+ *       <anyAttribute namespace='##other'/>
+ *     </extension>
+ *   </simpleContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "idType", propOrder = { + "value" +}) +public class IdType { + + @XmlValue + @XmlSchemaType(name = "anyURI") + protected String value; + @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace") + @XmlSchemaType(name = "anyURI") + protected String base; + @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + @XmlSchemaType(name = "language") + protected String lang; + @XmlAnyAttribute + private Map otherAttributes = new HashMap(); + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getValue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setValue(String value) { + this.value = value; + } + + /** + * Gets the value of the base property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getBase() { + return base; + } + + /** + * Sets the value of the base property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setBase(String value) { + this.base = value; + } + + /** + * Gets the value of the lang property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getLang() { + return lang; + } + + /** + * Sets the value of the lang property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setLang(String value) { + this.lang = value; + } + + /** + * Gets a map that contains attributes that aren't bound to any typed property on this class. + * + *

+ * the map is keyed by the name of the attribute and + * the value is the string value of the attribute. + * + * the map returned by this method is live, and you can add new attribute + * by updating the map directly. Because of this design, there's no setter. + * + * + * @return + * always non-null + */ + public Map getOtherAttributes() { + return otherAttributes; + } + +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/LinkType.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/LinkType.java new file mode 100644 index 000000000000..7352cb78504b --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/LinkType.java @@ -0,0 +1,339 @@ +/** + * 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. + */ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2012.09.17 at 02:31:28 PM PDT +// + + +package com.microsoft.windowsazure.services.media.implementation.atom; + +import java.math.BigInteger; +import java.util.HashMap; +import java.util.Map; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAnyAttribute; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlValue; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import javax.xml.namespace.QName; + + +/** + * + * The Atom link construct is defined in section 3.4 of the format spec. + * + * + *

Java class for linkType complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="linkType">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <attGroup ref="{http://www.w3.org/2005/Atom}commonAttributes"/>
+ *       <attribute name="href" use="required" type="{http://www.w3.org/2001/XMLSchema}anyURI" />
+ *       <attribute name="rel" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *       <attribute name="type" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *       <attribute name="hreflang" type="{http://www.w3.org/2001/XMLSchema}NMTOKEN" />
+ *       <attribute name="title" type="{http://www.w3.org/2001/XMLSchema}string" />
+ *       <attribute name="length" type="{http://www.w3.org/2001/XMLSchema}positiveInteger" />
+ *       <anyAttribute namespace='##other'/>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "linkType", propOrder = { + "content" +}) +public class LinkType { + + @XmlValue + protected String content; + @XmlAttribute(required = true) + @XmlSchemaType(name = "anyURI") + protected String href; + @XmlAttribute + protected String rel; + @XmlAttribute + protected String type; + @XmlAttribute + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + @XmlSchemaType(name = "NMTOKEN") + protected String hreflang; + @XmlAttribute + protected String title; + @XmlAttribute + @XmlSchemaType(name = "positiveInteger") + protected BigInteger length; + @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace") + @XmlSchemaType(name = "anyURI") + protected String base; + @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + @XmlSchemaType(name = "language") + protected String lang; + @XmlAnyAttribute + private Map otherAttributes = new HashMap(); + + /** + * + * The Atom link construct is defined in section 3.4 of the format spec. + * + * + * @return + * possible object is + * {@link String } + * + */ + public String getContent() { + return content; + } + + /** + * Sets the value of the content property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setContent(String value) { + this.content = value; + } + + /** + * Gets the value of the href property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getHref() { + return href; + } + + /** + * Sets the value of the href property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setHref(String value) { + this.href = value; + } + + /** + * Gets the value of the rel property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRel() { + return rel; + } + + /** + * Sets the value of the rel property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRel(String value) { + this.rel = value; + } + + /** + * Gets the value of the type property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getType() { + return type; + } + + /** + * Sets the value of the type property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setType(String value) { + this.type = value; + } + + /** + * Gets the value of the hreflang property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getHreflang() { + return hreflang; + } + + /** + * Sets the value of the hreflang property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setHreflang(String value) { + this.hreflang = value; + } + + /** + * Gets the value of the title property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTitle() { + return title; + } + + /** + * Sets the value of the title property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTitle(String value) { + this.title = value; + } + + /** + * Gets the value of the length property. + * + * @return + * possible object is + * {@link BigInteger } + * + */ + public BigInteger getLength() { + return length; + } + + /** + * Sets the value of the length property. + * + * @param value + * allowed object is + * {@link BigInteger } + * + */ + public void setLength(BigInteger value) { + this.length = value; + } + + /** + * Gets the value of the base property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getBase() { + return base; + } + + /** + * Sets the value of the base property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setBase(String value) { + this.base = value; + } + + /** + * Gets the value of the lang property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getLang() { + return lang; + } + + /** + * Sets the value of the lang property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setLang(String value) { + this.lang = value; + } + + /** + * Gets a map that contains attributes that aren't bound to any typed property on this class. + * + *

+ * the map is keyed by the name of the attribute and + * the value is the string value of the attribute. + * + * the map returned by this method is live, and you can add new attribute + * by updating the map directly. Because of this design, there's no setter. + * + * + * @return + * always non-null + */ + public Map getOtherAttributes() { + return otherAttributes; + } + +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/LogoType.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/LogoType.java new file mode 100644 index 000000000000..8cdff364873f --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/LogoType.java @@ -0,0 +1,171 @@ +/** + * 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. + */ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2012.09.17 at 02:31:28 PM PDT +// + + +package com.microsoft.windowsazure.services.media.implementation.atom; + +import java.util.HashMap; +import java.util.Map; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAnyAttribute; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlValue; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import javax.xml.namespace.QName; + + +/** + * + * The Atom logo construct is defined in section 4.2.8 of the format spec. + * + * + *

Java class for logoType complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="logoType">
+ *   <simpleContent>
+ *     <extension base="<http://www.w3.org/2001/XMLSchema>anyURI">
+ *       <attGroup ref="{http://www.w3.org/2005/Atom}commonAttributes"/>
+ *       <anyAttribute namespace='##other'/>
+ *     </extension>
+ *   </simpleContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "logoType", propOrder = { + "value" +}) +public class LogoType { + + @XmlValue + @XmlSchemaType(name = "anyURI") + protected String value; + @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace") + @XmlSchemaType(name = "anyURI") + protected String base; + @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + @XmlSchemaType(name = "language") + protected String lang; + @XmlAnyAttribute + private Map otherAttributes = new HashMap(); + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getValue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setValue(String value) { + this.value = value; + } + + /** + * Gets the value of the base property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getBase() { + return base; + } + + /** + * Sets the value of the base property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setBase(String value) { + this.base = value; + } + + /** + * Gets the value of the lang property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getLang() { + return lang; + } + + /** + * Sets the value of the lang property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setLang(String value) { + this.lang = value; + } + + /** + * Gets a map that contains attributes that aren't bound to any typed property on this class. + * + *

+ * the map is keyed by the name of the attribute and + * the value is the string value of the attribute. + * + * the map returned by this method is live, and you can add new attribute + * by updating the map directly. Because of this design, there's no setter. + * + * + * @return + * always non-null + */ + public Map getOtherAttributes() { + return otherAttributes; + } + +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/ObjectFactory.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/ObjectFactory.java new file mode 100644 index 000000000000..f0e1eb44f3ed --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/ObjectFactory.java @@ -0,0 +1,571 @@ +/** + * 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. + */ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2012.09.17 at 02:31:28 PM PDT +// + + +package com.microsoft.windowsazure.services.media.implementation.atom; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.bind.annotation.adapters.NormalizedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import javax.xml.namespace.QName; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the com.microsoft.windowsazure.services.media.implementation.atom package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _Entry_QNAME = new QName("http://www.w3.org/2005/Atom", "entry"); + private final static QName _Feed_QNAME = new QName("http://www.w3.org/2005/Atom", "feed"); + private final static QName _PersonTypeName_QNAME = new QName("http://www.w3.org/2005/Atom", "name"); + private final static QName _PersonTypeEmail_QNAME = new QName("http://www.w3.org/2005/Atom", "email"); + private final static QName _PersonTypeUri_QNAME = new QName("http://www.w3.org/2005/Atom", "uri"); + private final static QName _EntryTypeTitle_QNAME = new QName("http://www.w3.org/2005/Atom", "title"); + private final static QName _EntryTypeCategory_QNAME = new QName("http://www.w3.org/2005/Atom", "category"); + private final static QName _EntryTypeAuthor_QNAME = new QName("http://www.w3.org/2005/Atom", "author"); + private final static QName _EntryTypeSummary_QNAME = new QName("http://www.w3.org/2005/Atom", "summary"); + private final static QName _EntryTypeId_QNAME = new QName("http://www.w3.org/2005/Atom", "id"); + private final static QName _EntryTypeContent_QNAME = new QName("http://www.w3.org/2005/Atom", "content"); + private final static QName _EntryTypeLink_QNAME = new QName("http://www.w3.org/2005/Atom", "link"); + private final static QName _EntryTypeContributor_QNAME = new QName("http://www.w3.org/2005/Atom", "contributor"); + private final static QName _EntryTypeUpdated_QNAME = new QName("http://www.w3.org/2005/Atom", "updated"); + private final static QName _EntryTypeSource_QNAME = new QName("http://www.w3.org/2005/Atom", "source"); + private final static QName _EntryTypeRights_QNAME = new QName("http://www.w3.org/2005/Atom", "rights"); + private final static QName _EntryTypePublished_QNAME = new QName("http://www.w3.org/2005/Atom", "published"); + private final static QName _FeedTypeGenerator_QNAME = new QName("http://www.w3.org/2005/Atom", "generator"); + private final static QName _FeedTypeSubtitle_QNAME = new QName("http://www.w3.org/2005/Atom", "subtitle"); + private final static QName _FeedTypeLogo_QNAME = new QName("http://www.w3.org/2005/Atom", "logo"); + private final static QName _FeedTypeIcon_QNAME = new QName("http://www.w3.org/2005/Atom", "icon"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.microsoft.windowsazure.services.media.implementation.atom + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link PersonType } + * + */ + public PersonType createPersonType() { + return new PersonType(); + } + + /** + * Create an instance of {@link EntryType } + * + */ + public EntryType createEntryType() { + return new EntryType(); + } + + /** + * Create an instance of {@link IconType } + * + */ + public IconType createIconType() { + return new IconType(); + } + + /** + * Create an instance of {@link UriType } + * + */ + public UriType createUriType() { + return new UriType(); + } + + /** + * Create an instance of {@link TextType } + * + */ + public TextType createTextType() { + return new TextType(); + } + + /** + * Create an instance of {@link FeedType } + * + */ + public FeedType createFeedType() { + return new FeedType(); + } + + /** + * Create an instance of {@link DateTimeType } + * + */ + public DateTimeType createDateTimeType() { + return new DateTimeType(); + } + + /** + * Create an instance of {@link IdType } + * + */ + public IdType createIdType() { + return new IdType(); + } + + /** + * Create an instance of {@link SourceType } + * + */ + public SourceType createSourceType() { + return new SourceType(); + } + + /** + * Create an instance of {@link LinkType } + * + */ + public LinkType createLinkType() { + return new LinkType(); + } + + /** + * Create an instance of {@link LogoType } + * + */ + public LogoType createLogoType() { + return new LogoType(); + } + + /** + * Create an instance of {@link GeneratorType } + * + */ + public GeneratorType createGeneratorType() { + return new GeneratorType(); + } + + /** + * Create an instance of {@link ContentType } + * + */ + public ContentType createContentType() { + return new ContentType(); + } + + /** + * Create an instance of {@link CategoryType } + * + */ + public CategoryType createCategoryType() { + return new CategoryType(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link EntryType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.w3.org/2005/Atom", name = "entry") + public JAXBElement createEntry(EntryType value) { + return new JAXBElement(_Entry_QNAME, EntryType.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link FeedType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.w3.org/2005/Atom", name = "feed") + public JAXBElement createFeed(FeedType value) { + return new JAXBElement(_Feed_QNAME, FeedType.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.w3.org/2005/Atom", name = "name", scope = PersonType.class) + public JAXBElement createPersonTypeName(String value) { + return new JAXBElement(_PersonTypeName_QNAME, String.class, PersonType.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.w3.org/2005/Atom", name = "email", scope = PersonType.class) + @XmlJavaTypeAdapter(NormalizedStringAdapter.class) + public JAXBElement createPersonTypeEmail(String value) { + return new JAXBElement(_PersonTypeEmail_QNAME, String.class, PersonType.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link UriType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.w3.org/2005/Atom", name = "uri", scope = PersonType.class) + public JAXBElement createPersonTypeUri(UriType value) { + return new JAXBElement(_PersonTypeUri_QNAME, UriType.class, PersonType.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link TextType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.w3.org/2005/Atom", name = "title", scope = EntryType.class) + public JAXBElement createEntryTypeTitle(TextType value) { + return new JAXBElement(_EntryTypeTitle_QNAME, TextType.class, EntryType.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link CategoryType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.w3.org/2005/Atom", name = "category", scope = EntryType.class) + public JAXBElement createEntryTypeCategory(CategoryType value) { + return new JAXBElement(_EntryTypeCategory_QNAME, CategoryType.class, EntryType.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link PersonType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.w3.org/2005/Atom", name = "author", scope = EntryType.class) + public JAXBElement createEntryTypeAuthor(PersonType value) { + return new JAXBElement(_EntryTypeAuthor_QNAME, PersonType.class, EntryType.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link TextType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.w3.org/2005/Atom", name = "summary", scope = EntryType.class) + public JAXBElement createEntryTypeSummary(TextType value) { + return new JAXBElement(_EntryTypeSummary_QNAME, TextType.class, EntryType.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link IdType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.w3.org/2005/Atom", name = "id", scope = EntryType.class) + public JAXBElement createEntryTypeId(IdType value) { + return new JAXBElement(_EntryTypeId_QNAME, IdType.class, EntryType.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link ContentType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.w3.org/2005/Atom", name = "content", scope = EntryType.class) + public JAXBElement createEntryTypeContent(ContentType value) { + return new JAXBElement(_EntryTypeContent_QNAME, ContentType.class, EntryType.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link LinkType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.w3.org/2005/Atom", name = "link", scope = EntryType.class) + public JAXBElement createEntryTypeLink(LinkType value) { + return new JAXBElement(_EntryTypeLink_QNAME, LinkType.class, EntryType.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link PersonType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.w3.org/2005/Atom", name = "contributor", scope = EntryType.class) + public JAXBElement createEntryTypeContributor(PersonType value) { + return new JAXBElement(_EntryTypeContributor_QNAME, PersonType.class, EntryType.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link DateTimeType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.w3.org/2005/Atom", name = "updated", scope = EntryType.class) + public JAXBElement createEntryTypeUpdated(DateTimeType value) { + return new JAXBElement(_EntryTypeUpdated_QNAME, DateTimeType.class, EntryType.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link TextType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.w3.org/2005/Atom", name = "source", scope = EntryType.class) + public JAXBElement createEntryTypeSource(TextType value) { + return new JAXBElement(_EntryTypeSource_QNAME, TextType.class, EntryType.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link TextType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.w3.org/2005/Atom", name = "rights", scope = EntryType.class) + public JAXBElement createEntryTypeRights(TextType value) { + return new JAXBElement(_EntryTypeRights_QNAME, TextType.class, EntryType.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link DateTimeType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.w3.org/2005/Atom", name = "published", scope = EntryType.class) + public JAXBElement createEntryTypePublished(DateTimeType value) { + return new JAXBElement(_EntryTypePublished_QNAME, DateTimeType.class, EntryType.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link CategoryType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.w3.org/2005/Atom", name = "category", scope = FeedType.class) + public JAXBElement createFeedTypeCategory(CategoryType value) { + return new JAXBElement(_EntryTypeCategory_QNAME, CategoryType.class, FeedType.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link TextType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.w3.org/2005/Atom", name = "title", scope = FeedType.class) + public JAXBElement createFeedTypeTitle(TextType value) { + return new JAXBElement(_EntryTypeTitle_QNAME, TextType.class, FeedType.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link PersonType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.w3.org/2005/Atom", name = "author", scope = FeedType.class) + public JAXBElement createFeedTypeAuthor(PersonType value) { + return new JAXBElement(_EntryTypeAuthor_QNAME, PersonType.class, FeedType.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link IdType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.w3.org/2005/Atom", name = "id", scope = FeedType.class) + public JAXBElement createFeedTypeId(IdType value) { + return new JAXBElement(_EntryTypeId_QNAME, IdType.class, FeedType.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link EntryType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.w3.org/2005/Atom", name = "entry", scope = FeedType.class) + public JAXBElement createFeedTypeEntry(EntryType value) { + return new JAXBElement(_Entry_QNAME, EntryType.class, FeedType.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link PersonType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.w3.org/2005/Atom", name = "contributor", scope = FeedType.class) + public JAXBElement createFeedTypeContributor(PersonType value) { + return new JAXBElement(_EntryTypeContributor_QNAME, PersonType.class, FeedType.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link DateTimeType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.w3.org/2005/Atom", name = "updated", scope = FeedType.class) + public JAXBElement createFeedTypeUpdated(DateTimeType value) { + return new JAXBElement(_EntryTypeUpdated_QNAME, DateTimeType.class, FeedType.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link GeneratorType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.w3.org/2005/Atom", name = "generator", scope = FeedType.class) + public JAXBElement createFeedTypeGenerator(GeneratorType value) { + return new JAXBElement(_FeedTypeGenerator_QNAME, GeneratorType.class, FeedType.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link TextType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.w3.org/2005/Atom", name = "subtitle", scope = FeedType.class) + public JAXBElement createFeedTypeSubtitle(TextType value) { + return new JAXBElement(_FeedTypeSubtitle_QNAME, TextType.class, FeedType.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link LogoType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.w3.org/2005/Atom", name = "logo", scope = FeedType.class) + public JAXBElement createFeedTypeLogo(LogoType value) { + return new JAXBElement(_FeedTypeLogo_QNAME, LogoType.class, FeedType.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link IconType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.w3.org/2005/Atom", name = "icon", scope = FeedType.class) + public JAXBElement createFeedTypeIcon(IconType value) { + return new JAXBElement(_FeedTypeIcon_QNAME, IconType.class, FeedType.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link LinkType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.w3.org/2005/Atom", name = "link", scope = FeedType.class) + public JAXBElement createFeedTypeLink(LinkType value) { + return new JAXBElement(_EntryTypeLink_QNAME, LinkType.class, FeedType.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link TextType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.w3.org/2005/Atom", name = "rights", scope = FeedType.class) + public JAXBElement createFeedTypeRights(TextType value) { + return new JAXBElement(_EntryTypeRights_QNAME, TextType.class, FeedType.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link TextType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.w3.org/2005/Atom", name = "title", scope = SourceType.class) + public JAXBElement createSourceTypeTitle(TextType value) { + return new JAXBElement(_EntryTypeTitle_QNAME, TextType.class, SourceType.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link CategoryType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.w3.org/2005/Atom", name = "category", scope = SourceType.class) + public JAXBElement createSourceTypeCategory(CategoryType value) { + return new JAXBElement(_EntryTypeCategory_QNAME, CategoryType.class, SourceType.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link IconType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.w3.org/2005/Atom", name = "icon", scope = SourceType.class) + public JAXBElement createSourceTypeIcon(IconType value) { + return new JAXBElement(_FeedTypeIcon_QNAME, IconType.class, SourceType.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link PersonType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.w3.org/2005/Atom", name = "author", scope = SourceType.class) + public JAXBElement createSourceTypeAuthor(PersonType value) { + return new JAXBElement(_EntryTypeAuthor_QNAME, PersonType.class, SourceType.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link LogoType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.w3.org/2005/Atom", name = "logo", scope = SourceType.class) + public JAXBElement createSourceTypeLogo(LogoType value) { + return new JAXBElement(_FeedTypeLogo_QNAME, LogoType.class, SourceType.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link IdType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.w3.org/2005/Atom", name = "id", scope = SourceType.class) + public JAXBElement createSourceTypeId(IdType value) { + return new JAXBElement(_EntryTypeId_QNAME, IdType.class, SourceType.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link LinkType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.w3.org/2005/Atom", name = "link", scope = SourceType.class) + public JAXBElement createSourceTypeLink(LinkType value) { + return new JAXBElement(_EntryTypeLink_QNAME, LinkType.class, SourceType.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link PersonType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.w3.org/2005/Atom", name = "contributor", scope = SourceType.class) + public JAXBElement createSourceTypeContributor(PersonType value) { + return new JAXBElement(_EntryTypeContributor_QNAME, PersonType.class, SourceType.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link DateTimeType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.w3.org/2005/Atom", name = "updated", scope = SourceType.class) + public JAXBElement createSourceTypeUpdated(DateTimeType value) { + return new JAXBElement(_EntryTypeUpdated_QNAME, DateTimeType.class, SourceType.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link GeneratorType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.w3.org/2005/Atom", name = "generator", scope = SourceType.class) + public JAXBElement createSourceTypeGenerator(GeneratorType value) { + return new JAXBElement(_FeedTypeGenerator_QNAME, GeneratorType.class, SourceType.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link TextType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.w3.org/2005/Atom", name = "rights", scope = SourceType.class) + public JAXBElement createSourceTypeRights(TextType value) { + return new JAXBElement(_EntryTypeRights_QNAME, TextType.class, SourceType.class, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link TextType }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.w3.org/2005/Atom", name = "subtitle", scope = SourceType.class) + public JAXBElement createSourceTypeSubtitle(TextType value) { + return new JAXBElement(_FeedTypeSubtitle_QNAME, TextType.class, SourceType.class, value); + } + +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/PersonType.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/PersonType.java new file mode 100644 index 000000000000..b2899d730913 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/PersonType.java @@ -0,0 +1,194 @@ +/** + * 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. + */ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2012.09.17 at 02:31:28 PM PDT +// + + +package com.microsoft.windowsazure.services.media.implementation.atom; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAnyAttribute; +import javax.xml.bind.annotation.XmlAnyElement; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlElementRefs; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import javax.xml.namespace.QName; + + +/** + * + * The Atom person construct is defined in section 3.2 of the format spec. + * + * + *

Java class for personType complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="personType">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <choice maxOccurs="unbounded">
+ *         <element name="name" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         <element name="uri" type="{http://www.w3.org/2005/Atom}uriType" minOccurs="0"/>
+ *         <element name="email" type="{http://www.w3.org/2005/Atom}emailType" minOccurs="0"/>
+ *         <any namespace='##other'/>
+ *       </choice>
+ *       <attGroup ref="{http://www.w3.org/2005/Atom}commonAttributes"/>
+ *       <anyAttribute namespace='##other'/>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "personType", propOrder = { + "nameOrUriOrEmail" +}) +public class PersonType { + + @XmlElementRefs({ + @XmlElementRef(name = "email", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class), + @XmlElementRef(name = "uri", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class), + @XmlElementRef(name = "name", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class) + }) + @XmlAnyElement(lax = true) + protected List nameOrUriOrEmail; + @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace") + @XmlSchemaType(name = "anyURI") + protected String base; + @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + @XmlSchemaType(name = "language") + protected String lang; + @XmlAnyAttribute + private Map otherAttributes = new HashMap(); + + /** + * Gets the value of the nameOrUriOrEmail property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the nameOrUriOrEmail property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getNameOrUriOrEmail().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link JAXBElement }{@code <}{@link String }{@code >} + * {@link Object } + * {@link JAXBElement }{@code <}{@link String }{@code >} + * {@link JAXBElement }{@code <}{@link UriType }{@code >} + * + * + */ + public List getNameOrUriOrEmail() { + if (nameOrUriOrEmail == null) { + nameOrUriOrEmail = new ArrayList(); + } + return this.nameOrUriOrEmail; + } + + /** + * Gets the value of the base property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getBase() { + return base; + } + + /** + * Sets the value of the base property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setBase(String value) { + this.base = value; + } + + /** + * Gets the value of the lang property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getLang() { + return lang; + } + + /** + * Sets the value of the lang property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setLang(String value) { + this.lang = value; + } + + /** + * Gets a map that contains attributes that aren't bound to any typed property on this class. + * + *

+ * the map is keyed by the name of the attribute and + * the value is the string value of the attribute. + * + * the map returned by this method is live, and you can add new attribute + * by updating the map directly. Because of this design, there's no setter. + * + * + * @return + * always non-null + */ + public Map getOtherAttributes() { + return otherAttributes; + } + +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/SourceType.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/SourceType.java new file mode 100644 index 000000000000..db8dcc0b393f --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/SourceType.java @@ -0,0 +1,221 @@ +/** + * 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. + */ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2012.09.17 at 02:31:28 PM PDT +// + + +package com.microsoft.windowsazure.services.media.implementation.atom; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAnyAttribute; +import javax.xml.bind.annotation.XmlAnyElement; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElementRef; +import javax.xml.bind.annotation.XmlElementRefs; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import javax.xml.namespace.QName; + + +/** + * + * The Atom source construct is defined in section 4.2.11 of the format spec. + * + * + *

Java class for sourceType complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="sourceType">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <choice maxOccurs="unbounded">
+ *         <element name="author" type="{http://www.w3.org/2005/Atom}personType" maxOccurs="unbounded" minOccurs="0"/>
+ *         <element name="category" type="{http://www.w3.org/2005/Atom}categoryType" maxOccurs="unbounded" minOccurs="0"/>
+ *         <element name="contributor" type="{http://www.w3.org/2005/Atom}personType" maxOccurs="unbounded" minOccurs="0"/>
+ *         <element name="generator" type="{http://www.w3.org/2005/Atom}generatorType" minOccurs="0"/>
+ *         <element name="icon" type="{http://www.w3.org/2005/Atom}iconType" minOccurs="0"/>
+ *         <element name="id" type="{http://www.w3.org/2005/Atom}idType" minOccurs="0"/>
+ *         <element name="link" type="{http://www.w3.org/2005/Atom}linkType" maxOccurs="unbounded" minOccurs="0"/>
+ *         <element name="logo" type="{http://www.w3.org/2005/Atom}logoType" minOccurs="0"/>
+ *         <element name="rights" type="{http://www.w3.org/2005/Atom}textType" minOccurs="0"/>
+ *         <element name="subtitle" type="{http://www.w3.org/2005/Atom}textType" minOccurs="0"/>
+ *         <element name="title" type="{http://www.w3.org/2005/Atom}textType" minOccurs="0"/>
+ *         <element name="updated" type="{http://www.w3.org/2005/Atom}dateTimeType" minOccurs="0"/>
+ *         <any namespace='##other' maxOccurs="unbounded" minOccurs="0"/>
+ *       </choice>
+ *       <attGroup ref="{http://www.w3.org/2005/Atom}commonAttributes"/>
+ *       <anyAttribute namespace='##other'/>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "sourceType", propOrder = { + "authorOrCategoryOrContributor" +}) +public class SourceType { + + @XmlElementRefs({ + @XmlElementRef(name = "contributor", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class), + @XmlElementRef(name = "title", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class), + @XmlElementRef(name = "author", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class), + @XmlElementRef(name = "category", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class), + @XmlElementRef(name = "generator", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class), + @XmlElementRef(name = "logo", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class), + @XmlElementRef(name = "id", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class), + @XmlElementRef(name = "icon", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class), + @XmlElementRef(name = "link", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class), + @XmlElementRef(name = "rights", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class), + @XmlElementRef(name = "subtitle", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class), + @XmlElementRef(name = "updated", namespace = "http://www.w3.org/2005/Atom", type = JAXBElement.class) + }) + @XmlAnyElement(lax = true) + protected List authorOrCategoryOrContributor; + @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace") + @XmlSchemaType(name = "anyURI") + protected String base; + @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + @XmlSchemaType(name = "language") + protected String lang; + @XmlAnyAttribute + private Map otherAttributes = new HashMap(); + + /** + * Gets the value of the authorOrCategoryOrContributor property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the authorOrCategoryOrContributor property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getAuthorOrCategoryOrContributor().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link JAXBElement }{@code <}{@link PersonType }{@code >} + * {@link JAXBElement }{@code <}{@link TextType }{@code >} + * {@link JAXBElement }{@code <}{@link PersonType }{@code >} + * {@link JAXBElement }{@code <}{@link GeneratorType }{@code >} + * {@link JAXBElement }{@code <}{@link LogoType }{@code >} + * {@link JAXBElement }{@code <}{@link IdType }{@code >} + * {@link JAXBElement }{@code <}{@link TextType }{@code >} + * {@link JAXBElement }{@code <}{@link DateTimeType }{@code >} + * {@link JAXBElement }{@code <}{@link CategoryType }{@code >} + * {@link Object } + * {@link JAXBElement }{@code <}{@link IconType }{@code >} + * {@link JAXBElement }{@code <}{@link LinkType }{@code >} + * {@link JAXBElement }{@code <}{@link TextType }{@code >} + * + * + */ + public List getAuthorOrCategoryOrContributor() { + if (authorOrCategoryOrContributor == null) { + authorOrCategoryOrContributor = new ArrayList(); + } + return this.authorOrCategoryOrContributor; + } + + /** + * Gets the value of the base property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getBase() { + return base; + } + + /** + * Sets the value of the base property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setBase(String value) { + this.base = value; + } + + /** + * Gets the value of the lang property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getLang() { + return lang; + } + + /** + * Sets the value of the lang property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setLang(String value) { + this.lang = value; + } + + /** + * Gets a map that contains attributes that aren't bound to any typed property on this class. + * + *

+ * the map is keyed by the name of the attribute and + * the value is the string value of the attribute. + * + * the map returned by this method is live, and you can add new attribute + * by updating the map directly. Because of this design, there's no setter. + * + * + * @return + * always non-null + */ + public Map getOtherAttributes() { + return otherAttributes; + } + +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/TextType.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/TextType.java new file mode 100644 index 000000000000..e9804d1ae3cd --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/TextType.java @@ -0,0 +1,221 @@ +/** + * 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. + */ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2012.09.17 at 02:31:28 PM PDT +// + + +package com.microsoft.windowsazure.services.media.implementation.atom; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAnyAttribute; +import javax.xml.bind.annotation.XmlAnyElement; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlMixed; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import javax.xml.namespace.QName; + + +/** + * + * The Atom text construct is defined in section 3.1 of the format spec. + * + * + *

Java class for textType complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="textType">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <any namespace='http://www.w3.org/1999/xhtml' minOccurs="0"/>
+ *       </sequence>
+ *       <attGroup ref="{http://www.w3.org/2005/Atom}commonAttributes"/>
+ *       <attribute name="type">
+ *         <simpleType>
+ *           <restriction base="{http://www.w3.org/2001/XMLSchema}token">
+ *             <enumeration value="text"/>
+ *             <enumeration value="html"/>
+ *             <enumeration value="xhtml"/>
+ *           </restriction>
+ *         </simpleType>
+ *       </attribute>
+ *       <anyAttribute namespace='##other'/>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "textType", propOrder = { + "content" +}) +public class TextType { + + @XmlMixed + @XmlAnyElement(lax = true) + protected List content; + @XmlAttribute + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + protected String type; + @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace") + @XmlSchemaType(name = "anyURI") + protected String base; + @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + @XmlSchemaType(name = "language") + protected String lang; + @XmlAnyAttribute + private Map otherAttributes = new HashMap(); + + /** + * + * The Atom text construct is defined in section 3.1 of the format spec. + * Gets the value of the content property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the content property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getContent().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link Object } + * {@link String } + * + * + */ + public List getContent() { + if (content == null) { + content = new ArrayList(); + } + return this.content; + } + + /** + * Gets the value of the type property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getType() { + return type; + } + + /** + * Sets the value of the type property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setType(String value) { + this.type = value; + } + + /** + * Gets the value of the base property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getBase() { + return base; + } + + /** + * Sets the value of the base property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setBase(String value) { + this.base = value; + } + + /** + * Gets the value of the lang property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getLang() { + return lang; + } + + /** + * Sets the value of the lang property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setLang(String value) { + this.lang = value; + } + + /** + * Gets a map that contains attributes that aren't bound to any typed property on this class. + * + *

+ * the map is keyed by the name of the attribute and + * the value is the string value of the attribute. + * + * the map returned by this method is live, and you can add new attribute + * by updating the map directly. Because of this design, there's no setter. + * + * + * @return + * always non-null + */ + public Map getOtherAttributes() { + return otherAttributes; + } + +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/UriType.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/UriType.java new file mode 100644 index 000000000000..a6a804112989 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/UriType.java @@ -0,0 +1,167 @@ +/** + * 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. + */ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2012.09.17 at 02:31:28 PM PDT +// + + +package com.microsoft.windowsazure.services.media.implementation.atom; + +import java.util.HashMap; +import java.util.Map; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAnyAttribute; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlValue; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import javax.xml.namespace.QName; + + +/** + *

Java class for uriType complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="uriType">
+ *   <simpleContent>
+ *     <extension base="<http://www.w3.org/2001/XMLSchema>anyURI">
+ *       <attGroup ref="{http://www.w3.org/2005/Atom}commonAttributes"/>
+ *       <anyAttribute namespace='##other'/>
+ *     </extension>
+ *   </simpleContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "uriType", propOrder = { + "value" +}) +public class UriType { + + @XmlValue + @XmlSchemaType(name = "anyURI") + protected String value; + @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace") + @XmlSchemaType(name = "anyURI") + protected String base; + @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + @XmlSchemaType(name = "language") + protected String lang; + @XmlAnyAttribute + private Map otherAttributes = new HashMap(); + + /** + * Gets the value of the value property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getValue() { + return value; + } + + /** + * Sets the value of the value property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setValue(String value) { + this.value = value; + } + + /** + * Gets the value of the base property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getBase() { + return base; + } + + /** + * Sets the value of the base property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setBase(String value) { + this.base = value; + } + + /** + * Gets the value of the lang property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getLang() { + return lang; + } + + /** + * Sets the value of the lang property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setLang(String value) { + this.lang = value; + } + + /** + * Gets a map that contains attributes that aren't bound to any typed property on this class. + * + *

+ * the map is keyed by the name of the attribute and + * the value is the string value of the attribute. + * + * the map returned by this method is live, and you can add new attribute + * by updating the map directly. Because of this design, there's no setter. + * + * + * @return + * always non-null + */ + public Map getOtherAttributes() { + return otherAttributes; + } + +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/package-info.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/package-info.java new file mode 100644 index 000000000000..735e1ae1d624 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/atom/package-info.java @@ -0,0 +1,24 @@ +/** + * 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. + */ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2012.09.17 at 02:31:28 PM PDT +// + +@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.w3.org/2005/Atom", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +package com.microsoft.windowsazure.services.media.implementation.atom; diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/AccessPolicyType.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/AccessPolicyType.java new file mode 100644 index 000000000000..b362d1769694 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/AccessPolicyType.java @@ -0,0 +1,145 @@ +/** + * 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.content; + +import java.util.Date; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; + +/** + * Wrapper DTO for Media Services access policies. + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +public class AccessPolicyType implements MediaServiceDTO { + + @XmlElement(name = "Id", namespace = Constants.ODATA_DATA_NS) + protected String id; + + @XmlElement(name = "Created", namespace = Constants.ODATA_DATA_NS) + protected Date created; + + @XmlElement(name = "LastModified", namespace = Constants.ODATA_DATA_NS) + protected Date lastModified; + + @XmlElement(name = "Name", namespace = Constants.ODATA_DATA_NS) + protected String name; + + @XmlElement(name = "DurationInMinutes", namespace = Constants.ODATA_DATA_NS) + protected Double durationInMinutes; + + @XmlElement(name = "Permissions", namespace = Constants.ODATA_DATA_NS) + protected Integer permissions; + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @param id + * the id to set + */ + public AccessPolicyType setId(String id) { + this.id = id; + return this; + } + + /** + * @return the created + */ + public Date getCreated() { + return created; + } + + /** + * @param created + * the created to set + */ + public AccessPolicyType setCreated(Date created) { + this.created = created; + return this; + } + + /** + * @return the lastModified + */ + public Date getLastModified() { + return lastModified; + } + + /** + * @param lastModified + * the lastModified to set + */ + public AccessPolicyType setLastModified(Date lastModified) { + this.lastModified = lastModified; + return this; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name + * the name to set + */ + public AccessPolicyType setName(String name) { + this.name = name; + return this; + } + + /** + * @return the durationInMinutes + */ + public Double getDurationInMinutes() { + return durationInMinutes; + } + + /** + * @param durationInMinutes + * the durationInMinutes to set + */ + public AccessPolicyType setDurationInMinutes(double durationInMinutes) { + this.durationInMinutes = durationInMinutes; + return this; + } + + /** + * @return the permissions + */ + public Integer getPermissions() { + return permissions; + } + + /** + * @param permissions + * the permissions to set + */ + public AccessPolicyType setPermissions(Integer permissions) { + this.permissions = permissions; + return this; + } + +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/AssetFileType.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/AssetFileType.java new file mode 100644 index 000000000000..fcf17089d298 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/AssetFileType.java @@ -0,0 +1,297 @@ +/** + * 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.content; + +import java.util.Date; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; + +/** + * Serialization for the AssetFile entity + * + */ + +@XmlAccessorType(XmlAccessType.FIELD) +public class AssetFileType implements MediaServiceDTO { + + @XmlElement(name = "Id", namespace = Constants.ODATA_DATA_NS) + protected String id; + + @XmlElement(name = "Name", namespace = Constants.ODATA_DATA_NS) + protected String name; + + @XmlElement(name = "ContentFileSize", namespace = Constants.ODATA_DATA_NS) + protected Long contentFileSize; + + @XmlElement(name = "ParentAssetId", namespace = Constants.ODATA_DATA_NS) + protected String parentAssetId; + + @XmlElement(name = "EncryptionVersion", namespace = Constants.ODATA_DATA_NS) + protected String encryptionVersion; + + @XmlElement(name = "EncryptionScheme", namespace = Constants.ODATA_DATA_NS) + protected String encryptionScheme; + + @XmlElement(name = "IsEncrypted", namespace = Constants.ODATA_DATA_NS) + protected Boolean isEncrypted; + + @XmlElement(name = "EncryptionKeyId", namespace = Constants.ODATA_DATA_NS) + protected String encryptionKeyId; + + @XmlElement(name = "InitializationVector", namespace = Constants.ODATA_DATA_NS) + protected String initializationVector; + + @XmlElement(name = "IsPrimary", namespace = Constants.ODATA_DATA_NS) + protected Boolean isPrimary; + + @XmlElement(name = "LastModified", namespace = Constants.ODATA_DATA_NS) + protected Date lastModified; + + @XmlElement(name = "Created", namespace = Constants.ODATA_DATA_NS) + protected Date created; + + @XmlElement(name = "MimeType", namespace = Constants.ODATA_DATA_NS) + protected String mimeType; + + @XmlElement(name = "ContentChecksum", namespace = Constants.ODATA_DATA_NS) + protected String contentChecksum; + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @param id + * the id to set + */ + public AssetFileType setId(String id) { + this.id = id; + return this; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name + * the name to set + */ + public AssetFileType setName(String name) { + this.name = name; + return this; + } + + /** + * @return the contentFileSize + */ + public Long getContentFileSize() { + return contentFileSize; + } + + /** + * @param contentFileSize + * the contentFileSize to set + */ + public AssetFileType setContentFileSize(Long contentFileSize) { + this.contentFileSize = contentFileSize; + return this; + } + + /** + * @return the parentAssetId + */ + public String getParentAssetId() { + return parentAssetId; + } + + /** + * @param parentAssetId + * the parentAssetId to set + */ + public AssetFileType setParentAssetId(String parentAssetId) { + this.parentAssetId = parentAssetId; + return this; + } + + /** + * @return the encryptionVersion + */ + public String getEncryptionVersion() { + return encryptionVersion; + } + + /** + * @param encryptionVersion + * the encryptionVersion to set + */ + public AssetFileType setEncryptionVersion(String encryptionVersion) { + this.encryptionVersion = encryptionVersion; + return this; + } + + /** + * @return the encryptionScheme + */ + public String getEncryptionScheme() { + return encryptionScheme; + } + + /** + * @param encryptionScheme + * the encryptionScheme to set + */ + public AssetFileType setEncryptionScheme(String encryptionScheme) { + this.encryptionScheme = encryptionScheme; + return this; + } + + /** + * @return the isEncrypted + */ + public Boolean getIsEncrypted() { + return isEncrypted; + } + + /** + * @param isEncrypted + * the isEncrypted to set + */ + public AssetFileType setIsEncrypted(Boolean isEncrypted) { + this.isEncrypted = isEncrypted; + return this; + } + + /** + * @return the encryptionKeyId + */ + public String getEncryptionKeyId() { + return encryptionKeyId; + } + + /** + * @param encryptionKeyId + * the encryptionKeyId to set + */ + public AssetFileType setEncryptionKeyId(String encryptionKeyId) { + this.encryptionKeyId = encryptionKeyId; + return this; + } + + /** + * @return the initializationVector + */ + public String getInitializationVector() { + return initializationVector; + } + + /** + * @param initializationVector + * the initializationVector to set + */ + public AssetFileType setInitializationVector(String initializationVector) { + this.initializationVector = initializationVector; + return this; + } + + /** + * @return the isPrimary + */ + public Boolean getIsPrimary() { + return isPrimary; + } + + /** + * @param isPrimary + * the isPrimary to set + */ + public AssetFileType setIsPrimary(Boolean isPrimary) { + this.isPrimary = isPrimary; + return this; + } + + /** + * @return the lastModified + */ + public Date getLastModified() { + return lastModified; + } + + /** + * @param lastModified + * the lastModified to set + */ + public AssetFileType setLastModified(Date lastModified) { + this.lastModified = lastModified; + return this; + } + + /** + * @return the created + */ + public Date getCreated() { + return created; + } + + /** + * @param created + * the created to set + */ + public AssetFileType setCreated(Date created) { + this.created = created; + return this; + } + + /** + * @return the mimeType + */ + public String getMimeType() { + return mimeType; + } + + /** + * @param mimeType + * the mimeType to set + */ + public AssetFileType setMimeType(String mimeType) { + this.mimeType = mimeType; + return this; + } + + /** + * @return the contentChecksum + */ + public String getContentChecksum() { + return contentChecksum; + } + + /** + * @param contentChecksum + * the contentChecksum to set + */ + public AssetFileType setContentChecksum(String contentChecksum) { + this.contentChecksum = contentChecksum; + return this; + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/AssetType.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/AssetType.java new file mode 100644 index 000000000000..8cbc101c74bd --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/AssetType.java @@ -0,0 +1,164 @@ +/** + * 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.content; + +import java.util.Date; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; + +/** + * This type maps the XML returned in the odata ATOM serialization + * for Asset entities. + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +public class AssetType implements MediaServiceDTO { + + @XmlElement(name = "Id", namespace = Constants.ODATA_DATA_NS) + protected String id; + + @XmlElement(name = "State", namespace = Constants.ODATA_DATA_NS) + protected Integer state; + + @XmlElement(name = "Created", namespace = Constants.ODATA_DATA_NS) + protected Date created; + + @XmlElement(name = "LastModified", namespace = Constants.ODATA_DATA_NS) + protected Date lastModified; + + @XmlElement(name = "AlternateId", namespace = Constants.ODATA_DATA_NS) + protected String alternateId; + + @XmlElement(name = "Name", namespace = Constants.ODATA_DATA_NS) + protected String name; + + @XmlElement(name = "Options", namespace = Constants.ODATA_DATA_NS) + protected Integer options; + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @param id + * the id to set + */ + public AssetType setId(String id) { + this.id = id; + return this; + } + + /** + * @return the state + */ + public Integer getState() { + return state; + } + + /** + * @param state + * the state to set + */ + public AssetType setState(Integer state) { + this.state = state; + return this; + } + + /** + * @return the created + */ + public Date getCreated() { + return created; + } + + /** + * @param created + * the created to set + */ + public AssetType setCreated(Date created) { + this.created = created; + return this; + } + + /** + * @return the lastModified + */ + public Date getLastModified() { + return lastModified; + } + + /** + * @param lastModified + * the lastModified to set + */ + public AssetType setLastModified(Date lastModified) { + this.lastModified = lastModified; + return this; + } + + /** + * @return the alternateId + */ + public String getAlternateId() { + return alternateId; + } + + /** + * @param alternateId + * the alternateId to set + */ + public AssetType setAlternateId(String alternateId) { + this.alternateId = alternateId; + return this; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name + * the name to set + */ + public AssetType setName(String name) { + this.name = name; + return this; + } + + /** + * @return the options + */ + public Integer getOptions() { + return options; + } + + /** + * @param options + * the options to set + */ + public AssetType setOptions(Integer options) { + this.options = options; + return this; + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/Constants.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/Constants.java new file mode 100644 index 000000000000..b713aedf0961 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/Constants.java @@ -0,0 +1,61 @@ +/** + * 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.content; + +import javax.xml.namespace.QName; + +/** + * This class provides a set of constants for element names + * and namespaces used throughout the serialization of + * media services entities. + */ + +public class Constants { + /** + * XML Namespace for Atom syndication format, as defined by IETF RFC 4287 + */ + public static final String ATOM_NS = "http://www.w3.org/2005/Atom"; + + /** + * XML Namespace for OData data as serialized inside Atom syndication format. + */ + public static final String ODATA_DATA_NS = "http://schemas.microsoft.com/ado/2007/08/dataservices"; + + /** + * XML Namespace for OData metadata as serialized inside Atom syndication format. + */ + public static final String ODATA_METADATA_NS = "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"; + + /** + * EDM namespace for Azure Media Services entities, as defined in Media Services EDMX file. + */ + public static final String MEDIA_SERVICES_EDM_NAMESPACE = "Microsoft.Cloud.Media.Vod.Rest.Data.Models"; + + /** + * Element name for Atom content element, including namespace + */ + public static final QName ATOM_CONTENT_ELEMENT_NAME = new QName("content", ATOM_NS); + + /** + * Element name for OData action elements, including namespace + */ + public static final QName ODATA_ACTION_ELEMENT_NAME = new QName("action", ODATA_METADATA_NS); + + /** + * Element name for the metadata properties element, including namespace. + */ + public static final QName ODATA_PROPERTIES_ELEMENT_NAME = new QName("properties", ODATA_METADATA_NS); +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/ContentKeyRestType.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/ContentKeyRestType.java new file mode 100644 index 000000000000..72e0e7261481 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/ContentKeyRestType.java @@ -0,0 +1,256 @@ +/** + * 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.content; + +import java.util.Date; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; + +/** + * This type maps the XML returned in the odata ATOM serialization + * for Asset entities. + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +public class ContentKeyRestType implements MediaServiceDTO { + + /** The id. */ + @XmlElement(name = "Id", namespace = Constants.ODATA_DATA_NS) + protected String id; + + /** The created. */ + @XmlElement(name = "Created", namespace = Constants.ODATA_DATA_NS) + protected Date created; + + /** The last modified. */ + @XmlElement(name = "LastModified", namespace = Constants.ODATA_DATA_NS) + protected Date lastModified; + + /** The content key type. */ + @XmlElement(name = "ContentKeyType", namespace = Constants.ODATA_DATA_NS) + protected Integer contentKeyType; + + /** The encrypted content key. */ + @XmlElement(name = "EncryptedContentKey", namespace = Constants.ODATA_DATA_NS) + protected String encryptedContentKey; + + /** The name. */ + @XmlElement(name = "Name", namespace = Constants.ODATA_DATA_NS) + protected String name; + + /** The protection key id. */ + @XmlElement(name = "ProtectionKeyId", namespace = Constants.ODATA_DATA_NS) + protected String protectionKeyId; + + /** The protection key type. */ + @XmlElement(name = "ProtectionKeyType", namespace = Constants.ODATA_DATA_NS) + private Integer protectionKeyType; + + /** The checksum. */ + @XmlElement(name = "Checksum", namespace = Constants.ODATA_DATA_NS) + protected String checksum; + + /** + * Gets the id. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Sets the id. + * + * @param id + * the id to set + * @return the content key rest type + */ + public ContentKeyRestType setId(String id) { + this.id = id; + return this; + } + + /** + * Gets the created. + * + * @return the created + */ + public Date getCreated() { + return created; + } + + /** + * Sets the created. + * + * @param created + * the created to set + * @return the content key rest type + */ + public ContentKeyRestType setCreated(Date created) { + this.created = created; + return this; + } + + /** + * Gets the last modified. + * + * @return the lastModified + */ + public Date getLastModified() { + return lastModified; + } + + /** + * Sets the last modified. + * + * @param lastModified + * the lastModified to set + * @return the content key rest type + */ + public ContentKeyRestType setLastModified(Date lastModified) { + this.lastModified = lastModified; + return this; + } + + /** + * Gets the content key type. + * + * @return the content key type + */ + public Integer getContentKeyType() { + return contentKeyType; + } + + /** + * Sets the content key type. + * + * @param contentKeyType + * the new content key type + * @return the content key rest type + */ + public ContentKeyRestType setContentKeyType(Integer contentKeyType) { + this.contentKeyType = contentKeyType; + return this; + } + + /** + * Gets the name. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Sets the name. + * + * @param name + * the name to set + * @return the content key rest type + */ + public ContentKeyRestType setName(String name) { + this.name = name; + return this; + } + + /** + * Sets the checksum. + * + * @param checksum + * the new checksum + * @return the content key rest type + */ + public ContentKeyRestType setChecksum(String checksum) { + this.checksum = checksum; + return this; + } + + /** + * Gets the checksum. + * + * @return the checksum + */ + public String getChecksum() { + return this.checksum; + } + + /** + * Sets the protection key type. + * + * @param protectionKeyType + * the new protection key type + * @return the content key rest type + */ + public ContentKeyRestType setProtectionKeyType(Integer protectionKeyType) { + this.protectionKeyType = protectionKeyType; + return this; + } + + /** + * Gets the protection key type. + * + * @return the protection key type + */ + public Integer getProtectionKeyType() { + return this.protectionKeyType; + } + + /** + * Sets the protection key id. + * + * @param protectionKeyId + * the new protection key id + * @return the content key rest type + */ + public ContentKeyRestType setProtectionKeyId(String protectionKeyId) { + this.protectionKeyId = protectionKeyId; + return this; + } + + /** + * Gets the protection key id. + * + * @return the protection key id + */ + public String getProtectionKeyId() { + return this.protectionKeyId; + } + + /** + * Sets the encrypted content key. + * + * @param encryptedContentKey + * the encrypted content key + * @return the content key rest type + */ + public ContentKeyRestType setEncryptedContentKey(String encryptedContentKey) { + this.encryptedContentKey = encryptedContentKey; + return this; + } + + /** + * Gets the encrypted content key. + * + * @return the encrypted content key + */ + public String getEncryptedContentKey() { + return this.encryptedContentKey; + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/ErrorDetailType.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/ErrorDetailType.java new file mode 100644 index 000000000000..3a5ffdef35f3 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/ErrorDetailType.java @@ -0,0 +1,80 @@ +/** + * 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.content; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; + +/** + * This type maps the XML returned in the odata ATOM serialization + * for ErrorDetail entities. + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +public class ErrorDetailType implements MediaServiceDTO { + + /** The code. */ + @XmlElement(name = "Code", namespace = Constants.ODATA_DATA_NS) + protected String code; + + /** The message. */ + @XmlElement(name = "Message", namespace = Constants.ODATA_DATA_NS) + protected String message; + + /** + * Gets the code. + * + * @return the code + */ + public String getCode() { + return code; + } + + /** + * Sets the code. + * + * @param code + * the id to set + * @return the error detail type + */ + public ErrorDetailType setCode(String code) { + this.code = code; + return this; + } + + /** + * Gets the message. + * + * @return the message + */ + public String getMessage() { + return message; + } + + /** + * Sets the message. + * + * @param message + * the message to set + * @return the error detail type + */ + public ErrorDetailType setMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/JobType.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/JobType.java new file mode 100644 index 000000000000..18a8d027d0c3 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/JobType.java @@ -0,0 +1,272 @@ +/** + * 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.content; + +import java.util.Date; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; + +/** + * This type maps the XML returned in the odata ATOM serialization + * for Job entities. + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +public class JobType implements MediaServiceDTO { + + /** The id. */ + @XmlElement(name = "Id", namespace = Constants.ODATA_DATA_NS) + protected String id; + + /** The name. */ + @XmlElement(name = "Name", namespace = Constants.ODATA_DATA_NS) + protected String name; + + /** The created. */ + @XmlElement(name = "Created", namespace = Constants.ODATA_DATA_NS) + protected Date created; + + /** The last modified. */ + @XmlElement(name = "LastModified", namespace = Constants.ODATA_DATA_NS) + protected Date lastModified; + + /** The end time. */ + @XmlElement(name = "EndTime", namespace = Constants.ODATA_DATA_NS) + protected Date endTime; + + /** The priority. */ + @XmlElement(name = "Priority", namespace = Constants.ODATA_DATA_NS) + protected Integer priority; + + /** The running duration. */ + @XmlElement(name = "RunningDuration", namespace = Constants.ODATA_DATA_NS) + protected Double runningDuration; + + /** The start time. */ + @XmlElement(name = "StartTime", namespace = Constants.ODATA_DATA_NS) + protected Date startTime; + + /** The state. */ + @XmlElement(name = "State", namespace = Constants.ODATA_DATA_NS) + protected Integer state; + + /** The template id. */ + @XmlElement(name = "TemplateId", namespace = Constants.ODATA_DATA_NS) + protected String templateId; + + /** + * Gets the id. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Sets the id. + * + * @param id + * the new id + */ + public JobType setId(String id) { + this.id = id; + return this; + } + + /** + * Gets the name. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Sets the name. + * + * @param name + * the new name + */ + public JobType setName(String name) { + this.name = name; + return this; + } + + /** + * Gets the created. + * + * @return the created + */ + public Date getCreated() { + return created; + } + + /** + * Sets the created. + * + * @param created + * the new created + */ + public JobType setCreated(Date created) { + this.created = created; + return this; + } + + /** + * Gets the last modified. + * + * @return the last modified + */ + public Date getLastModified() { + return lastModified; + } + + /** + * Sets the last modified. + * + * @param lastModified + * the new last modified + */ + public JobType setLastModified(Date lastModified) { + this.lastModified = lastModified; + return this; + } + + /** + * Gets the end time. + * + * @return the end time + */ + public Date getEndTime() { + return endTime; + } + + /** + * Sets the end time. + * + * @param endTime + * the new end time + */ + public JobType setEndTime(Date endTime) { + this.endTime = endTime; + return this; + } + + /** + * Gets the priority. + * + * @return the priority + */ + public Integer getPriority() { + return priority; + } + + /** + * Sets the priority. + * + * @param priority + * the new priority + */ + public JobType setPriority(Integer priority) { + this.priority = priority; + return this; + } + + /** + * Gets the running duration. + * + * @return the running duration + */ + public Double getRunningDuration() { + return runningDuration; + } + + /** + * Sets the running duration. + * + * @param runningDuration + * the new running duration + */ + public JobType setRunningDuration(Double runningDuration) { + this.runningDuration = runningDuration; + return this; + } + + /** + * Gets the start time. + * + * @return the start time + */ + public Date getStartTime() { + return startTime; + } + + /** + * Sets the start time. + * + * @param startTime + * the new start time + */ + public JobType setStartTime(Date startTime) { + this.startTime = startTime; + return this; + } + + /** + * Gets the state. + * + * @return the state + */ + public Integer getState() { + return state; + } + + /** + * Sets the state. + * + * @param state + * the new state + */ + public JobType setState(Integer state) { + this.state = state; + return this; + } + + /** + * Gets the template id. + * + * @return the template id + */ + public String getTemplateId() { + return templateId; + } + + /** + * Sets the template id. + * + * @param templateId + * the new template id + */ + public JobType setTemplateId(String templateId) { + this.templateId = templateId; + return this; + } + +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/LocatorRestType.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/LocatorRestType.java new file mode 100644 index 000000000000..1f30a8a6afcd --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/LocatorRestType.java @@ -0,0 +1,255 @@ +/** + * 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.content; + +import java.util.Date; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; + +/** + * Wrapper DTO for Media Services Locator. + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +public class LocatorRestType implements MediaServiceDTO { + + /** The id. */ + @XmlElement(name = "Id", namespace = Constants.ODATA_DATA_NS) + protected String id; + + /** The expiration date time. */ + @XmlElement(name = "ExpirationDateTime", namespace = Constants.ODATA_DATA_NS) + protected Date expirationDateTime; + + /** The type. */ + @XmlElement(name = "Type", namespace = Constants.ODATA_DATA_NS) + protected Integer type; + + /** The path. */ + @XmlElement(name = "Path", namespace = Constants.ODATA_DATA_NS) + protected String path; + + /** The access policy id. */ + @XmlElement(name = "AccessPolicyId", namespace = Constants.ODATA_DATA_NS) + protected String accessPolicyId; + + /** The asset id. */ + @XmlElement(name = "AssetId", namespace = Constants.ODATA_DATA_NS) + protected String assetId; + + /** The start time. */ + @XmlElement(name = "StartTime", namespace = Constants.ODATA_DATA_NS) + protected Date startTime; + + /** The base uri. */ + @XmlElement(name = "BaseUri", namespace = Constants.ODATA_DATA_NS) + private String baseUri; + + /** The content access component. */ + @XmlElement(name = "ContentAccessComponent", namespace = Constants.ODATA_DATA_NS) + private String contentAccessComponent; + + /** + * Gets the id. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Sets the id. + * + * @param id + * the id to set + * @return the locator rest type + */ + public LocatorRestType setId(String id) { + this.id = id; + return this; + } + + /** + * Gets the expiration date time. + * + * @return the expiration date time + */ + public Date getExpirationDateTime() { + return expirationDateTime; + } + + /** + * Sets the expiration date time. + * + * @param expirationDateTime + * the expiration date time + * @return the locator rest type + */ + public LocatorRestType setExpirationDateTime(Date expirationDateTime) { + this.expirationDateTime = expirationDateTime; + return this; + } + + /** + * Gets the type. + * + * @return the type + */ + public Integer getType() { + return this.type; + } + + /** + * Sets the type. + * + * @param type + * the type + * @return the locator rest type + */ + public LocatorRestType setType(Integer type) { + this.type = type; + return this; + } + + /** + * Gets the access policy id. + * + * @return the access policy id + */ + public String getAccessPolicyId() { + return this.accessPolicyId; + } + + /** + * Sets the access policy id. + * + * @param accessPolicyId + * the access policy id + * @return the locator rest type + */ + public LocatorRestType setAccessPolicyId(String accessPolicyId) { + this.accessPolicyId = accessPolicyId; + return this; + } + + /** + * Gets the asset id. + * + * @return the asset id + */ + public String getAssetId() { + return this.assetId; + } + + /** + * Sets the asset id. + * + * @param assetId + * the asset id + * @return the locator rest type + */ + public LocatorRestType setAssetId(String assetId) { + this.assetId = assetId; + return this; + } + + /** + * Gets the start time. + * + * @return the start time + */ + public Date getStartTime() { + return this.startTime; + } + + /** + * Sets the start time. + * + * @param startTime + * the start time + * @return the locator rest type + */ + public LocatorRestType setStartTime(Date startTime) { + this.startTime = startTime; + return this; + } + + /** + * Gets the path. + * + * @return the path + */ + public String getPath() { + return this.path; + } + + /** + * Sets the path. + * + * @param path + * the path + * @return the locator rest type + */ + public LocatorRestType setPath(String path) { + this.path = path; + return this; + } + + /** + * Gets the base uri. + * + * @return the base uri + */ + public String getBaseUri() { + return this.baseUri; + } + + /** + * Sets the base uri. + * + * @param baseUri + * the base uri + * @return the locator rest type + */ + public LocatorRestType setBaseUri(String baseUri) { + this.baseUri = baseUri; + return this; + } + + /** + * Gets the content access component. + * + * @return the content access component + */ + public String getContentAccessComponent() { + return this.contentAccessComponent; + } + + /** + * Sets the content access component. + * + * @param contentAccessComponent + * the content access component + * @return the locator rest type + */ + public LocatorRestType setContentAccessComponent(String contentAccessComponent) { + this.contentAccessComponent = contentAccessComponent; + return this; + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/MediaProcessorType.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/MediaProcessorType.java new file mode 100644 index 000000000000..c79778a5b341 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/MediaProcessorType.java @@ -0,0 +1,115 @@ +/** + * 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.content; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; + +/** + * This type maps the XML returned in the odata ATOM serialization + * for Asset entities. + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +public class MediaProcessorType implements MediaServiceDTO { + + @XmlElement(name = "Id", namespace = Constants.ODATA_DATA_NS) + protected String id; + + @XmlElement(name = "Name", namespace = Constants.ODATA_DATA_NS) + protected String name; + + @XmlElement(name = "Description", namespace = Constants.ODATA_DATA_NS) + protected String description; + + @XmlElement(name = "Sku", namespace = Constants.ODATA_DATA_NS) + protected String sku; + + @XmlElement(name = "Vendor", namespace = Constants.ODATA_DATA_NS) + protected String vendor; + + @XmlElement(name = "Version", namespace = Constants.ODATA_DATA_NS) + protected String version; + + /** + * @return the id + */ + public String getId() { + return id; + } + + /** + * @param id + * the id to set + */ + public MediaProcessorType setId(String id) { + this.id = id; + return this; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name + * the name to set + */ + public MediaProcessorType setName(String name) { + this.name = name; + return this; + } + + public String getDescription() { + return this.description; + } + + public MediaProcessorType setDescription(String description) { + this.description = description; + return this; + } + + public String getSku() { + return this.sku; + } + + public MediaProcessorType setSku(String sku) { + this.sku = sku; + return this; + } + + public String getVendor() { + return vendor; + } + + public MediaProcessorType setVendor(String vendor) { + this.vendor = vendor; + return this; + } + + public String getVersion() { + return this.version; + } + + public MediaProcessorType setVersion(String version) { + this.version = version; + return this; + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/MediaServiceDTO.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/MediaServiceDTO.java new file mode 100644 index 000000000000..f99f73b11106 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/MediaServiceDTO.java @@ -0,0 +1,28 @@ +/** + * 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.content; + +/** + * Marker interface to mark types as a data transfer object + * to or from Media Services. + * + * This is a marker interface rather than an annotation so + * that it can be used as a generic type parameter or restriction. + * + */ +public interface MediaServiceDTO { + +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/MediaUriType.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/MediaUriType.java new file mode 100644 index 000000000000..7c612ed67a1a --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/MediaUriType.java @@ -0,0 +1,49 @@ +/** + * 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.content; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlValue; + +/** + * This type maps the URI. + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlRootElement(name = "uri", namespace = Constants.ODATA_DATA_NS) +public class MediaUriType implements MediaServiceDTO { + @XmlValue + String uri; + + /** + * @return the uri. + */ + public String getUri() { + return uri; + } + + /** + * @param uri + * uri + * the uri to set + */ + public void setUri(String uri) { + this.uri = uri; + } + +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/ODataActionType.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/ODataActionType.java new file mode 100644 index 000000000000..bc358a3540b8 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/ODataActionType.java @@ -0,0 +1,91 @@ +/** + * 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.content; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; + +/** + * XML Serialization class for odata m:action elements + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +public class ODataActionType { + + @XmlAttribute(required = true) + protected String metadata; + + @XmlAttribute(required = true) + protected String target; + + @XmlAttribute(required = true) + protected String title; + + /** + * Get metadata + * + * @return the metadata + */ + public String getMetadata() { + return metadata; + } + + /** + * Set metadata + * + * @param metadata + */ + public void setMetadata(String metadata) { + this.metadata = metadata; + } + + /** + * Get target + * + * @return the target + */ + public String getTarget() { + return target; + } + + /** + * set target + * + * @param target + */ + public void setTarget(String target) { + this.target = target; + } + + /** + * Get title + * + * @return the title + */ + public String getTitle() { + return title; + } + + /** + * set title + * + * @param title + */ + public void setTitle(String title) { + this.title = title; + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/ObjectFactory.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/ObjectFactory.java new file mode 100644 index 000000000000..3769e3a1aa02 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/ObjectFactory.java @@ -0,0 +1,115 @@ +/** + * 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.content; + +import javax.xml.bind.annotation.XmlRegistry; + +/** + * Class used by JAXB to instantiate the types in this package. + * + */ +@XmlRegistry +public class ObjectFactory { + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: + * com.microsoft.windowsazure.services.media.implementation.atom + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link AssetType }. + * + * @return a new AssetType instance. + */ + public AssetType createAssetType() { + return new AssetType(); + } + + /** + * Create an instance of {@link ODataActionType }. + * + * @return a new ODataActionType instance. + */ + public ODataActionType createODataActionType() { + return new ODataActionType(); + } + + /** + * Create an instance of {@link AccessPolicyType }. + * + * @return a new AccessPolicyType instance. + */ + public AccessPolicyType createAccessPolicyType() { + return new AccessPolicyType(); + } + + /** + * Create an instance of {@link LocatorRestType }. + * + * @return a new LocatorRestType instance. + */ + public LocatorRestType createLocatorRestType() { + return new LocatorRestType(); + } + + /** + * Create an instance of {@link MediaProcessorType }. + * + * @return a new MediaProcessorType instance. + */ + public MediaProcessorType createMediaProcessorType() { + return new MediaProcessorType(); + } + + /** + * Create an instance of {@link JobType}. + * + * @return a new JobType instance. + */ + public JobType createJobType() { + return new JobType(); + } + + /** + * Create an instance of {@link TaskType}. + * + * @return a new TaskType instance. + */ + public TaskType createTaskType() { + return new TaskType(); + } + + /** + * Creates a new Object object. + * + * @return the content key rest type + */ + public ContentKeyRestType createContentKeyRestType() { + return new ContentKeyRestType(); + } + + /** + * Create an instance of {@link AssetFileType} + * + * @return a new AssetFileType instance. + */ + public AssetFileType createAssetFileType() { + return new AssetFileType(); + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/ProtectionKeyIdType.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/ProtectionKeyIdType.java new file mode 100644 index 000000000000..3190c34c2907 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/ProtectionKeyIdType.java @@ -0,0 +1,50 @@ +/** + * 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.content; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlValue; + +/** + * This type maps the XML returned in the odata ATOM serialization + * for Asset entities. + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlRootElement(name = "GetProtectionKeyId", namespace = Constants.ODATA_DATA_NS) +public class ProtectionKeyIdType implements MediaServiceDTO { + @XmlValue + String protectionKeyId; + + /** + * @return the protection key id + */ + public String getProtectionKeyId() { + return protectionKeyId; + } + + /** + * @param protection + * key id + * the protection key id to set + */ + public void setProtectionKeyId(String protectionKeyId) { + this.protectionKeyId = protectionKeyId; + } + +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/ProtectionKeyRestType.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/ProtectionKeyRestType.java new file mode 100644 index 000000000000..d17551fb13fb --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/ProtectionKeyRestType.java @@ -0,0 +1,49 @@ +/** + * 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.content; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlValue; + +/** + * This type maps the XML returned in protection key. + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlRootElement(name = "GetProtectionKey", namespace = Constants.ODATA_DATA_NS) +public class ProtectionKeyRestType implements MediaServiceDTO { + @XmlValue + String protectionKey; + + /** + * @return the protection key + */ + public String getProtectionKey() { + return protectionKey; + } + + /** + * @param protection + * key id + * the protection key id to set + */ + public void setProtectionKey(String protectionKey) { + this.protectionKey = protectionKey; + } + +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/TaskType.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/TaskType.java new file mode 100644 index 000000000000..9436ca9ab025 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/TaskType.java @@ -0,0 +1,272 @@ +/** + * 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.content; + +import java.util.Date; +import java.util.List; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; + +/** + * This type maps the XML returned in the odata ATOM serialization + * for Task entities. + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +public class TaskType implements MediaServiceDTO { + + @XmlElement(name = "Id", namespace = Constants.ODATA_DATA_NS) + protected String id; + + @XmlElement(name = "Configuration", namespace = Constants.ODATA_DATA_NS) + protected String configuration; + + @XmlElement(name = "EndTime", namespace = Constants.ODATA_DATA_NS) + protected Date endTime; + + @XmlElementWrapper(name = "ErrorDetails", namespace = Constants.ODATA_DATA_NS) + @XmlElement(name = "element", namespace = Constants.ODATA_DATA_NS) + protected List errorDetails; + + @XmlElement(name = "MediaProcessorId", namespace = Constants.ODATA_DATA_NS) + protected String mediaProcessorId; + + @XmlElement(name = "Name", namespace = Constants.ODATA_DATA_NS) + protected String name; + + @XmlElement(name = "PerfMessage", namespace = Constants.ODATA_DATA_NS) + protected String perfMessage; + + @XmlElement(name = "Priority", namespace = Constants.ODATA_DATA_NS) + protected Integer priority; + + @XmlElement(name = "Progress", namespace = Constants.ODATA_DATA_NS) + protected Double progress; + + @XmlElement(name = "RunningDuration", namespace = Constants.ODATA_DATA_NS) + protected Double runningDuration; + + @XmlElement(name = "StartTime", namespace = Constants.ODATA_DATA_NS) + protected Date startTime; + + @XmlElement(name = "State", namespace = Constants.ODATA_DATA_NS) + protected Integer state; + + @XmlElement(name = "TaskBody", namespace = Constants.ODATA_DATA_NS) + protected String taskBody; + + @XmlElement(name = "Options", namespace = Constants.ODATA_DATA_NS) + protected Integer options; + + @XmlElement(name = "EncryptionKeyId", namespace = Constants.ODATA_DATA_NS) + protected String encryptionKeyId; + + @XmlElement(name = "EncryptionScheme", namespace = Constants.ODATA_DATA_NS) + protected String encryptionScheme; + + @XmlElement(name = "EncryptionVersion", namespace = Constants.ODATA_DATA_NS) + protected String encryptionVersion; + + @XmlElement(name = "InitializationVector", namespace = Constants.ODATA_DATA_NS) + protected String initializationVector; + + protected List outputMediaAssets; + + protected List inputMediaAssets; + + public String getId() { + return id; + } + + public TaskType setId(String id) { + this.id = id; + return this; + } + + public String getConfiguration() { + return configuration; + } + + public TaskType setConfiguration(String configuration) { + this.configuration = configuration; + return this; + } + + public Date getEndTime() { + return endTime; + } + + public TaskType setEndTime(Date endTime) { + this.endTime = endTime; + return this; + } + + public List getErrorDetails() { + return errorDetails; + } + + public TaskType setErrorDetails(List errorDetails) { + this.errorDetails = errorDetails; + return this; + } + + public String getMediaProcessorId() { + return mediaProcessorId; + } + + public TaskType setMediaProcessorId(String mediaProcessorId) { + this.mediaProcessorId = mediaProcessorId; + return this; + } + + public String getName() { + return name; + } + + public TaskType setName(String name) { + this.name = name; + return this; + } + + public String getPerfMessage() { + return perfMessage; + } + + public TaskType setPerfMessage(String perfMessage) { + this.perfMessage = perfMessage; + return this; + } + + public Integer getPriority() { + return priority; + } + + public TaskType setPriority(Integer priority) { + this.priority = priority; + return this; + } + + public Double getProgress() { + return progress; + } + + public TaskType setProgress(Double progress) { + this.progress = progress; + return this; + } + + public Double getRunningDuration() { + return runningDuration; + } + + public TaskType setRunningDuration(Double runningDuration) { + this.runningDuration = runningDuration; + return this; + } + + public Date getStartTime() { + return startTime; + } + + public TaskType setStartTime(Date startTime) { + this.startTime = startTime; + return this; + } + + public Integer getState() { + return state; + } + + public TaskType setState(Integer state) { + this.state = state; + return this; + } + + public String getTaskBody() { + return taskBody; + } + + public TaskType setTaskBody(String taskBody) { + this.taskBody = taskBody; + return this; + } + + public Integer getOptions() { + return options; + } + + public TaskType setOptions(Integer options) { + this.options = options; + return this; + } + + public String getEncryptionKeyId() { + return encryptionKeyId; + } + + public TaskType setEncryptionKeyId(String encryptionKeyId) { + this.encryptionKeyId = encryptionKeyId; + return this; + } + + public String getEncryptionScheme() { + return encryptionScheme; + } + + public TaskType setEncryptionScheme(String encryptionScheme) { + this.encryptionScheme = encryptionScheme; + return this; + } + + public String getEncryptionVersion() { + return encryptionVersion; + } + + public TaskType setEncryptionVersion(String encryptionVersion) { + this.encryptionVersion = encryptionVersion; + return this; + } + + public String getInitializationVector() { + return initializationVector; + } + + public TaskType setInitializationVector(String initializationVector) { + this.initializationVector = initializationVector; + return this; + } + + public List getOutputMediaAssets() { + return outputMediaAssets; + } + + public TaskType setOutputMediaAssets(List outputMediaAssets) { + this.outputMediaAssets = outputMediaAssets; + return this; + } + + public List getInputMediaAssets() { + return inputMediaAssets; + } + + public TaskType setInputMediaAssets(List inputMediaAssets) { + this.inputMediaAssets = inputMediaAssets; + return this; + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/package-info.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/package-info.java new file mode 100644 index 000000000000..1c9ecda9766d --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/implementation/content/package-info.java @@ -0,0 +1,22 @@ +/** + * 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. + */ + +@XmlJavaTypeAdapter(value = ODataDateAdapter.class, type = java.util.Date.class) +package com.microsoft.windowsazure.services.media.implementation.content; + +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + +import com.microsoft.windowsazure.services.media.implementation.ODataDateAdapter; + diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/AccessPolicy.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/AccessPolicy.java new file mode 100644 index 000000000000..200d571abb72 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/AccessPolicy.java @@ -0,0 +1,122 @@ +/** + * 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.models; + +import java.util.EnumSet; + +import com.microsoft.windowsazure.services.media.entityoperations.DefaultDeleteOperation; +import com.microsoft.windowsazure.services.media.entityoperations.DefaultGetOperation; +import com.microsoft.windowsazure.services.media.entityoperations.DefaultListOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityCreateOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityDeleteOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityGetOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityOperationSingleResultBase; +import com.microsoft.windowsazure.services.media.implementation.content.AccessPolicyType; +import com.sun.jersey.api.client.GenericType; + +/** + * Class for creating operations to manipulate Access Policy entities. + * + */ +public class AccessPolicy { + + private static final String ENTITY_SET = "AccessPolicies"; + + private AccessPolicy() { + } + + /** + * Creates an operation to create a new access policy + * + * @param name + * name of the access policy + * @param durationInMinutes + * how long the access policy will be in force + * @param permissions + * permissions allowed by this access policy + * @return The operation + */ + public static EntityCreateOperation create(String name, double durationInMinutes, + EnumSet permissions) { + return new Creator(name, durationInMinutes, permissions); + } + + private static class Creator extends EntityOperationSingleResultBase implements + EntityCreateOperation { + private final String policyName; + private final double durationInMinutes; + private final EnumSet permissions; + + public Creator(String policyName, double durationInMinutes, EnumSet permissions) { + + super(ENTITY_SET, AccessPolicyInfo.class); + + this.policyName = policyName; + this.durationInMinutes = durationInMinutes; + this.permissions = permissions; + } + + @Override + public Object getRequestContents() { + return new AccessPolicyType().setName(policyName).setDurationInMinutes(durationInMinutes) + .setPermissions(AccessPolicyPermission.bitsFromPermissions(permissions)); + } + + } + + /** + * Create an operation that will retrieve the given access policy + * + * @param accessPolicyId + * id of access policy to retrieve + * @return the operation + */ + public static EntityGetOperation get(String accessPolicyId) { + return new DefaultGetOperation(ENTITY_SET, accessPolicyId, AccessPolicyInfo.class); + } + + /** + * Create an operation that will retrieve the access policy at the given link + * + * @param link + * the link + * @return the operation + */ + public static EntityGetOperation get(LinkInfo link) { + return new DefaultGetOperation(link.getHref(), AccessPolicyInfo.class); + } + + /** + * Create an operation that will retrieve all access policies + * + * @return the operation + */ + public static DefaultListOperation list() { + return new DefaultListOperation(ENTITY_SET, new GenericType>() { + }); + } + + /** + * Create an operation to delete the given access policy + * + * @param accessPolicyId + * id of access policy to delete + * @return the delete operation + */ + public static EntityDeleteOperation delete(String accessPolicyId) { + return new DefaultDeleteOperation(ENTITY_SET, accessPolicyId); + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/AccessPolicyInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/AccessPolicyInfo.java new file mode 100644 index 000000000000..290e1bdcb25d --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/AccessPolicyInfo.java @@ -0,0 +1,97 @@ +/** + * 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.models; + +import java.util.Date; +import java.util.EnumSet; + +import com.microsoft.windowsazure.services.media.implementation.ODataEntity; +import com.microsoft.windowsazure.services.media.implementation.atom.EntryType; +import com.microsoft.windowsazure.services.media.implementation.content.AccessPolicyType; + +/** + * Type containing data about access policies. + * + */ +public class AccessPolicyInfo extends ODataEntity { + + /** + * Creates a new {@link AccessPolicyInfo} wrapping the given ATOM + * entry and content objects. + * + * @param entry + * Entry containing this AccessPolicy data + * @param content + * Content with the AccessPolicy data + */ + public AccessPolicyInfo(EntryType entry, AccessPolicyType content) { + super(entry, content); + } + + /** + * Get the access policy id. + * + * @return the id. + */ + public String getId() { + return getContent().getId(); + } + + /** + * Get the creation date. + * + * @return the date. + */ + public Date getCreated() { + return getContent().getCreated(); + } + + /** + * Get the last modified date. + * + * @return the date. + */ + public Date getLastModified() { + return getContent().getLastModified(); + } + + /** + * Get the name. + * + * @return the name. + */ + public String getName() { + return getContent().getName(); + } + + /** + * Get the duration. + * + * @return the duration. + */ + public double getDurationInMinutes() { + return getContent().getDurationInMinutes(); + } + + /** + * Get the permissions. + * + * @return the permissions. + */ + public EnumSet getPermissions() { + return AccessPolicyPermission.permissionsFromBits(getContent().getPermissions()); + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/AccessPolicyPermission.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/AccessPolicyPermission.java new file mode 100644 index 000000000000..d721069e6df8 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/AccessPolicyPermission.java @@ -0,0 +1,79 @@ +/** + * 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.models; + +import java.util.EnumSet; + +/** + * Permissions available to an access policy + * + */ +public enum AccessPolicyPermission { + NONE(0), READ(1), WRITE(2), DELETE(4), LIST(8); + + private int flagValue; + + private AccessPolicyPermission(int value) { + flagValue = value; + } + + /** + * Get the flag bit value associated with this permission + * + * @return The integer permission value + */ + public int getFlagValue() { + return flagValue; + } + + /** + * Given an integer representing the permissions as a bit vector, + * convert it into an EnumSet<AccessPolicyPermission> object containing the correct permissions + * * + * + * @param bits + * The bit vector of permissions + * @return The set of permissions in an EnumSet object. + */ + public static EnumSet permissionsFromBits(int bits) { + EnumSet perms = EnumSet.of(AccessPolicyPermission.NONE); + + for (AccessPolicyPermission p : AccessPolicyPermission.values()) { + if ((bits & p.getFlagValue()) != 0) { + perms.remove(AccessPolicyPermission.NONE); + perms.add(p); + } + } + + return perms; + } + + /** + * Convert an EnumSet containing permissions into the + * corresponding integer bit vector to be passed to Media services. + * + * @param perms + * The permissions + * @return The bit vector to go out over the wire. + */ + public static int bitsFromPermissions(EnumSet perms) { + int result = 0; + for (AccessPolicyPermission p : perms) { + result |= p.getFlagValue(); + } + + return result; + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/Asset.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/Asset.java new file mode 100644 index 000000000000..3606cc7fc669 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/Asset.java @@ -0,0 +1,305 @@ +/** + * 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.models; + +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.net.URLEncoder; +import java.security.InvalidParameterException; + +import com.microsoft.windowsazure.services.media.entityoperations.DefaultDeleteOperation; +import com.microsoft.windowsazure.services.media.entityoperations.DefaultGetOperation; +import com.microsoft.windowsazure.services.media.entityoperations.DefaultListOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityCreateOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityDeleteOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityGetOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityLinkOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityOperationBase; +import com.microsoft.windowsazure.services.media.entityoperations.EntityOperationSingleResultBase; +import com.microsoft.windowsazure.services.media.entityoperations.EntityProxyData; +import com.microsoft.windowsazure.services.media.entityoperations.EntityUpdateOperation; +import com.microsoft.windowsazure.services.media.implementation.content.AssetType; +import com.sun.jersey.api.client.GenericType; + +/** + * Class for creating operations to manipulate Asset entities. + * + */ +public class Asset { + + /** The Constant ENTITY_SET. */ + private static final String ENTITY_SET = "Assets"; + + // Prevent instantiation + /** + * Instantiates a new asset. + */ + private Asset() { + } + + /** + * Creates the. + * + * @return the creator + */ + public static Creator create() { + return new Creator(); + } + + /** + * The Class Creator. + */ + public static class Creator extends EntityOperationSingleResultBase implements + EntityCreateOperation { + + /** The name. */ + private String name; + + /** The alternate id. */ + private String alternateId; + + /** The options. */ + private AssetOption options; + + /** The state. */ + private AssetState state; + + /** + * Instantiates a new creator. + */ + public Creator() { + super(ENTITY_SET, AssetInfo.class); + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityCreateOperation#getRequestContents() + */ + @Override + public Object getRequestContents() { + AssetType assetType = new AssetType(); + assetType.setName(name); + assetType.setAlternateId(alternateId); + if (options != null) { + assetType.setOptions(options.getCode()); + } + if (state != null) { + assetType.setState(state.getCode()); + } + return assetType; + } + + /** + * Set the name of the asset to be created. + * + * @param name + * The name + * @return The creator object (for call chaining) + */ + public Creator setName(String name) { + this.name = name; + return this; + } + + /** + * Sets the alternate id of the asset to be created. + * + * @param alternateId + * The id + * + * @return The creator object (for call chaining) + */ + public Creator setAlternateId(String alternateId) { + this.alternateId = alternateId; + return this; + } + + /** + * Sets the options. + * + * @param options + * the options + * @return the creator + */ + public Creator setOptions(AssetOption options) { + this.options = options; + return this; + } + + /** + * Sets the state. + * + * @param state + * the state + * @return the creator + */ + public Creator setState(AssetState state) { + this.state = state; + return this; + } + } + + /** + * Create an operation object that will get the state of the given asset. + * + * @param assetId + * id of asset to retrieve + * @return the get operation + */ + public static EntityGetOperation get(String assetId) { + return new DefaultGetOperation(ENTITY_SET, assetId, AssetInfo.class); + } + + /** + * Get the asset at the given link + * + * @param link + * the link + * @return the get operation + */ + public static EntityGetOperation get(LinkInfo link) { + return new DefaultGetOperation(link.getHref(), AssetInfo.class); + } + + /** + * Create an operation that will list all the assets. + * + * @return The list operation + */ + public static DefaultListOperation list() { + return new DefaultListOperation(ENTITY_SET, new GenericType>() { + }); + } + + /** + * Create an operation that will list all the assets at the given link. + * + * @param link + * Link to request assets from. + * @return The list operation. + */ + public static DefaultListOperation list(LinkInfo link) { + return new DefaultListOperation(link.getHref(), new GenericType>() { + }); + } + + /** + * Create an operation that will update the given asset. + * + * @param assetId + * id of the asset to update + * @return the update operation + */ + public static Updater update(String assetId) { + return new Updater(assetId); + } + + /** + * The Class Updater. + */ + public static class Updater extends EntityOperationBase implements EntityUpdateOperation { + + /** The name. */ + private String name; + + /** The alternate id. */ + private String alternateId; + + /** + * Instantiates a new updater. + * + * @param assetId + * the asset id + */ + protected Updater(String assetId) { + super(new EntityOperationBase.EntityIdUriBuilder(ENTITY_SET, assetId)); + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityOperation#setProxyData(com.microsoft.windowsazure.services.media.entityoperations.EntityProxyData) + */ + @Override + public void setProxyData(EntityProxyData proxyData) { + // Deliberately empty + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityUpdateOperation#getRequestContents() + */ + @Override + public Object getRequestContents() { + AssetType assetType = new AssetType(); + assetType.setName(name); + assetType.setAlternateId(alternateId); + return assetType; + } + + /** + * Sets new name for asset. + * + * @param name + * The new name + * @return Updater instance + */ + public Updater setName(String name) { + this.name = name; + return this; + } + + /** + * Sets new alternate id for asset. + * + * @param alternateId + * the new alternate id + * @return Updater instance + */ + public Updater setAlternateId(String alternateId) { + this.alternateId = alternateId; + return this; + } + } + + /** + * Create an operation to delete the given asset. + * + * @param assetId + * id of asset to delete + * @return the delete operation + */ + public static EntityDeleteOperation delete(String assetId) { + return new DefaultDeleteOperation(ENTITY_SET, assetId); + } + + /** + * Link content key. + * + * @param assetId + * the asset id + * @param contentKeyId + * the content key id + * @return the entity action operation + */ + public static EntityLinkOperation linkContentKey(String assetId, String contentKeyId) { + String escapedContentKeyId = null; + try { + escapedContentKeyId = URLEncoder.encode(contentKeyId, "UTF-8"); + } + catch (UnsupportedEncodingException e) { + throw new InvalidParameterException("contentKeyId"); + } + URI contentKeyUri = URI.create(String.format("ContentKeys('%s')", escapedContentKeyId)); + return new EntityLinkOperation("Assets", assetId, "ContentKeys", contentKeyUri); + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/AssetFile.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/AssetFile.java new file mode 100644 index 000000000000..b8406b208dc7 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/AssetFile.java @@ -0,0 +1,343 @@ +/* + * 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.models; + +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; + +import com.microsoft.windowsazure.services.core.ServiceException; +import com.microsoft.windowsazure.services.media.entityoperations.DefaultActionOperation; +import com.microsoft.windowsazure.services.media.entityoperations.DefaultDeleteOperation; +import com.microsoft.windowsazure.services.media.entityoperations.DefaultGetOperation; +import com.microsoft.windowsazure.services.media.entityoperations.DefaultListOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityActionOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityCreateOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityDeleteOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityGetOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityOperationBase; +import com.microsoft.windowsazure.services.media.entityoperations.EntityOperationSingleResultBase; +import com.microsoft.windowsazure.services.media.entityoperations.EntityProxyData; +import com.microsoft.windowsazure.services.media.entityoperations.EntityUpdateOperation; +import com.microsoft.windowsazure.services.media.implementation.content.AssetFileType; +import com.sun.jersey.api.client.GenericType; + +public class AssetFile { + private static final String ENTITY_SET = "Files"; + + // Prevent instantiation + private AssetFile() { + } + + public static Creator create(String parentAssetId, String name) { + return new Creator(parentAssetId, name); + } + + public static class Creator extends EntityOperationSingleResultBase implements + EntityCreateOperation { + private final String parentAssetId; + private final String name; + private String contentChecksum; + private Long contentFileSize; + private String encryptionKeyId; + private String encryptionScheme; + private String encryptionVersion; + private String initializationVector; + private Boolean isEncrypted; + private Boolean isPrimary; + private String mimeType; + + private Creator(String parentAssetId, String name) { + super(ENTITY_SET, AssetFileInfo.class); + this.parentAssetId = parentAssetId; + this.name = name; + } + + @Override + public Object getRequestContents() throws ServiceException { + AssetFileType content = new AssetFileType().setName(name).setParentAssetId(parentAssetId) + .setContentChecksum(contentChecksum).setContentFileSize(contentFileSize) + .setEncryptionKeyId(encryptionKeyId).setEncryptionScheme(encryptionScheme) + .setEncryptionVersion(encryptionVersion).setInitializationVector(initializationVector) + .setIsEncrypted(isEncrypted).setIsPrimary(isPrimary).setMimeType(mimeType); + + return content; + } + + /** + * @param contentChecksum + * the contentChecksum to set + */ + public Creator setContentChecksum(String contentChecksum) { + this.contentChecksum = contentChecksum; + return this; + } + + /** + * @param contentFileSize + * the contentFileSize to set + */ + public Creator setContentFileSize(Long contentFileSize) { + this.contentFileSize = contentFileSize; + return this; + } + + /** + * @param encryptionKeyId + * the encryptionKeyId to set + */ + public Creator setEncryptionKeyId(String encryptionKeyId) { + this.encryptionKeyId = encryptionKeyId; + return this; + } + + /** + * @param encryptionScheme + * the encryptionScheme to set + */ + public Creator setEncryptionScheme(String encryptionScheme) { + this.encryptionScheme = encryptionScheme; + return this; + } + + /** + * @param encryptionVersion + * the encryptionVersion to set + */ + public Creator setEncryptionVersion(String encryptionVersion) { + this.encryptionVersion = encryptionVersion; + return this; + } + + /** + * @param initializationVector + * the initializationVector to set + */ + public Creator setInitializationVector(String initializationVector) { + this.initializationVector = initializationVector; + return this; + } + + /** + * @param isEncrypted + * the isEncrypted to set + */ + public Creator setIsEncrypted(Boolean isEncrypted) { + this.isEncrypted = isEncrypted; + return this; + } + + /** + * @param isPrimary + * the isPrimary to set + */ + public Creator setIsPrimary(Boolean isPrimary) { + this.isPrimary = isPrimary; + return this; + } + + /** + * @param mimeType + * the mimeType to set + */ + public Creator setMimeType(String mimeType) { + this.mimeType = mimeType; + return this; + } + + } + + /** + * Call the CreateFileInfos action on the server for the given asset + * + * @param assetId + * asset to create file infos for + * @return The action operation object to pass to rest proxy. + * @throws UnsupportedEncodingException + */ + public static EntityActionOperation createFileInfos(String assetId) { + String encodedId; + try { + encodedId = URLEncoder.encode(assetId, "UTF-8"); + } + catch (UnsupportedEncodingException ex) { + // This can never happen unless JVM is broken + throw new RuntimeException(ex); + } + return new DefaultActionOperation("CreateFileInfos").addQueryParameter("assetid", "'" + encodedId + "'"); + } + + /** + * Call the service to get a single asset file entity + * + * @param assetFileId + * id of file to get + * @return the get operation to pass to rest proxy + */ + public static EntityGetOperation get(String assetFileId) { + return new DefaultGetOperation(ENTITY_SET, assetFileId, AssetFileInfo.class); + } + + /** + * Calls the service to list all files + * + * @return The list operation to pass to rest proxy. + */ + public static DefaultListOperation list() { + return new DefaultListOperation(ENTITY_SET, new GenericType>() { + }); + } + + /** + * Create an operation that will list all the AssetFiles at the given link. + * + * @param link + * Link to request AssetFiles from. + * @return The list operation. + */ + public static DefaultListOperation list(LinkInfo link) { + return new DefaultListOperation(link.getHref(), new GenericType>() { + }); + } + + public static Updater update(String assetFileId) { + return new Updater(assetFileId); + } + + public static class Updater extends EntityOperationBase implements EntityUpdateOperation { + private String contentChecksum; + private Long contentFileSize; + private String encryptionKeyId; + private String encryptionScheme; + private String encryptionVersion; + private String initializationVector; + private Boolean isEncrypted; + private Boolean isPrimary; + private String mimeType; + + private Updater(String assetFileId) { + super(new EntityOperationBase.EntityIdUriBuilder(ENTITY_SET, assetFileId)); + } + + @Override + public Object getRequestContents() { + return new AssetFileType().setContentChecksum(contentChecksum).setContentFileSize(contentFileSize) + .setEncryptionKeyId(encryptionKeyId).setEncryptionScheme(encryptionScheme) + .setEncryptionVersion(encryptionVersion).setInitializationVector(initializationVector) + .setIsEncrypted(isEncrypted).setIsPrimary(isPrimary).setMimeType(mimeType); + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityOperation#setProxyData(com.microsoft.windowsazure.services.media.entityoperations.EntityProxyData) + */ + @Override + public void setProxyData(EntityProxyData proxyData) { + // Deliberately empty + } + + /** + * @param contentChecksum + * the contentChecksum to set + */ + public Updater setContentChecksum(String contentChecksum) { + this.contentChecksum = contentChecksum; + return this; + } + + /** + * @param contentFileSize + * the contentFileSize to set + */ + public Updater setContentFileSize(Long contentFileSize) { + this.contentFileSize = contentFileSize; + return this; + } + + /** + * @param encryptionKeyId + * the encryptionKeyId to set + */ + public Updater setEncryptionKeyId(String encryptionKeyId) { + this.encryptionKeyId = encryptionKeyId; + return this; + } + + /** + * @param encryptionScheme + * the encryptionScheme to set + */ + public Updater setEncryptionScheme(String encryptionScheme) { + this.encryptionScheme = encryptionScheme; + return this; + } + + /** + * @param encryptionVersion + * the encryptionVersion to set + */ + public Updater setEncryptionVersion(String encryptionVersion) { + this.encryptionVersion = encryptionVersion; + return this; + } + + /** + * @param initializationVector + * the initializationVector to set + */ + public Updater setInitializationVector(String initializationVector) { + this.initializationVector = initializationVector; + return this; + } + + /** + * @param isEncrypted + * the isEncrypted to set + */ + public Updater setIsEncrypted(Boolean isEncrypted) { + this.isEncrypted = isEncrypted; + return this; + } + + /** + * @param isPrimary + * the isPrimary to set + */ + public Updater setIsPrimary(Boolean isPrimary) { + this.isPrimary = isPrimary; + return this; + } + + /** + * @param mimeType + * the mimeType to set + */ + public Updater setMimeType(String mimeType) { + this.mimeType = mimeType; + return this; + } + + } + + /** + * Calls the service to delete an asset file entity + * + * @param assetFileId + * file to delete + * @return the delete operation object + */ + public static EntityDeleteOperation delete(String assetFileId) { + return new DefaultDeleteOperation(ENTITY_SET, assetFileId); + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/AssetFileInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/AssetFileInfo.java new file mode 100644 index 000000000000..813b6567dfe3 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/AssetFileInfo.java @@ -0,0 +1,162 @@ +/* + * 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.models; + +import java.util.Date; + +import com.microsoft.windowsazure.services.media.implementation.ODataEntity; +import com.microsoft.windowsazure.services.media.implementation.atom.EntryType; +import com.microsoft.windowsazure.services.media.implementation.content.AssetFileType; + +/** + * The Class AssetFileInfo. + */ +public class AssetFileInfo extends ODataEntity { + + public AssetFileInfo(EntryType entry, AssetFileType content) { + super(entry, content); + } + + public AssetFileInfo() { + super(new AssetFileType()); + } + + /** + * Gets the id. + * + * @return the id + */ + public String getId() { + return this.getContent().getId(); + } + + /** + * Gets the name. + * + * @return the name + */ + public String getName() { + return this.getContent().getName(); + } + + /** + * Gets the content file size. + * + * @return the content file size + */ + public long getContentFileSize() { + return this.getContent().getContentFileSize(); + } + + /** + * Gets the parent asset id. + * + * @return the parent asset id + */ + public String getParentAssetId() { + return this.getContent().getParentAssetId(); + } + + /** + * Gets the encryption version. + * + * @return the encryption version + */ + public String getEncryptionVersion() { + return this.getContent().getEncryptionVersion(); + } + + /** + * Gets the encryption scheme. + * + * @return the encryption scheme + */ + public String getEncryptionScheme() { + return this.getContent().getEncryptionScheme(); + } + + /** + * Gets the checks if is encrypted. + * + * @return the checks if is encrypted + */ + public boolean getIsEncrypted() { + return this.getContent().getIsEncrypted(); + } + + /** + * Gets the encryption key id. + * + * @return the encryption key id + */ + public String getEncryptionKeyId() { + return this.getContent().getEncryptionKeyId(); + } + + /** + * Gets the initialization vector. + * + * @return the initialization vector + */ + public String getInitializationVector() { + return this.getContent().getInitializationVector(); + } + + /** + * Gets the checks if is primary. + * + * @return the checks if is primary + */ + public boolean getIsPrimary() { + return this.getContent().getIsPrimary(); + } + + /** + * Gets the last modified. + * + * @return the last modified + */ + public Date getLastModified() { + return this.getContent().getLastModified(); + } + + /** + * Gets the created. + * + * @return the created + */ + public Date getCreated() { + return this.getContent().getCreated(); + } + + /** + * Gets the mime type. + * + * @return the mime type + */ + public String getMimeType() { + return this.getContent().getMimeType(); + } + + /** + * Gets the content checksum. + * + * @return the content checksum + */ + public String getContentChecksum() { + return this.getContent().getContentChecksum(); + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/AssetInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/AssetInfo.java new file mode 100644 index 000000000000..6fa05aff3f10 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/AssetInfo.java @@ -0,0 +1,140 @@ +/** + * 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.models; + +import java.util.Date; + +import com.microsoft.windowsazure.services.media.implementation.ODataEntity; +import com.microsoft.windowsazure.services.media.implementation.atom.EntryType; +import com.microsoft.windowsazure.services.media.implementation.content.AssetType; + +/** + * Data about a Media Services Asset entity. + * + */ +public class AssetInfo extends ODataEntity { + + /** + * Instantiates a new asset info. + * + * @param entry + * the entry + * @param content + * the content + */ + public AssetInfo(EntryType entry, AssetType content) { + super(entry, content); + } + + /** + * Get the asset id. + * + * @return the id + */ + public String getId() { + return getContent().getId(); + } + + /** + * Get the asset name. + * + * @return the name + */ + public String getName() { + return this.getContent().getName(); + } + + /** + * Get the asset state. + * + * @return the state + */ + public AssetState getState() { + return AssetState.fromCode(getContent().getState()); + } + + /** + * Get the creation date. + * + * @return the date + */ + public Date getCreated() { + return this.getContent().getCreated(); + } + + /** + * Get last modified date. + * + * @return the date + */ + public Date getLastModified() { + return getContent().getLastModified(); + } + + /** + * Get the alternate id. + * + * @return the id + */ + public String getAlternateId() { + return getContent().getAlternateId(); + } + + /** + * Get the options. + * + * @return the options + */ + public AssetOption getOptions() { + return AssetOption.fromCode(getContent().getOptions()); + } + + /** + * Get a link to the asset's files + * + * @return the link + */ + public LinkInfo getAssetFilesLink() { + return this. getRelationLink("Files"); + } + + /** + * Get a link to the asset's content keys + * + * @return the link + */ + public LinkInfo getContentKeysLink() { + return this. getRelationLink("ContentKeys"); + } + + /** + * Get a link to the asset's locators + * + * @return the link + */ + public LinkInfo getLocatorsLink() { + return this. getRelationLink("Locators"); + } + + /** + * Get a link to this asset's parents + * + * @return the link + */ + public LinkInfo getParentAssetsLink() { + return this. getRelationLink("ParentAssets"); + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/AssetOption.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/AssetOption.java new file mode 100644 index 000000000000..8722e853ffcf --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/AssetOption.java @@ -0,0 +1,74 @@ +/* + * 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.models; + +import java.security.InvalidParameterException; + +/** + * Specifies the options for encryption. + */ +public enum AssetOption { + + /** The None. */ + None(0), + /** The Storage encrypted. */ + StorageEncrypted(1), + /** The Common encryption protected. */ + CommonEncryptionProtected(2); + + /** The encryption option code. */ + private int encryptionOptionCode; + + /** + * Instantiates a new encryption option. + * + * @param encryptionOptionCode + * the encryption option code + */ + private AssetOption(int encryptionOptionCode) { + this.encryptionOptionCode = encryptionOptionCode; + } + + /** + * Gets the code. + * + * @return the code + */ + public int getCode() { + return encryptionOptionCode; + } + + /** + * Create an AssetOption instance based on the + * given integer. + * + * @param option + * the integer value of option + * @return The AssetOption + */ + public static AssetOption fromCode(int option) { + switch (option) { + case 0: + return AssetOption.None; + case 1: + return AssetOption.StorageEncrypted; + case 2: + return AssetOption.CommonEncryptionProtected; + default: + throw new InvalidParameterException("option"); + } + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/AssetState.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/AssetState.java new file mode 100644 index 000000000000..8afc9954a8bd --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/AssetState.java @@ -0,0 +1,73 @@ +/* + * 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.models; + +import java.security.InvalidParameterException; + +/** + * Specifies the states of the asset. + */ +public enum AssetState { + + /** The Initialized. */ + Initialized(0), + /** The Published. */ + Published(1), + /** The Deleted. */ + Deleted(2); + + /** The asset state code. */ + private int assetStateCode; + + /** + * Instantiates a new asset state. + * + * @param assetStateCode + * the asset state code + */ + private AssetState(int assetStateCode) { + this.assetStateCode = assetStateCode; + } + + /** + * Gets the code. + * + * @return the code + */ + public int getCode() { + return assetStateCode; + } + + /** + * Create an AssetState instance from the corresponding int. + * + * @param state + * state as integer + * @return new AssetState instance + */ + public static AssetState fromCode(int state) { + switch (state) { + case 0: + return AssetState.Initialized; + case 1: + return AssetState.Published; + case 2: + return AssetState.Deleted; + default: + throw new InvalidParameterException("state"); + } + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/ContentKey.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/ContentKey.java new file mode 100644 index 000000000000..4d93a5e77356 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/ContentKey.java @@ -0,0 +1,216 @@ +/** + * 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.models; + +import com.microsoft.windowsazure.services.media.entityoperations.DefaultDeleteOperation; +import com.microsoft.windowsazure.services.media.entityoperations.DefaultGetOperation; +import com.microsoft.windowsazure.services.media.entityoperations.DefaultListOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityCreateOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityDeleteOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityGetOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityOperationSingleResultBase; +import com.microsoft.windowsazure.services.media.implementation.content.ContentKeyRestType; +import com.sun.jersey.api.client.GenericType; + +/** + * Class for creating operations to manipulate content key entities. + * + */ +public class ContentKey { + + /** The Constant ENTITY_SET. */ + private static final String ENTITY_SET = "ContentKeys"; + + /** + * Instantiates a new content key. + */ + private ContentKey() { + } + + /** + * Creates an operation to create a new content key. + * + * @param id + * the id + * @param contentKeyType + * the content key type + * @param encryptedContentKey + * the encrypted content key + * @return The operation + */ + public static Creator create(String id, ContentKeyType contentKeyType, String encryptedContentKey) { + return new Creator(id, contentKeyType, encryptedContentKey); + } + + /** + * The Class Creator. + */ + public static class Creator extends EntityOperationSingleResultBase implements + EntityCreateOperation { + + /** The id. */ + private final String id; + + /** The content key type. */ + private final ContentKeyType contentKeyType; + + /** The encrypted content key. */ + private final String encryptedContentKey; + + /** The name. */ + private String name; + + /** The checksum. */ + private String checksum; + + /** The protection key id. */ + private String protectionKeyId; + + /** The protection key type. */ + private ProtectionKeyType protectionKeyType; + + /** + * Instantiates a new creator. + * + * @param id + * the id + * @param contentKeyType + * the content key type + * @param encryptedContentKey + * the encrypted content key + */ + public Creator(String id, ContentKeyType contentKeyType, String encryptedContentKey) { + super(ENTITY_SET, ContentKeyInfo.class); + + this.id = id; + this.contentKeyType = contentKeyType; + this.encryptedContentKey = encryptedContentKey; + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityCreateOperation#getRequestContents() + */ + @Override + public Object getRequestContents() { + ContentKeyRestType contentKeyRestType = new ContentKeyRestType(); + contentKeyRestType.setId(id); + if (contentKeyType != null) { + contentKeyRestType.setContentKeyType(contentKeyType.getCode()); + } + if (protectionKeyType != null) { + contentKeyRestType.setProtectionKeyType(protectionKeyType.getCode()); + } + contentKeyRestType.setEncryptedContentKey(encryptedContentKey); + contentKeyRestType.setName(name); + contentKeyRestType.setChecksum(checksum); + contentKeyRestType.setProtectionKeyId(protectionKeyId); + return contentKeyRestType; + } + + /** + * Sets the name. + * + * @param name + * the name + * @return the creator + */ + public Creator setName(String name) { + this.name = name; + return this; + } + + /** + * Sets the checksum. + * + * @param checksum + * the checksum + * @return the creator + */ + public Creator setChecksum(String checksum) { + this.checksum = checksum; + return this; + } + + /** + * Sets the protection key id. + * + * @param protectionKeyId + * the protection key id + * @return the creator + */ + public Creator setProtectionKeyId(String protectionKeyId) { + this.protectionKeyId = protectionKeyId; + return this; + } + + /** + * Sets the protection key type. + * + * @param protectionKeyType + * the protection key type + * @return the creator + */ + public Creator setProtectionKeyType(ProtectionKeyType protectionKeyType) { + this.protectionKeyType = protectionKeyType; + return this; + } + } + + /** + * Create an operation that will retrieve the given content key. + * + * @param ContentKeyId + * id of content key to retrieve + * @return the operation + */ + public static EntityGetOperation get(String contentKeyId) { + return new DefaultGetOperation(ENTITY_SET, contentKeyId, ContentKeyInfo.class); + } + + /** + * Create an operation that will retrieve all access policies. + * + * @return the operation + */ + public static DefaultListOperation list() { + return new DefaultListOperation(ENTITY_SET, new GenericType>() { + }); + } + + /** + * Create an operation that will list all the content keys at the given link. + * + * @param link + * Link to request content keys from. + * @return The list operation. + */ + public static DefaultListOperation list(LinkInfo link) { + return new DefaultListOperation(link.getHref(), new GenericType>() { + }); + } + + /** + * Create an operation to delete the given content key. + * + * @param ContentKeyId + * id of content key to delete + * @return the delete operation + */ + public static EntityDeleteOperation delete(String contentKeyId) { + return new DefaultDeleteOperation(ENTITY_SET, contentKeyId); + } + +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/ContentKeyInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/ContentKeyInfo.java new file mode 100644 index 000000000000..33e018dc1674 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/ContentKeyInfo.java @@ -0,0 +1,126 @@ +/* + * 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.models; + +import java.util.Date; + +import com.microsoft.windowsazure.services.media.implementation.ODataEntity; +import com.microsoft.windowsazure.services.media.implementation.atom.EntryType; +import com.microsoft.windowsazure.services.media.implementation.content.ContentKeyRestType; + +/** + * The Class ContentKeyInfo. + */ +public class ContentKeyInfo extends ODataEntity { + + /** + * Instantiates a new content key info. + * + * @param entry + * the entry + * @param content + * the content + */ + public ContentKeyInfo(EntryType entry, ContentKeyRestType content) { + super(entry, content); + } + + /** + * Gets the id. + * + * @return the id + */ + public String getId() { + return getContent().getId(); + } + + /** + * Gets the created. + * + * @return the created + */ + public Date getCreated() { + return getContent().getCreated(); + } + + /** + * Gets the last modified. + * + * @return the last modified + */ + public Date getLastModified() { + return getContent().getLastModified(); + } + + /** + * Gets the name. + * + * @return the name + */ + public String getName() { + return getContent().getName(); + } + + /** + * Gets the check sum. + * + * @return the check sum + */ + public String getChecksum() { + return getContent().getChecksum(); + } + + /** + * Gets the protection key type. + * + * @return the protection key type + */ + public ProtectionKeyType getProtectionKeyType() { + return ProtectionKeyType.fromCode(getContent().getProtectionKeyType()); + } + + /** + * Gets the protection key id. + * + * @return the protection key id + */ + public String getProtectionKeyId() { + return getContent().getProtectionKeyId(); + } + + /** + * Gets the encrypted content key. + * + * @return the encrypted content key + */ + public String getEncryptedContentKey() { + return getContent().getEncryptedContentKey(); + } + + /** + * Gets the content key type. + * + * @return the content key type + */ + public ContentKeyType getContentKeyType() { + Integer contentKeyTypeInteger = getContent().getContentKeyType(); + ContentKeyType contentKeyType = null; + if (contentKeyTypeInteger != null) { + contentKeyType = ContentKeyType.fromCode(contentKeyTypeInteger); + } + return contentKeyType; + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/ContentKeyType.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/ContentKeyType.java new file mode 100644 index 000000000000..6015424f6e6b --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/ContentKeyType.java @@ -0,0 +1,75 @@ +/* + * 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.models; + +import java.security.InvalidParameterException; + +/** + * + * Specifies the type of a content key. + * + */ +public enum ContentKeyType { + + /** The Common encryption. */ + CommonEncryption(0), + /** The Storage encryption. */ + StorageEncryption(1), + /** The Configuration encryption. */ + ConfigurationEncryption(2); + + /** The content key type code. */ + private int contentKeyTypeCode; + + /** + * Instantiates a new content key type. + * + * @param contentKeyTypeCode + * the content key type code + */ + private ContentKeyType(int contentKeyTypeCode) { + this.contentKeyTypeCode = contentKeyTypeCode; + } + + /** + * Gets the code. + * + * @return the code + */ + public int getCode() { + return contentKeyTypeCode; + } + + /** + * From code. + * + * @param code + * the code + * @return the content key type + */ + public static ContentKeyType fromCode(int code) { + switch (code) { + case 0: + return ContentKeyType.CommonEncryption; + case 1: + return ContentKeyType.StorageEncryption; + case 2: + return ContentKeyType.ConfigurationEncryption; + default: + throw new InvalidParameterException("code"); + } + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/ErrorDetail.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/ErrorDetail.java new file mode 100644 index 000000000000..7d3b9344bdf6 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/ErrorDetail.java @@ -0,0 +1,59 @@ +/* + * 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.models; + +/** + * The Class ErrorDetail. + */ +public class ErrorDetail { + + /** The code. */ + private final String code; + + /** The message. */ + private final String message; + + /** + * Instantiates a new error detail. + * + * @param code + * the code + * @param message + * the message + */ + public ErrorDetail(String code, String message) { + this.code = code; + this.message = message; + } + + /** + * Gets the code. + * + * @return the code + */ + public String getCode() { + return this.code; + } + + /** + * Gets the message. + * + * @return the message + */ + public String getMessage() { + return this.message; + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/Job.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/Job.java new file mode 100644 index 000000000000..ca7bf086105a --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/Job.java @@ -0,0 +1,422 @@ +/** + * 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.models; + +import java.io.IOException; +import java.net.URI; +import java.util.ArrayList; +import java.util.List; + +import javax.mail.MessagingException; +import javax.mail.internet.MimeMultipart; +import javax.ws.rs.core.MediaType; +import javax.xml.bind.JAXBException; +import javax.xml.parsers.ParserConfigurationException; + +import com.microsoft.windowsazure.services.core.ServiceException; +import com.microsoft.windowsazure.services.media.entityoperations.DefaultActionOperation; +import com.microsoft.windowsazure.services.media.entityoperations.DefaultDeleteOperation; +import com.microsoft.windowsazure.services.media.entityoperations.DefaultGetOperation; +import com.microsoft.windowsazure.services.media.entityoperations.DefaultListOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityActionOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityBatchOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityCreateOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityDeleteOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityGetOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityOperationSingleResultBase; +import com.microsoft.windowsazure.services.media.implementation.MediaBatchOperations; +import com.microsoft.windowsazure.services.media.implementation.content.JobType; +import com.sun.jersey.api.client.ClientResponse; +import com.sun.jersey.api.client.GenericType; + +/** + * Class for creating operations to manipulate Job entities. + * + */ +public class Job { + + /** The Constant ENTITY_SET. */ + private static final String ENTITY_SET = "Jobs"; + + // Prevent instantiation + /** + * Instantiates a new job. + */ + private Job() { + } + + /** + * Creates an operation to create a new job. + * + * @return the creator + */ + public static Creator create() { + return new Creator(); + } + + /** + * The Class Creator. + */ + public static class Creator extends EntityOperationSingleResultBase implements + EntityCreateOperation { + + /** The name. */ + private String name; + + /** The priority. */ + private Integer priority; + + /** The input media assets. */ + private final List inputMediaAssets; + + /** The content type. */ + private MediaType contentType; + + /** The task create batch operations. */ + private final List taskCreateBatchOperations; + + /** The fresh. */ + private Boolean fresh; + + /** The mime multipart. */ + private MimeMultipart mimeMultipart;; + + /** The media batch operations. */ + private MediaBatchOperations mediaBatchOperations; + + /** + * Builds the mime multipart. + * + * @throws ServiceException + * the service exception + */ + private void buildMimeMultipart(URI serviceUri) { + mediaBatchOperations = null; + CreateBatchOperation createJobBatchOperation = CreateBatchOperation.create(serviceUri, this); + + try { + mediaBatchOperations = new MediaBatchOperations(serviceUri); + } + catch (JAXBException e) { + throw new RuntimeException(e); + } + catch (ParserConfigurationException e) { + throw new RuntimeException(e); + } + + mediaBatchOperations.addOperation(createJobBatchOperation); + for (Task.CreateBatchOperation taskCreateBatchOperation : taskCreateBatchOperations) { + mediaBatchOperations.addOperation(taskCreateBatchOperation); + } + + try { + mimeMultipart = mediaBatchOperations.getMimeMultipart(); + } + catch (MessagingException e) { + throw new RuntimeException(e); + } + catch (IOException e) { + throw new RuntimeException(e); + } + catch (JAXBException e) { + throw new RuntimeException(e); + } + + this.contentType = mediaBatchOperations.getContentType(); + this.fresh = false; + } + + /** + * Instantiates a new creator. + * + */ + public Creator() { + super(ENTITY_SET, JobInfo.class); + this.inputMediaAssets = new ArrayList(); + this.taskCreateBatchOperations = new ArrayList(); + this.fresh = true; + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityCreateOperation#getRequestContents() + */ + @Override + public Object getRequestContents() throws ServiceException { + if (fresh) { + buildMimeMultipart(getProxyData().getServiceUri()); + } + return mimeMultipart; + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityOperationSingleResultBase#getResponseClass() + */ + @SuppressWarnings({ "unchecked", "rawtypes" }) + @Override + public Class getResponseClass() { + return ClientResponse.class; + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityCreateOperation#processResponse(java.lang.Object) + */ + @Override + public Object processResponse(Object clientResponse) throws ServiceException { + try { + this.mediaBatchOperations.parseBatchResult((ClientResponse) clientResponse); + } + catch (IOException e) { + throw new ServiceException(e); + } + JobInfo jobInfo = null; + for (EntityBatchOperation entityBatchOperation : this.mediaBatchOperations.getOperations()) { + if (entityBatchOperation instanceof Job.CreateBatchOperation) { + jobInfo = ((Job.CreateBatchOperation) entityBatchOperation).getJobInfo(); + break; + } + } + return jobInfo; + + } + + /** + * Adds the task creator. + * + * @param taskCreateBatchOperation + * the task create batch operation + * @return the creator + */ + public Creator addTaskCreator(Task.CreateBatchOperation taskCreateBatchOperation) { + this.taskCreateBatchOperations.add(taskCreateBatchOperation); + this.fresh = true; + return this; + } + + /** + * Set the name of the job to be created. + * + * @param name + * The name + * @return The creator object (for call chaining) + */ + public Creator setName(String name) { + this.name = name; + this.fresh = true; + return this; + } + + /** + * Gets the name. + * + * @return the name + */ + public String getName() { + return this.name; + } + + /** + * Sets the priority. + * + * @param priority + * the priority + * @return the creator + */ + public Creator setPriority(Integer priority) { + this.priority = priority; + this.fresh = true; + return this; + } + + /** + * Gets the priority. + * + * @return the priority + */ + public Integer getPriority() { + return this.priority; + } + + /** + * Gets the input media assets. + * + * @return the input media assets + */ + public List getInputMediaAssets() { + return inputMediaAssets; + } + + /** + * Gets the task creators. + * + * @return the task creators + */ + public List getTaskCreators() { + return this.taskCreateBatchOperations; + } + + /** + * Adds the input media asset. + * + * @param assetId + * the asset id + * @return the creator + */ + public Creator addInputMediaAsset(String assetId) { + this.inputMediaAssets.add(assetId); + this.fresh = true; + return this; + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityOperationBase#getContentType() + */ + @Override + public MediaType getContentType() { + if (fresh) { + buildMimeMultipart(getProxyData().getServiceUri()); + } + return this.contentType; + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityOperationBase#getUri() + */ + @Override + public String getUri() { + return "$batch"; + } + } + + /** + * The Class CreateBatchOperation. + */ + public static class CreateBatchOperation extends EntityBatchOperation { + + /** The service uri. */ + private final URI serviceUri; + + /** The job info. */ + private JobInfo jobInfo; + + /** + * Instantiates a new creates the batch operation. + * + * @param serviceUri + * the service uri + */ + public CreateBatchOperation(URI serviceUri) { + this.serviceUri = serviceUri; + this.verb = "POST"; + } + + /** + * Creates the. + * + * @param creator + * the creator + * @return the creates the batch operation + */ + public static CreateBatchOperation create(URI serviceUri, Creator creator) { + CreateBatchOperation createBatchOperation = new CreateBatchOperation(serviceUri); + + JobType jobType = new JobType(); + jobType.setName(creator.getName()); + jobType.setPriority(creator.getPriority()); + + for (String inputMediaAsset : creator.getInputMediaAssets()) { + createBatchOperation.addLink("InputMediaAssets", String.format("%s/Assets('%s')", createBatchOperation + .getServiceUri().toString(), inputMediaAsset.toString()), "application/atom+xml;type=feed", + "http://schemas.microsoft.com/ado/2007/08/dataservices/related/InputMediaAssets"); + } + createBatchOperation.addContentObject(jobType); + return createBatchOperation; + } + + /** + * Gets the service uri. + * + * @return the service uri + */ + public URI getServiceUri() { + return this.serviceUri; + } + + /** + * Sets the job info. + * + * @param jobInfo + * the job info + * @return the creates the batch operation + */ + public CreateBatchOperation setJobInfo(JobInfo jobInfo) { + this.jobInfo = jobInfo; + return this; + } + + /** + * Gets the job info. + * + * @return the job info + */ + public JobInfo getJobInfo() { + return this.jobInfo; + } + + } + + /** + * Create an operation object that will get the state of the given job. + * + * @param jobId + * id of job to retrieve + * @return the get operation + */ + public static EntityGetOperation get(String jobId) { + return new DefaultGetOperation(ENTITY_SET, jobId, JobInfo.class); + } + + /** + * Create an operation that will list all the jobs. + * + * @return The list operation + */ + public static DefaultListOperation list() { + return new DefaultListOperation(ENTITY_SET, new GenericType>() { + }); + } + + /** + * Create an operation to delete the given job. + * + * @param jobId + * id of job to delete + * @return the delete operation + */ + public static EntityDeleteOperation delete(String jobId) { + return new DefaultDeleteOperation(ENTITY_SET, jobId); + } + + /** + * Cancel. + * + * @param jobId + * the job id + * @return the entity action operation + */ + public static EntityActionOperation cancel(String jobId) { + return new DefaultActionOperation("CancelJob").addQueryParameter("jobId", String.format("'%s'", jobId)); + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/JobInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/JobInfo.java new file mode 100644 index 000000000000..ba723e01f25c --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/JobInfo.java @@ -0,0 +1,157 @@ +/** + * 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.models; + +import java.util.Date; + +import com.microsoft.windowsazure.services.media.implementation.ODataEntity; +import com.microsoft.windowsazure.services.media.implementation.atom.EntryType; +import com.microsoft.windowsazure.services.media.implementation.content.JobType; + +/** + * The Class JobInfo. + */ +public class JobInfo extends ODataEntity { + + /** + * Instantiates a new job info. + * + * @param entry + * the entry + * @param content + * the content + */ + public JobInfo(EntryType entry, JobType content) { + super(entry, content); + } + + /** + * Gets the id. + * + * @return the id + */ + public String getId() { + return getContent().getId(); + } + + /** + * Gets the name. + * + * @return the name + */ + public String getName() { + return getContent().getName(); + } + + /** + * Gets the created. + * + * @return the created + */ + public Date getCreated() { + return getContent().getCreated(); + } + + /** + * Gets the last modified. + * + * @return the last modified + */ + public Date getLastModified() { + return getContent().getLastModified(); + } + + /** + * Gets the end time. + * + * @return the end time + */ + public Date getEndTime() { + return getContent().getEndTime(); + } + + /** + * Gets the priority. + * + * @return the priority + */ + public int getPriority() { + return getContent().getPriority(); + } + + /** + * Gets the running duration. + * + * @return the running duration + */ + public double getRunningDuration() { + return getContent().getRunningDuration(); + } + + /** + * Gets the start time. + * + * @return the start time + */ + public Date getStartTime() { + return getContent().getStartTime(); + } + + /** + * Gets the state. + * + * @return the state + */ + public JobState getState() { + return JobState.fromCode(getContent().getState()); + } + + /** + * Gets the template id. + * + * @return the template id + */ + public String getTemplateId() { + return getContent().getTemplateId(); + } + + /** + * Get a link which, when listed, will return the input assets for the job. + * + * @return Link if found, null if not. + */ + public LinkInfo getInputAssetsLink() { + return this. getRelationLink("InputMediaAssets"); + } + + /** + * Get a link which, when listed, will return the output assets for the job. + * + * @return Link if found, null if not. + */ + public LinkInfo getOutputAssetsLink() { + return this. getRelationLink("OutputMediaAssets"); + } + + /** + * Gets the tasks link. + * + * @return the tasks link + */ + public LinkInfo getTasksLink() { + return this. getRelationLink("Tasks"); + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/JobState.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/JobState.java new file mode 100644 index 000000000000..b7bce6a0b273 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/JobState.java @@ -0,0 +1,94 @@ +/** + * 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.models; + +import java.security.InvalidParameterException; + +/** + * The Enum JobState. + */ +public enum JobState { + /** The Queued. */ + Queued(0), + + /** The Scheduled. */ + Scheduled(1), + + /** The Processing. */ + Processing(2), + + /** The Finished. */ + Finished(3), + + /** The Error. */ + Error(4), + + /** The Canceled. */ + Canceled(5), + + /** The Canceling. */ + Canceling(6); + + /** The job state code. */ + private int jobStateCode; + + /** + * Instantiates a new job state. + * + * @param jobStateCode + * the job state code + */ + private JobState(int jobStateCode) { + this.jobStateCode = jobStateCode; + } + + /** + * Gets the code. + * + * @return the code + */ + public int getCode() { + return this.jobStateCode; + } + + /** + * From code. + * + * @param jobStateCode + * the job state code + * @return the job state + */ + public static JobState fromCode(int jobStateCode) { + switch (jobStateCode) { + case 0: + return JobState.Queued; + case 1: + return JobState.Scheduled; + case 2: + return JobState.Processing; + case 3: + return JobState.Finished; + case 4: + return JobState.Error; + case 5: + return JobState.Canceled; + case 6: + return JobState.Canceling; + default: + throw new InvalidParameterException("jobStateCode"); + } + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/LinkInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/LinkInfo.java new file mode 100644 index 000000000000..7ffac5539bb0 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/LinkInfo.java @@ -0,0 +1,43 @@ +/** + * 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.models; + +import com.microsoft.windowsazure.services.media.implementation.ODataEntity; +import com.microsoft.windowsazure.services.media.implementation.atom.LinkType; + +/** + * Provides access to OData links + * + */ +public class LinkInfo> { + private final LinkType rawLink; + + /** + * Construct a new {@link LinkInfo} instance + */ + public LinkInfo(LinkType rawLink) { + this.rawLink = rawLink; + } + + /** + * Get link href + * + * @return the href + */ + public String getHref() { + return rawLink.getHref(); + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/ListResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/ListResult.java new file mode 100644 index 000000000000..c60001afd701 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/ListResult.java @@ -0,0 +1,152 @@ +/** + * 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.models; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.ListIterator; + +/** + * Wrapper class for all returned lists from Media Services + * + */ +public class ListResult implements List { + + private final List contents; + + public ListResult(Collection contentList) { + contents = Collections.unmodifiableList(new ArrayList(contentList)); + } + + @Override + public boolean add(T element) { + return contents.add(element); + } + + @Override + public void add(int index, T element) { + contents.add(index, element); + } + + @Override + public boolean addAll(Collection c) { + return contents.addAll(c); + } + + @Override + public boolean addAll(int index, Collection c) { + return contents.addAll(index, c); + } + + @Override + public void clear() { + contents.clear(); + } + + @Override + public boolean contains(Object object) { + return contents.contains(object); + } + + @Override + public boolean containsAll(Collection c) { + return contents.containsAll(c); + } + + @Override + public T get(int index) { + return contents.get(index); + } + + @Override + public int indexOf(Object object) { + return contents.indexOf(object); + } + + @Override + public boolean isEmpty() { + return contents.isEmpty(); + } + + @Override + public Iterator iterator() { + return contents.iterator(); + } + + @Override + public int lastIndexOf(Object object) { + return contents.lastIndexOf(object); + } + + @Override + public ListIterator listIterator() { + return contents.listIterator(); + } + + @Override + public ListIterator listIterator(int index) { + return contents.listIterator(index); + + } + + @Override + public boolean remove(Object o) { + return contents.remove(o); + } + + @Override + public T remove(int index) { + return contents.remove(index); + } + + @Override + public boolean removeAll(Collection c) { + return contents.removeAll(c); + } + + @Override + public boolean retainAll(Collection c) { + return contents.retainAll(c); + } + + @Override + public T set(int index, T element) { + return contents.set(index, element); + } + + @Override + public int size() { + return contents.size(); + } + + @Override + public List subList(int fromIndex, int toIndex) { + return contents.subList(fromIndex, toIndex); + } + + @Override + public Object[] toArray() { + return contents.toArray(); + } + + @Override + public U[] toArray(U[] a) { + return contents.toArray(a); + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/Locator.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/Locator.java new file mode 100644 index 000000000000..a565db206d7a --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/Locator.java @@ -0,0 +1,280 @@ +/** + * 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.models; + +import java.util.Date; + +import com.microsoft.windowsazure.services.media.entityoperations.DefaultDeleteOperation; +import com.microsoft.windowsazure.services.media.entityoperations.DefaultGetOperation; +import com.microsoft.windowsazure.services.media.entityoperations.DefaultListOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityCreateOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityDeleteOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityGetOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityOperationBase; +import com.microsoft.windowsazure.services.media.entityoperations.EntityOperationSingleResultBase; +import com.microsoft.windowsazure.services.media.entityoperations.EntityProxyData; +import com.microsoft.windowsazure.services.media.entityoperations.EntityUpdateOperation; +import com.microsoft.windowsazure.services.media.implementation.content.LocatorRestType; +import com.sun.jersey.api.client.GenericType; + +/** + * Implementation of Locator entity. + */ +public class Locator { + + /** The Constant ENTITY_SET. */ + private final static String ENTITY_SET = "Locators"; + + /** + * Instantiates a new locator. + */ + private Locator() { + } + + /** + * Create an operation to create a new locator entity. + * + * @param accessPolicyId + * id of access policy for locator + * @param assetId + * id of asset for locator + * @param locatorType + * locator type + * @return the operation + */ + public static Creator create(String accessPolicyId, String assetId, LocatorType locatorType) { + return new Creator(accessPolicyId, assetId, locatorType); + } + + /** + * The Class Creator. + */ + public static class Creator extends EntityOperationSingleResultBase implements + EntityCreateOperation { + + /** The access policy id. */ + private final String accessPolicyId; + + /** The asset id. */ + private final String assetId; + + /** The base uri. */ + private String baseUri; + + /** The content access token. */ + private String contentAccessComponent; + + /** The locator type. */ + private final LocatorType locatorType; + + /** The path. */ + private String path; + + /** The start date time. */ + private Date startDateTime; + + /** The id. */ + private String id; + + /** + * Instantiates a new creator. + * + * @param accessPolicyId + * the access policy id + * @param assetId + * the asset id + * @param locatorType + * the locator type + */ + protected Creator(String accessPolicyId, String assetId, LocatorType locatorType) { + super(ENTITY_SET, LocatorInfo.class); + this.accessPolicyId = accessPolicyId; + this.assetId = assetId; + this.locatorType = locatorType; + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityCreateOperation#getRequestContents() + */ + @Override + public Object getRequestContents() { + return new LocatorRestType().setId(id).setAccessPolicyId(accessPolicyId).setAssetId(assetId) + .setStartTime(startDateTime).setType(locatorType.getCode()).setBaseUri(baseUri) + .setContentAccessComponent(contentAccessComponent).setPath(path); + } + + /** + * Sets the base uri. + * + * @param baseUri + * the base uri + * @return the creator + */ + public Creator setBaseUri(String baseUri) { + this.baseUri = baseUri; + return this; + } + + /** + * Sets the path. + * + * @param path + * the path + * @return the creator + */ + public Creator setPath(String path) { + this.path = path; + return this; + } + + /** + * Set the date and time for when the locator starts to be available. + * + * @param startDateTime + * The date/time + * @return The creator instance (for function chaining) + */ + public Creator setStartDateTime(Date startDateTime) { + this.startDateTime = startDateTime; + return this; + } + + /** + * Sets the content access component. + * + * @param contentAccessComponent + * the content access component + * @return The creator instance + */ + public Creator setContentAccessComponent(String contentAccessComponent) { + this.contentAccessComponent = contentAccessComponent; + return this; + } + + /** + * Sets the id. + * + * @param id + * the id + * @return the entity creation operation + */ + public EntityCreateOperation setId(String id) { + this.id = id; + return this; + } + } + + /** + * Create an operation to get the given locator. + * + * @param locatorId + * id of locator to retrieve + * @return the get operation + */ + public static EntityGetOperation get(String locatorId) { + return new DefaultGetOperation(ENTITY_SET, locatorId, LocatorInfo.class); + } + + /** + * Create an operation to list all locators. + * + * @return the list operation + */ + public static DefaultListOperation list() { + return new DefaultListOperation(ENTITY_SET, new GenericType>() { + }); + } + + /** + * Create an operation that will list all the locators at the given link. + * + * @param link + * Link to request locators from. + * @return The list operation. + */ + public static DefaultListOperation list(LinkInfo link) { + return new DefaultListOperation(link.getHref(), new GenericType>() { + }); + } + + /** + * Create an operation to update the given locator. + * + * @param locatorId + * id of locator to update + * @return the update operation + */ + public static Updater update(String locatorId) { + return new Updater(locatorId); + } + + /** + * The Class Updater. + */ + public static class Updater extends EntityOperationBase implements EntityUpdateOperation { + + /** The start date time. */ + private Date startDateTime; + + /** + * Instantiates a new updater. + * + * @param locatorId + * the locator id + */ + public Updater(String locatorId) { + super(new EntityOperationBase.EntityIdUriBuilder(ENTITY_SET, locatorId)); + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityUpdateOperation#getRequestContents() + */ + @Override + public Object getRequestContents() { + return new LocatorRestType().setStartTime(startDateTime); + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.EntityOperation#setProxyData(com.microsoft.windowsazure.services.media.entityoperations.EntityProxyData) + */ + @Override + public void setProxyData(EntityProxyData proxyData) { + // Deliberately empty + } + + /** + * Set when the locator will become available. + * + * @param startDateTime + * the date & time + * @return Updater instance + */ + public Updater setStartDateTime(Date startDateTime) { + this.startDateTime = startDateTime; + return this; + } + } + + /** + * Create an operation to delete the given locator. + * + * @param locatorId + * id of locator to delete + * @return the operation + */ + public static EntityDeleteOperation delete(String locatorId) { + return new DefaultDeleteOperation(ENTITY_SET, locatorId); + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/LocatorInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/LocatorInfo.java new file mode 100644 index 000000000000..79b6775bcb60 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/LocatorInfo.java @@ -0,0 +1,139 @@ +/* + * 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.models; + +import java.util.Date; + +import com.microsoft.windowsazure.services.media.implementation.ODataEntity; +import com.microsoft.windowsazure.services.media.implementation.atom.EntryType; +import com.microsoft.windowsazure.services.media.implementation.content.LocatorRestType; + +/** + * The Class LocatorInfo. + */ +public class LocatorInfo extends ODataEntity { + + /** + * Instantiates a new locator info. + * + * @param entry + * the entry + * @param content + * the content + */ + public LocatorInfo(EntryType entry, LocatorRestType content) { + super(entry, content); + } + + /** + * Gets the id. + * + * @return the id + */ + public String getId() { + return getContent().getId(); + } + + /** + * Gets the expiration date time. + * + * @return the expiration date time + */ + public Date getExpirationDateTime() { + return getContent().getExpirationDateTime(); + } + + /** + * Gets the locator type. + * + * @return the locator type + */ + public LocatorType getLocatorType() { + return LocatorType.fromCode(getContent().getType()); + } + + /** + * Gets the path. + * + * @return the path + */ + public String getPath() { + return getContent().getPath(); + } + + /** + * Gets the access policy id. + * + * @return the access policy id + */ + public String getAccessPolicyId() { + return getContent().getAccessPolicyId(); + } + + /** + * Gets the asset id. + * + * @return the asset id + */ + public String getAssetId() { + return getContent().getAssetId(); + } + + /** + * Gets the start time. + * + * @return the start time + */ + public Date getStartTime() { + return getContent().getStartTime(); + } + + /** + * Gets the base uri. + * + * @return the base uri + */ + public String getBaseUri() { + return getContent().getBaseUri(); + } + + /** + * Gets the content access token. + * + * @return the content access token + */ + public String getContentAccessToken() { + return this.getContent().getContentAccessComponent(); + } + + /** + * Return a link that gets this locator's access policy + * + * @return the link + */ + public LinkInfo getAccessPolicyLink() { + return this. getRelationLink("AccessPolicy"); + } + + /** + * Return a link that gets this locator's asset + * + * @return the link + */ + public LinkInfo getAssetLink() { + return this. getRelationLink("Asset"); + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/LocatorType.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/LocatorType.java new file mode 100644 index 000000000000..d8ade5d01c4b --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/LocatorType.java @@ -0,0 +1,73 @@ +/** + * 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.models; + +import java.security.InvalidParameterException; + +/** + * The Enum LocatorType. + */ +public enum LocatorType { + + /** The None. */ + None(0), + /** The sas. */ + SAS(1), + /** The Origin. */ + OnDemandOrigin(2); + + /** The locator type code. */ + private int locatorTypeCode; + + /** + * Instantiates a new locator type. + * + * @param locatorTypeCode + * the locator type code + */ + private LocatorType(int locatorTypeCode) { + this.locatorTypeCode = locatorTypeCode; + } + + /** + * Gets the code. + * + * @return the code + */ + public int getCode() { + return this.locatorTypeCode; + } + + /** + * From code. + * + * @param type + * the type + * @return the locator type + */ + public static LocatorType fromCode(int type) { + switch (type) { + case 0: + return LocatorType.None; + case 1: + return LocatorType.SAS; + case 2: + return LocatorType.OnDemandOrigin; + default: + throw new InvalidParameterException("type"); + } + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/MediaProcessor.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/MediaProcessor.java new file mode 100644 index 000000000000..9be60e4ee3bd --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/MediaProcessor.java @@ -0,0 +1,43 @@ +/** + * 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.models; + +import com.microsoft.windowsazure.services.media.entityoperations.DefaultListOperation; +import com.sun.jersey.api.client.GenericType; + +/** + * Entity operations for Media processors + * + */ +public class MediaProcessor { + + private static final String ENTITY_SET = "MediaProcessors"; + + private MediaProcessor() { + } + + /** + * Create an operation to list all Media processors + * + * @return the list operation + */ + public static DefaultListOperation list() { + return new DefaultListOperation(ENTITY_SET, + new GenericType>() { + }); + } + +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/MediaProcessorInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/MediaProcessorInfo.java new file mode 100644 index 000000000000..9f3a0df22bcb --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/MediaProcessorInfo.java @@ -0,0 +1,93 @@ +/** + * 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.models; + +import com.microsoft.windowsazure.services.media.implementation.ODataEntity; +import com.microsoft.windowsazure.services.media.implementation.atom.EntryType; +import com.microsoft.windowsazure.services.media.implementation.content.MediaProcessorType; + +/** + * Data about a Media Processor entity. + * + */ +public class MediaProcessorInfo extends ODataEntity { + + /** + * Instantiates a new media processor info. + * + * @param entry + * the entry + * @param content + * the content + */ + public MediaProcessorInfo(EntryType entry, MediaProcessorType content) { + super(entry, content); + } + + /** + * Get the asset id. + * + * @return the id + */ + public String getId() { + return getContent().getId(); + } + + /** + * Get the asset name. + * + * @return the name + */ + public String getName() { + return this.getContent().getName(); + } + + /** + * Gets the description. + * + * @return the description + */ + public String getDescription() { + return this.getContent().getDescription(); + } + + /** + * Gets the sku. + * + * @return the sku + */ + public String getSku() { + return this.getContent().getSku(); + } + + /** + * Gets the vendor. + * + * @return the vendor + */ + public String getVendor() { + return this.getContent().getVendor(); + } + + /** + * Gets the version. + * + * @return the version + */ + public String getVersion() { + return this.getContent().getVersion(); + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/ProtectionKey.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/ProtectionKey.java new file mode 100644 index 000000000000..7b9a6bb15d1c --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/ProtectionKey.java @@ -0,0 +1,205 @@ +/** + * 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.models; + +import java.io.InputStream; + +import javax.ws.rs.core.MediaType; +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBElement; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Unmarshaller; +import javax.xml.transform.stream.StreamSource; + +import com.microsoft.windowsazure.services.core.utils.pipeline.PipelineHelpers; +import com.microsoft.windowsazure.services.media.entityoperations.DefaultEntityTypeActionOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityTypeActionOperation; +import com.microsoft.windowsazure.services.media.implementation.content.ProtectionKeyIdType; +import com.microsoft.windowsazure.services.media.implementation.content.ProtectionKeyRestType; +import com.sun.jersey.api.client.ClientResponse; + +/** + * Class for creating operations to manipulate protection key pseudo-entities. + * + */ +public class ProtectionKey { + + /** + * Gets the protection key id. + * + * @param contentKeyType + * the content key type + * @return the protection key id + */ + public static EntityTypeActionOperation getProtectionKeyId(ContentKeyType contentKeyType) { + return new GetProtectionKeyIdActionOperation("GetProtectionKeyId").addQueryParameter("contentKeyType", + String.format("%d", contentKeyType.getCode())).setAcceptType(MediaType.APPLICATION_XML_TYPE); + } + + /** + * Gets the protection key. + * + * @param protectionKeyId + * the protection key id + * @return the protection key + */ + public static EntityTypeActionOperation getProtectionKey(String protectionKeyId) { + return new GetProtectionKeyActionOperation("GetProtectionKey").addQueryParameter("ProtectionKeyId", + String.format("'%s'", protectionKeyId)).setAcceptType(MediaType.APPLICATION_XML_TYPE); + } + + /** + * The Class GetProtectionKeyIdActionOperation. + * + * @param + */ + private static class GetProtectionKeyIdActionOperation extends DefaultEntityTypeActionOperation { + + /** The jaxb context. */ + private final JAXBContext jaxbContext; + + /** The unmarshaller. */ + private final Unmarshaller unmarshaller; + + /** + * Instantiates a new gets the protection key id action operation. + * + * @param name + * the name + */ + public GetProtectionKeyIdActionOperation(String name) { + super(name); + try { + jaxbContext = JAXBContext.newInstance(ProtectionKeyIdType.class); + } + catch (JAXBException e) { + throw new RuntimeException(e); + } + + try { + unmarshaller = jaxbContext.createUnmarshaller(); + } + catch (JAXBException e) { + throw new RuntimeException(e); + } + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.DefaultActionOperation#processResponse(com.sun.jersey.api.client.ClientResponse) + */ + @Override + public String processTypeResponse(ClientResponse clientResponse) { + PipelineHelpers.ThrowIfNotSuccess(clientResponse); + ProtectionKeyIdType protectionKeyIdType; + try { + protectionKeyIdType = parseResponse(clientResponse); + } + catch (JAXBException e) { + throw new RuntimeException(e); + } + + return protectionKeyIdType.getProtectionKeyId(); + } + + /** + * Parses the response. + * + * @param clientResponse + * the client response + * @return the protection key id type + * @throws JAXBException + * the jAXB exception + */ + private ProtectionKeyIdType parseResponse(ClientResponse clientResponse) throws JAXBException { + + InputStream inputStream = clientResponse.getEntityInputStream(); + JAXBElement protectionKeyIdTypeJaxbElement = unmarshaller.unmarshal(new StreamSource( + inputStream), ProtectionKeyIdType.class); + return protectionKeyIdTypeJaxbElement.getValue(); + + } + + } + + /** + * The Class GetProtectionKeyActionOperation. + */ + private static class GetProtectionKeyActionOperation extends DefaultEntityTypeActionOperation { + + /** The jaxb context. */ + private final JAXBContext jaxbContext; + + /** The unmarshaller. */ + private final Unmarshaller unmarshaller; + + /** + * Instantiates a new gets the protection key action operation. + * + * @param name + * the name + */ + public GetProtectionKeyActionOperation(String name) { + super(name); + try { + jaxbContext = JAXBContext.newInstance(ProtectionKeyRestType.class); + } + catch (JAXBException e) { + throw new RuntimeException(e); + } + + try { + unmarshaller = jaxbContext.createUnmarshaller(); + } + catch (JAXBException e) { + throw new RuntimeException(e); + } + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.media.entityoperations.DefaultActionOperation#processResponse(com.sun.jersey.api.client.ClientResponse) + */ + @Override + public String processTypeResponse(ClientResponse clientResponse) { + PipelineHelpers.ThrowIfNotSuccess(clientResponse); + ProtectionKeyRestType protectionKeyRestType; + try { + protectionKeyRestType = parseResponse(clientResponse); + } + catch (JAXBException e) { + throw new RuntimeException(e); + } + + return protectionKeyRestType.getProtectionKey(); + } + + /** + * Parses the response. + * + * @param clientResponse + * the client response + * @return the protection key rest type + * @throws JAXBException + * the jAXB exception + */ + private ProtectionKeyRestType parseResponse(ClientResponse clientResponse) throws JAXBException { + InputStream inputStream = clientResponse.getEntityInputStream(); + JAXBElement protectionKeyTypeJaxbElement = unmarshaller.unmarshal(new StreamSource( + inputStream), ProtectionKeyRestType.class); + return protectionKeyTypeJaxbElement.getValue(); + + } + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/ProtectionKeyType.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/ProtectionKeyType.java new file mode 100644 index 000000000000..64db9a532797 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/ProtectionKeyType.java @@ -0,0 +1,66 @@ +/* + * 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.models; + +import java.security.InvalidParameterException; + +/** + * The Enum ProtectionKeyType. + */ +public enum ProtectionKeyType { + + /** The X509 certificate thumbprint. */ + X509CertificateThumbprint(0); + + /** The protection key type code. */ + private int protectionKeyTypeCode; + + /** + * Instantiates a new protection key type. + * + * @param protectionKeyTypeCode + * the protection key type code + */ + private ProtectionKeyType(int protectionKeyTypeCode) { + this.protectionKeyTypeCode = protectionKeyTypeCode; + } + + /** + * Gets the code. + * + * @return the code + */ + public int getCode() { + return protectionKeyTypeCode; + } + + /** + * Create an ProtectionKeyType instance from the corresponding int. + * + * @param protectionKeyTypeCode + * protectionKeyTypeCode as integer + * @return new ProtectionKeyType instance + */ + public static ProtectionKeyType fromCode(int protectionKeyTypeCode) { + switch (protectionKeyTypeCode) { + case 0: + return ProtectionKeyType.X509CertificateThumbprint; + default: + throw new InvalidParameterException("state"); + } + } + +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/Task.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/Task.java new file mode 100644 index 000000000000..707970b7b7e8 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/Task.java @@ -0,0 +1,220 @@ +/** + * 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.models; + +import com.microsoft.windowsazure.services.media.entityoperations.DefaultListOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityBatchOperation; +import com.microsoft.windowsazure.services.media.implementation.content.TaskType; +import com.sun.jersey.api.client.GenericType; + +/** + * Class for creating operations to manipulate Task entities. + * + */ +public class Task { + + /** The Constant ENTITY_SET. */ + private static final String ENTITY_SET = "Tasks"; + + // Prevent instantiation + /** + * Instantiates a new task. + */ + private Task() { + } + + /** + * Creates the. + * + * @param mediaProcessorId + * the media processor id + * @param taskBody + * the task body + * @return the creates the batch operation + */ + public static CreateBatchOperation create(String mediaProcessorId, String taskBody) { + return new CreateBatchOperation(mediaProcessorId, taskBody); + } + + /** + * Create an operation that will list all the tasks. + * + * @return The list operation + */ + public static DefaultListOperation list() { + return new DefaultListOperation(ENTITY_SET, new GenericType>() { + }); + } + + /** + * Create an operation that will list the tasks pointed to by the given link. + * + * @param link + * link to tasks + * @return the list operation. + */ + public static DefaultListOperation list(LinkInfo link) { + return new DefaultListOperation(link.getHref(), new GenericType>() { + }); + } + + /** + * The Class CreateBatchOperation. + */ + public static class CreateBatchOperation extends EntityBatchOperation { + + /** The task type. */ + private final TaskType taskType; + + /** + * Instantiates a new creates the batch operation. + * + * @param mediaProcessorId + * the media processor id + * @param taskBody + * the task body + */ + public CreateBatchOperation(String mediaProcessorId, String taskBody) { + this.verb = "POST"; + taskType = new TaskType(); + addContentObject(taskType); + this.taskType.setMediaProcessorId(mediaProcessorId); + this.taskType.setTaskBody(taskBody); + } + + /** + * Sets the options. + * + * @param options + * the options + * @return the creates the batch operation + */ + public CreateBatchOperation setOptions(TaskOption options) { + this.taskType.setOptions(options.getCode()); + return this; + } + + /** + * Sets the configuration. + * + * @param configuration + * the configuration + * @return the creates the batch operation + */ + public CreateBatchOperation setConfiguration(String configuration) { + this.taskType.setConfiguration(configuration); + return this; + } + + /** + * Sets the name. + * + * @param name + * the name + * @return the creates the batch operation + */ + public CreateBatchOperation setName(String name) { + this.taskType.setName(name); + return this; + } + + /** + * Sets the task body. + * + * @param taskBody + * the task body + * @return the creates the batch operation + */ + public CreateBatchOperation setTaskBody(String taskBody) { + this.taskType.setTaskBody(taskBody); + return this; + } + + /** + * Sets the media processor id. + * + * @param mediaProcessorId + * the media processor id + * @return the creates the batch operation + */ + public CreateBatchOperation setMediaProcessorId(String mediaProcessorId) { + this.taskType.setMediaProcessorId(mediaProcessorId); + return this; + } + + /** + * Sets the priority. + * + * @param priority + * the priority + * @return the creates the batch operation + */ + public CreateBatchOperation setPriority(int priority) { + this.taskType.setPriority(priority); + return this; + } + + /** + * Sets the encryption key id. + * + * @param encryptionKeyId + * the encryption key id + * @return the creates the batch operation + */ + public CreateBatchOperation setEncryptionKeyId(String encryptionKeyId) { + this.taskType.setEncryptionKeyId(encryptionKeyId); + return this; + } + + /** + * Sets the encryption scheme. + * + * @param encryptionScheme + * the encryption scheme + * @return the creates the batch operation + */ + public CreateBatchOperation setEncryptionScheme(String encryptionScheme) { + this.taskType.setEncryptionScheme(encryptionScheme); + return this; + } + + /** + * Sets the encryption version. + * + * @param encryptionVersion + * the encryption version + * @return the creates the batch operation + */ + public CreateBatchOperation setEncryptionVersion(String encryptionVersion) { + this.taskType.setEncryptionVersion(encryptionVersion); + return this; + } + + /** + * Sets the initialization vector. + * + * @param initializationVector + * the initialization vector + * @return the creates the batch operation + */ + public CreateBatchOperation setInitializationVector(String initializationVector) { + this.taskType.setInitializationVector(initializationVector); + return this; + } + + } + +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/TaskInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/TaskInfo.java new file mode 100644 index 000000000000..8e8c3cd11087 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/TaskInfo.java @@ -0,0 +1,232 @@ +/** + * 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.models; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import com.microsoft.windowsazure.services.media.implementation.ODataEntity; +import com.microsoft.windowsazure.services.media.implementation.atom.EntryType; +import com.microsoft.windowsazure.services.media.implementation.content.ErrorDetailType; +import com.microsoft.windowsazure.services.media.implementation.content.TaskType; + +/** + * The Class TaskInfo. + */ +public class TaskInfo extends ODataEntity { + + /** + * Instantiates a new task info. + * + * @param entry + * the entry + * @param content + * the content + */ + public TaskInfo(EntryType entry, TaskType content) { + super(entry, content); + } + + /** + * Gets the id. + * + * @return the id + */ + public String getId() { + return getContent().getId(); + } + + /** + * Gets the configuration. + * + * @return the configuration + */ + public String getConfiguration() { + return getContent().getConfiguration(); + } + + /** + * Gets the end time. + * + * @return the end time + */ + public Date getEndTime() { + return getContent().getEndTime(); + } + + /** + * Gets the error details. + * + * @return the error details + */ + public List getErrorDetails() { + List result = new ArrayList(); + List errorDetailTypes = getContent().getErrorDetails(); + if (errorDetailTypes != null) { + for (ErrorDetailType errorDetailType : errorDetailTypes) { + ErrorDetail errorDetail = new ErrorDetail(errorDetailType.getCode(), errorDetailType.getMessage()); + result.add(errorDetail); + } + return result; + } + return null; + } + + /** + * Gets the media processor id. + * + * @return the media processor id + */ + public String getMediaProcessorId() { + return getContent().getMediaProcessorId(); + } + + /** + * Gets the name. + * + * @return the name + */ + public String getName() { + return getContent().getName(); + } + + /** + * Gets the perf message. + * + * @return the perf message + */ + public String getPerfMessage() { + return getContent().getPerfMessage(); + } + + /** + * Gets the priority. + * + * @return the priority + */ + public int getPriority() { + return getContent().getPriority(); + } + + /** + * Gets the progress. + * + * @return the progress + */ + public double getProgress() { + return getContent().getProgress(); + } + + /** + * Gets the running duration. + * + * @return the running duration + */ + public double getRunningDuration() { + return getContent().getRunningDuration(); + } + + /** + * Gets the start time. + * + * @return the start time + */ + public Date getStartTime() { + return getContent().getStartTime(); + } + + /** + * Gets the state. + * + * @return the state + */ + public TaskState getState() { + return TaskState.fromCode(getContent().getState()); + } + + /** + * Gets the task body. + * + * @return the task body + */ + public String getTaskBody() { + return getContent().getTaskBody(); + } + + /** + * Gets the options. + * + * @return the options + */ + public TaskOption getOptions() { + return TaskOption.fromCode(getContent().getOptions()); + } + + /** + * Gets the encryption key id. + * + * @return the encryption key id + */ + public String getEncryptionKeyId() { + return getContent().getEncryptionKeyId(); + } + + /** + * Gets the encryption scheme. + * + * @return the encryption scheme + */ + public String getEncryptionScheme() { + return getContent().getEncryptionScheme(); + } + + /** + * Gets the encryption version. + * + * @return the encryption version + */ + public String getEncryptionVersion() { + return getContent().getEncryptionVersion(); + } + + /** + * Gets the initialization vector. + * + * @return the initialization vector + */ + public String getInitializationVector() { + return getContent().getInitializationVector(); + } + + /** + * Gets link to the task's input assets + * + * @return the link + */ + public LinkInfo getInputAssetsLink() { + return this. getRelationLink("InputMediaAssets"); + } + + /** + * Gets link to the task's output assets + * + * @return the link + */ + public LinkInfo getOutputAssetsLink() { + return this. getRelationLink("OutputMediaAssets"); + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/TaskOption.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/TaskOption.java new file mode 100644 index 000000000000..cb3dd9ba7942 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/TaskOption.java @@ -0,0 +1,69 @@ +/** + * 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.models; + +import java.security.InvalidParameterException; + +/** + * Enum describing options for creating tasks + * + */ +public enum TaskOption { + + /** + * None + */ + None(0), + + /** + * Encrypt task configuration + */ + ProtectedConfiguration(1); + + private int code; + + private TaskOption(int code) { + this.code = code; + } + + /** + * Get integer code corresponding to enum value + * + * @return the code + */ + public int getCode() { + return code; + } + + /** + * Return enum value corresponding to integer code + * + * @param code + * the code + * @return the enum value + */ + public static TaskOption fromCode(int code) { + switch (code) { + case 0: + return None; + case 1: + return ProtectedConfiguration; + + default: + throw new InvalidParameterException("code"); + } + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/TaskState.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/TaskState.java new file mode 100644 index 000000000000..3793e2e606d6 --- /dev/null +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/media/models/TaskState.java @@ -0,0 +1,95 @@ +/** + * 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.models; + +import java.security.InvalidParameterException; + +/** + * Enum defining the state of various tasks. + */ +public enum TaskState { + + /** No state. */ + None(0), + + /** Active. */ + Active(1), + + /** Running. */ + Running(2), + + /** Completed. */ + Completed(3), + + /** Error. */ + Error(4), + + /** The Canceled. */ + Canceled(5), + + /** The Canceling. */ + Canceling(6); + + /** The code. */ + private int code; + + /** + * Instantiates a new task state. + * + * @param code + * the code + */ + private TaskState(int code) { + this.code = code; + } + + /** + * Get integer code corresponding to enum value. + * + * @return the code + */ + public int getCode() { + return code; + } + + /** + * Convert code into enum value. + * + * @param code + * the code + * @return the corresponding enum value + */ + public static TaskState fromCode(int code) { + switch (code) { + case 0: + return None; + case 1: + return Active; + case 2: + return Running; + case 3: + return Completed; + case 4: + return Error; + case 5: + return Canceled; + case 6: + return Canceling; + default: + throw new InvalidParameterException("code"); + } + } +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/Exports.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/Exports.java index 14850f379862..3d57a69f82c7 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/Exports.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/Exports.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/QueueConfiguration.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/QueueConfiguration.java index 1fad44dfe643..73da72170a04 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/QueueConfiguration.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/QueueConfiguration.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/QueueContract.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/QueueContract.java index aa86eaf4ffcd..41e408d2dde6 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/QueueContract.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/QueueContract.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/QueueService.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/QueueService.java index a610b7500706..b60aacd41790 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/QueueService.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/QueueService.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/CloudQueue.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/CloudQueue.java index 93c3aa98203c..93771ce03de9 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/CloudQueue.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/CloudQueue.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/CloudQueueClient.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/CloudQueueClient.java index 8971ba912032..0ca46aaf25bc 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/CloudQueueClient.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/CloudQueueClient.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/CloudQueueMessage.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/CloudQueueMessage.java index 66f7328e35a0..496002375947 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/CloudQueueMessage.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/CloudQueueMessage.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/ListQueuesResponse.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/ListQueuesResponse.java index 83409abb03f2..2d0d4c0d3b97 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/ListQueuesResponse.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/ListQueuesResponse.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/MessageUpdateFields.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/MessageUpdateFields.java index 4e2efb1d3d6b..d01b1cf26863 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/MessageUpdateFields.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/MessageUpdateFields.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/QueueAccessPolicyResponse.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/QueueAccessPolicyResponse.java index 457113684d9d..3c3a7d56dae9 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/QueueAccessPolicyResponse.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/QueueAccessPolicyResponse.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/QueueConstants.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/QueueConstants.java index 4f9bc6438af8..d82fb09e4d05 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/QueueConstants.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/QueueConstants.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/QueueDeserializationHelper.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/QueueDeserializationHelper.java index 0bee5eaa15fc..22c01e64a492 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/QueueDeserializationHelper.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/QueueDeserializationHelper.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/QueueListingDetails.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/QueueListingDetails.java index 6f7064e0ee53..0a17cda55bc1 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/QueueListingDetails.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/QueueListingDetails.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/QueueMessageType.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/QueueMessageType.java index dd96957596cc..6712d9e62e94 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/QueueMessageType.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/QueueMessageType.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/QueuePermissions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/QueuePermissions.java index 35649a0fdf36..958968cb0b91 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/QueuePermissions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/QueuePermissions.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. @@ -55,4 +55,4 @@ public HashMap getSharedAccessPolicies() { public void setSharedAccessPolicies(final HashMap sharedAccessPolicies) { this.sharedAccessPolicies = sharedAccessPolicies; } -} \ No newline at end of file +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/QueueRequest.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/QueueRequest.java index cf0c6316a0c6..c00315de5443 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/QueueRequest.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/QueueRequest.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/QueueRequestOptions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/QueueRequestOptions.java index d4291a35160d..7df4d6a48b49 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/QueueRequestOptions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/QueueRequestOptions.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/QueueResponse.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/QueueResponse.java index 281e7760df30..05f041690d98 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/QueueResponse.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/QueueResponse.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/SharedAccessQueuePermissions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/SharedAccessQueuePermissions.java index 10daa8af1f72..6ab135fd8c98 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/SharedAccessQueuePermissions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/SharedAccessQueuePermissions.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/SharedAccessQueuePolicy.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/SharedAccessQueuePolicy.java index 6e952ae00a42..cd6b9085b4de 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/SharedAccessQueuePolicy.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/client/SharedAccessQueuePolicy.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/implementation/QueueExceptionProcessor.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/implementation/QueueExceptionProcessor.java index 751cac8338b8..c1ef1e075d19 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/implementation/QueueExceptionProcessor.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/implementation/QueueExceptionProcessor.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/implementation/QueueMessage.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/implementation/QueueMessage.java index cffc724549ac..aaaef3576e14 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/implementation/QueueMessage.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/implementation/QueueMessage.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/implementation/QueueRestProxy.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/implementation/QueueRestProxy.java index 5816a1bec264..4b038a023b20 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/implementation/QueueRestProxy.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/implementation/QueueRestProxy.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/implementation/SharedKeyFilter.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/implementation/SharedKeyFilter.java index 3707a3f11911..da9a6d15658a 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/implementation/SharedKeyFilter.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/implementation/SharedKeyFilter.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/implementation/SharedKeyLiteFilter.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/implementation/SharedKeyLiteFilter.java index 351d6ed8f62f..bd1cecd8aec2 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/implementation/SharedKeyLiteFilter.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/implementation/SharedKeyLiteFilter.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/CreateMessageOptions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/CreateMessageOptions.java index 1ce3ba2a191b..6dd5941aed8b 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/CreateMessageOptions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/CreateMessageOptions.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/CreateQueueOptions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/CreateQueueOptions.java index 81ff8debedf3..d9ea78c12d6e 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/CreateQueueOptions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/CreateQueueOptions.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/GetQueueMetadataResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/GetQueueMetadataResult.java index b522a7c589e9..a6d69b660306 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/GetQueueMetadataResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/GetQueueMetadataResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/GetServicePropertiesResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/GetServicePropertiesResult.java index 4dff09479acf..0ee5567e9a71 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/GetServicePropertiesResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/GetServicePropertiesResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/ListMessagesOptions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/ListMessagesOptions.java index 0fb34021981c..ffb13754185b 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/ListMessagesOptions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/ListMessagesOptions.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/ListMessagesResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/ListMessagesResult.java index facfb7328344..04f85095706d 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/ListMessagesResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/ListMessagesResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/ListQueuesOptions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/ListQueuesOptions.java index 7d4d346570b8..d3a6b30b4766 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/ListQueuesOptions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/ListQueuesOptions.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/ListQueuesResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/ListQueuesResult.java index 144dddada23c..22b92b40444b 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/ListQueuesResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/ListQueuesResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/PeekMessagesOptions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/PeekMessagesOptions.java index eff229bf1657..50fbe5ab288e 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/PeekMessagesOptions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/PeekMessagesOptions.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/PeekMessagesResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/PeekMessagesResult.java index 602f2bee8e8c..34fc7f725ffa 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/PeekMessagesResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/PeekMessagesResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/QueueServiceOptions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/QueueServiceOptions.java index 9f22a1f5fa1b..a0836fa64f09 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/QueueServiceOptions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/QueueServiceOptions.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/ServiceProperties.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/ServiceProperties.java index a914ac227997..e83c9ff5bf04 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/ServiceProperties.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/ServiceProperties.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/UpdateMessageResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/UpdateMessageResult.java index 7c81179931e4..b75fa54659d4 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/UpdateMessageResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/queue/models/UpdateMessageResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/Exports.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/Exports.java index 053d3b7fcff5..b335a9f9106f 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/Exports.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/Exports.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusConfiguration.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusConfiguration.java index 24592204de19..87202a8b2254 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusConfiguration.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusConfiguration.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusContract.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusContract.java index 4459ba1308d8..6d6d373b1104 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusContract.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusContract.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusService.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusService.java index e7d12cf2dd06..b36011b78903 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusService.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusService.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/Util.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/Util.java index f2d6ce0404be..026cb9c51771 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/Util.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/Util.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/BrokerProperties.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/BrokerProperties.java index 0ccbc406d66a..2db84273def9 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/BrokerProperties.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/BrokerProperties.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/BrokerPropertiesMapper.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/BrokerPropertiesMapper.java index e7892b7116f8..5a8dda45f9ba 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/BrokerPropertiesMapper.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/BrokerPropertiesMapper.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/CustomPropertiesMapper.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/CustomPropertiesMapper.java index 1dd76f10af73..a12fbb4ee819 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/CustomPropertiesMapper.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/CustomPropertiesMapper.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/EntryModel.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/EntryModel.java index 2edab43e9419..71f11d9e6e46 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/EntryModel.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/EntryModel.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/EntryModelProvider.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/EntryModelProvider.java index 46b47db0d93c..04ba3dce58b9 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/EntryModelProvider.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/EntryModelProvider.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/Exports.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/Exports.java index 728e70dc4273..d0f454a25517 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/Exports.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/Exports.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/MarshallerProvider.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/MarshallerProvider.java index 7654604e20fd..fbda9c3f7f5e 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/MarshallerProvider.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/MarshallerProvider.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/NamespacePrefixMapperImpl.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/NamespacePrefixMapperImpl.java index 5af2ccf6f6df..2cf8396485af 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/NamespacePrefixMapperImpl.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/NamespacePrefixMapperImpl.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusExceptionProcessor.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusExceptionProcessor.java index e29297bbb22c..567ae5cedd0b 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusExceptionProcessor.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusExceptionProcessor.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusRestProxy.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusRestProxy.java index 7fc710b76d00..b2007513afb2 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusRestProxy.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/ServiceBusRestProxy.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/WrapAccessTokenResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/WrapAccessTokenResult.java index 9732c0741c57..ee6e919010cf 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/WrapAccessTokenResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/WrapAccessTokenResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/WrapContract.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/WrapContract.java index 8514686db432..2e8389774679 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/WrapContract.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/WrapContract.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/WrapFilter.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/WrapFilter.java index 5758ac151d00..ac3c15b3a7d0 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/WrapFilter.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/WrapFilter.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/WrapRestProxy.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/WrapRestProxy.java index d73638329561..ec124f718c2a 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/WrapRestProxy.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/WrapRestProxy.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/WrapTokenManager.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/WrapTokenManager.java index 48e28220249a..407b839ddbb8 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/WrapTokenManager.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/implementation/WrapTokenManager.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/AbstractListOptions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/AbstractListOptions.java index b7695de3aa72..5970d10fc96f 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/AbstractListOptions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/AbstractListOptions.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/BrokeredMessage.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/BrokeredMessage.java index 7f7e5caac017..a2518f45afd9 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/BrokeredMessage.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/BrokeredMessage.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/CreateQueueResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/CreateQueueResult.java index bf617d161f24..8b0a7eceb6c7 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/CreateQueueResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/CreateQueueResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/CreateRuleResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/CreateRuleResult.java index 4477a1a242d2..bc72c6da2902 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/CreateRuleResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/CreateRuleResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/CreateSubscriptionResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/CreateSubscriptionResult.java index 477e1abb50e3..1580bc79005a 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/CreateSubscriptionResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/CreateSubscriptionResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/CreateTopicResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/CreateTopicResult.java index 91c5f30d20e8..8c0baaca9afe 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/CreateTopicResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/CreateTopicResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/GetQueueResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/GetQueueResult.java index 9e3e5da19a07..0fff663cc965 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/GetQueueResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/GetQueueResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/GetRuleResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/GetRuleResult.java index 222ae08d8463..c940040fc064 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/GetRuleResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/GetRuleResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/GetSubscriptionResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/GetSubscriptionResult.java index 4649f6f2e4b0..ff8f5ee9e471 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/GetSubscriptionResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/GetSubscriptionResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/GetTopicResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/GetTopicResult.java index d546630c39b5..225475907440 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/GetTopicResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/GetTopicResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ListQueuesOptions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ListQueuesOptions.java index db1d3a1d41c1..71e71a3ff767 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ListQueuesOptions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ListQueuesOptions.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ListQueuesResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ListQueuesResult.java index c06b5b3e2734..b7c72147b1f1 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ListQueuesResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ListQueuesResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ListRulesOptions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ListRulesOptions.java index 5ba5ed561814..0e7beca7478c 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ListRulesOptions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ListRulesOptions.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ListRulesResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ListRulesResult.java index b12c3e65bb88..3b08d444b95d 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ListRulesResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ListRulesResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ListSubscriptionsOptions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ListSubscriptionsOptions.java index 472b25a35e6e..c9c2efbbedb7 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ListSubscriptionsOptions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ListSubscriptionsOptions.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ListSubscriptionsResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ListSubscriptionsResult.java index 4b6c6cc5fbe8..14dbbff14545 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ListSubscriptionsResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ListSubscriptionsResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ListTopicsOptions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ListTopicsOptions.java index 54ffa6f364d5..9363c7a90266 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ListTopicsOptions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ListTopicsOptions.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ListTopicsResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ListTopicsResult.java index b5539a870055..e43a27ccd814 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ListTopicsResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ListTopicsResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfo.java index 65e08b395acd..676cb1bfd318 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/QueueInfo.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ReceiveMessageOptions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ReceiveMessageOptions.java index 4e7ffcd2328d..3e304ad34330 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ReceiveMessageOptions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ReceiveMessageOptions.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ReceiveMessageResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ReceiveMessageResult.java index e9ca05b07570..7c092119e52f 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ReceiveMessageResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ReceiveMessageResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ReceiveMode.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ReceiveMode.java index 99c7e3e02d39..67e2f3bfc9c3 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ReceiveMode.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ReceiveMode.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ReceiveQueueMessageResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ReceiveQueueMessageResult.java index 46a0c4a1ac5c..5a5185491d4c 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ReceiveQueueMessageResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ReceiveQueueMessageResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ReceiveSubscriptionMessageResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ReceiveSubscriptionMessageResult.java index 0436a5a873f1..4d32488b6e39 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ReceiveSubscriptionMessageResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/ReceiveSubscriptionMessageResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/RuleInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/RuleInfo.java index 7889fdc900a3..c5e862bbc1df 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/RuleInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/RuleInfo.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/SubscriptionInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/SubscriptionInfo.java index e8490870583c..fd65bedd66b7 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/SubscriptionInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/SubscriptionInfo.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfo.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfo.java index 76ac97d68196..d53474146682 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfo.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/serviceBus/models/TopicInfo.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/EdmValueConverter.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/EdmValueConverter.java index 48b0859ba92f..0f96ce3852eb 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/EdmValueConverter.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/EdmValueConverter.java @@ -1,5 +1,5 @@ /** - * Copyright 2012 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/Exports.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/Exports.java index ad0334ab03de..39fea9c07eb1 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/Exports.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/Exports.java @@ -1,5 +1,5 @@ /** - * Copyright 2012 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/TableConfiguration.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/TableConfiguration.java index 5d0d696061d1..b516e80d4128 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/TableConfiguration.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/TableConfiguration.java @@ -1,5 +1,5 @@ /** - * Copyright 2012 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/TableContract.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/TableContract.java index e4a448f0f7ff..e752d667d034 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/TableContract.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/TableContract.java @@ -1,5 +1,5 @@ /** - * Copyright 2012 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/TableService.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/TableService.java index 51bf07c43bd3..71c95a11ea97 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/TableService.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/TableService.java @@ -1,5 +1,5 @@ /** - * Copyright 2012 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/AtomPubParser.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/AtomPubParser.java index c258badfc3ff..8ea633c39a86 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/AtomPubParser.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/AtomPubParser.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/CloudTable.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/CloudTable.java index 6fe819975c21..536b3adfb582 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/CloudTable.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/CloudTable.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/CloudTableClient.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/CloudTableClient.java index 4420c2d37518..e49f6e3fdfca 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/CloudTableClient.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/CloudTableClient.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/DynamicTableEntity.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/DynamicTableEntity.java index cfe58e086f67..e4d8afccca74 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/DynamicTableEntity.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/DynamicTableEntity.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/EdmType.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/EdmType.java index bf246941e4ce..44e8d7d8ab6f 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/EdmType.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/EdmType.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/EntityProperty.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/EntityProperty.java index b449c874abb8..5c166251b561 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/EntityProperty.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/EntityProperty.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/EntityResolver.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/EntityResolver.java index 1f7d95d3a812..013e0cdd1da7 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/EntityResolver.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/EntityResolver.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/Ignore.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/Ignore.java index 53653dc95150..d014927db13b 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/Ignore.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/Ignore.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/MimeHeader.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/MimeHeader.java index bffc95cdd427..65b3bed132e7 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/MimeHeader.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/MimeHeader.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/MimeHelper.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/MimeHelper.java index 143a4022e374..53c5e1f60580 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/MimeHelper.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/MimeHelper.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/MimePart.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/MimePart.java index 254581502e2b..b8751b5e23fa 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/MimePart.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/MimePart.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/ODataConstants.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/ODataConstants.java index ed89049797d1..e2dfc5d37375 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/ODataConstants.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/ODataConstants.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/ODataPayload.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/ODataPayload.java index 9f0f5c573bec..9fbf3cb0a062 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/ODataPayload.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/ODataPayload.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/PropertyPair.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/PropertyPair.java index 24da5f2adc58..aed9941b8c8f 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/PropertyPair.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/PropertyPair.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/QueryTableOperation.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/QueryTableOperation.java index a79824446fc2..bc5c112c3187 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/QueryTableOperation.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/QueryTableOperation.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/SharedAccessTablePermissions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/SharedAccessTablePermissions.java index 649f4208e6f1..6ed1e001e94d 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/SharedAccessTablePermissions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/SharedAccessTablePermissions.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/SharedAccessTablePolicy.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/SharedAccessTablePolicy.java index d5fc4c780104..fbeb55dae5be 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/SharedAccessTablePolicy.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/SharedAccessTablePolicy.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/StoreAs.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/StoreAs.java index 7918530c85f3..1f80c27122fd 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/StoreAs.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/StoreAs.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableAccessPolicyResponse.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableAccessPolicyResponse.java index 3333e2b3c54f..31b35dc81bf2 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableAccessPolicyResponse.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableAccessPolicyResponse.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableBatchOperation.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableBatchOperation.java index 162edd2bdab2..4f81296856b6 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableBatchOperation.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableBatchOperation.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableConstants.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableConstants.java index 48d3f3d56ea0..2822c5e47856 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableConstants.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableConstants.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableEntity.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableEntity.java index 85dc20a8c37b..702a42bb86f9 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableEntity.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableEntity.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableOperation.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableOperation.java index 3bffd84a306b..130d59fe9914 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableOperation.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableOperation.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableOperationType.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableOperationType.java index a1ceccabd332..ccfd867a9808 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableOperationType.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableOperationType.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TablePermissions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TablePermissions.java index d981a820d6b4..15b9ad5d3f11 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TablePermissions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TablePermissions.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. @@ -56,4 +56,4 @@ public HashMap getSharedAccessPolicies() { public void setSharedAccessPolicies(final HashMap sharedAccessPolicies) { this.sharedAccessPolicies = sharedAccessPolicies; } -} \ No newline at end of file +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableQuery.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableQuery.java index 90a9bfa3501d..6b5e12695101 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableQuery.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableQuery.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableRequest.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableRequest.java index 782aa98ef84e..171d8cbc254f 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableRequest.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableRequest.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableRequestOptions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableRequestOptions.java index 1a4d210526f2..030eee752bee 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableRequestOptions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableRequestOptions.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableResponse.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableResponse.java index 848e7b2afc0b..6f2d7d9c8d86 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableResponse.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableResponse.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableResult.java index 95e0621b63ed..6ede801908f5 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableServiceEntity.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableServiceEntity.java index 04f26b84a300..fe8efb7ec1f7 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableServiceEntity.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableServiceEntity.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableServiceException.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableServiceException.java index 04f065a4407d..494a304abcc4 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableServiceException.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableServiceException.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableUpdateType.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableUpdateType.java index 3fbf519729c4..94e63a882be3 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableUpdateType.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/client/TableUpdateType.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/AtomReaderWriter.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/AtomReaderWriter.java index 469121547830..01fbab3a870f 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/AtomReaderWriter.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/AtomReaderWriter.java @@ -1,5 +1,5 @@ /** - * Copyright 2012 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/DefaultEdmValueConterter.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/DefaultEdmValueConterter.java index d35293670c1b..8d1aff2334cb 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/DefaultEdmValueConterter.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/DefaultEdmValueConterter.java @@ -1,5 +1,5 @@ /** - * Copyright 2012 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/DefaultXMLStreamFactory.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/DefaultXMLStreamFactory.java index 6202250942d4..9447472f8cb2 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/DefaultXMLStreamFactory.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/DefaultXMLStreamFactory.java @@ -1,5 +1,5 @@ /** - * Copyright 2012 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/HttpReaderWriter.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/HttpReaderWriter.java index 347538853151..10dd2360c855 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/HttpReaderWriter.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/HttpReaderWriter.java @@ -1,5 +1,5 @@ /** - * Copyright 2012 Microsoft Corporation + * 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. @@ -40,15 +40,20 @@ public HttpReaderWriter() { public StatusLine parseStatusLine(DataSource ds) { try { LineInputStream stream = new LineInputStream(ds.getInputStream()); - String line = stream.readLine(); - StringReader lineReader = new StringReader(line); + try { + String line = stream.readLine(); + StringReader lineReader = new StringReader(line); - expect(lineReader, "HTTP/1.1"); - expect(lineReader, " "); - String statusString = extractInput(lineReader, ' '); - String reason = extractInput(lineReader, -1); + expect(lineReader, "HTTP/1.1"); + expect(lineReader, " "); + String statusString = extractInput(lineReader, ' '); + String reason = extractInput(lineReader, -1); - return new StatusLine().setStatus(Integer.parseInt(statusString)).setReason(reason); + return new StatusLine().setStatus(Integer.parseInt(statusString)).setReason(reason); + } + finally { + stream.close(); + } } catch (IOException e) { throw new RuntimeException(e); diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/InputStreamDataSource.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/InputStreamDataSource.java index a15d80844155..02c5fd31bb47 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/InputStreamDataSource.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/InputStreamDataSource.java @@ -1,5 +1,5 @@ /** - * Copyright 2012 Microsoft Corporation + * 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. @@ -49,4 +49,4 @@ public String getName() { public OutputStream getOutputStream() throws IOException { return null; } -} \ No newline at end of file +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/MimeReaderWriter.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/MimeReaderWriter.java index 30aa13ec6bfe..efcc33f78b2c 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/MimeReaderWriter.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/MimeReaderWriter.java @@ -1,5 +1,5 @@ /** - * Copyright 2012 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/SharedKeyFilter.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/SharedKeyFilter.java index 7e2e95bb88f9..d14843554216 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/SharedKeyFilter.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/SharedKeyFilter.java @@ -1,5 +1,5 @@ /** - * Copyright 2012 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/SharedKeyLiteFilter.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/SharedKeyLiteFilter.java index 6f9990616a82..cc048c5c8d3d 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/SharedKeyLiteFilter.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/SharedKeyLiteFilter.java @@ -1,5 +1,5 @@ /** - * Copyright 2012 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/TableExceptionProcessor.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/TableExceptionProcessor.java index 29e8bd6dd812..3642189a8168 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/TableExceptionProcessor.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/TableExceptionProcessor.java @@ -1,5 +1,5 @@ /** - * Copyright 2012 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/TableRestProxy.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/TableRestProxy.java index 7da2c6a1b490..72379bb2582b 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/TableRestProxy.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/TableRestProxy.java @@ -1,5 +1,5 @@ /** - * Copyright 2012 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/XMLStreamFactory.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/XMLStreamFactory.java index 064becc8b865..cd61e66a5977 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/XMLStreamFactory.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/implementation/XMLStreamFactory.java @@ -1,5 +1,5 @@ /** - * Copyright 2012 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/BatchOperations.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/BatchOperations.java index f59811f33f6f..849d69c28e53 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/BatchOperations.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/BatchOperations.java @@ -1,5 +1,5 @@ /** - * Copyright 2012 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/BatchResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/BatchResult.java index 47496057fb25..288ced7d2987 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/BatchResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/BatchResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2012 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/BinaryFilter.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/BinaryFilter.java index 96a1a6a71b57..b5502542ffc1 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/BinaryFilter.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/BinaryFilter.java @@ -1,5 +1,5 @@ /** - * Copyright 2012 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/ConstantFilter.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/ConstantFilter.java index 888901e84041..ee90440d312f 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/ConstantFilter.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/ConstantFilter.java @@ -1,5 +1,5 @@ /** - * Copyright 2012 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/DeleteEntityOptions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/DeleteEntityOptions.java index 2be63a3d9e6b..846407dd9fb7 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/DeleteEntityOptions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/DeleteEntityOptions.java @@ -1,5 +1,5 @@ /** - * Copyright 2012 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/EdmType.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/EdmType.java index a104fdc549e5..153d0bc035dd 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/EdmType.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/EdmType.java @@ -1,5 +1,5 @@ /** - * Copyright 2012 Microsoft Corporation + * 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. @@ -131,4 +131,4 @@ public class EdmType { * Edm.String Represents fixed- or variable-length character data. */ public static final String STRING = "Edm.String"; -} \ No newline at end of file +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/Entity.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/Entity.java index 8377a645fa8c..94fd36448c25 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/Entity.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/Entity.java @@ -1,5 +1,5 @@ /** - * Copyright 2012 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/Filter.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/Filter.java index 612c8c40d027..b8aecc0f8709 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/Filter.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/Filter.java @@ -1,5 +1,5 @@ /** - * Copyright 2012 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/GetEntityResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/GetEntityResult.java index 982a8d55b028..c2326aa37905 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/GetEntityResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/GetEntityResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2012 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/GetServicePropertiesResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/GetServicePropertiesResult.java index 7f4780fd3c15..2f374d787d1e 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/GetServicePropertiesResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/GetServicePropertiesResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2012 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/GetTableResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/GetTableResult.java index a5f3e843966b..59e7eaee303d 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/GetTableResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/GetTableResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2012 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/InsertEntityResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/InsertEntityResult.java index 1c786f9b4b08..e6fcf6b0202e 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/InsertEntityResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/InsertEntityResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2012 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/Property.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/Property.java index 19b7492ec5c9..1f54bf907681 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/Property.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/Property.java @@ -1,5 +1,5 @@ /** - * Copyright 2012 Microsoft Corporation + * 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. @@ -138,4 +138,4 @@ public Property setValue(Object value) { this.value = value; return this; } -} \ No newline at end of file +} diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/PropertyNameFilter.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/PropertyNameFilter.java index 9594b838e74e..c31b1552a2bb 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/PropertyNameFilter.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/PropertyNameFilter.java @@ -1,5 +1,5 @@ /** - * Copyright 2012 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/QueryEntitiesOptions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/QueryEntitiesOptions.java index fcc04a34d510..71d6442a1a53 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/QueryEntitiesOptions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/QueryEntitiesOptions.java @@ -1,5 +1,5 @@ /** - * Copyright 2012 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/QueryEntitiesResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/QueryEntitiesResult.java index 6d050f96843d..b58f2eeccdda 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/QueryEntitiesResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/QueryEntitiesResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2012 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/QueryStringFilter.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/QueryStringFilter.java index 84db88c276ae..0238b57d083f 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/QueryStringFilter.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/QueryStringFilter.java @@ -1,5 +1,5 @@ /** - * Copyright 2012 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/QueryTablesOptions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/QueryTablesOptions.java index e7c89aeb759e..e553a15bb8d3 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/QueryTablesOptions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/QueryTablesOptions.java @@ -1,5 +1,5 @@ /** - * Copyright 2012 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/QueryTablesResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/QueryTablesResult.java index 3cfa1768ea81..4937d830a351 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/QueryTablesResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/QueryTablesResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2012 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/ServiceProperties.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/ServiceProperties.java index 6f8a4f11c0c0..bc09dbce91b1 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/ServiceProperties.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/ServiceProperties.java @@ -1,5 +1,5 @@ /** - * Copyright 2012 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/TableEntry.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/TableEntry.java index cc65eff4e1d4..f166b0416628 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/TableEntry.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/TableEntry.java @@ -1,5 +1,5 @@ /** - * Copyright 2012 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/TableServiceOptions.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/TableServiceOptions.java index 0eb1b91b27aa..55d2d818dca1 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/TableServiceOptions.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/TableServiceOptions.java @@ -1,5 +1,5 @@ /** - * Copyright 2012 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/UnaryFilter.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/UnaryFilter.java index 190437d27b53..d01cedea3512 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/UnaryFilter.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/UnaryFilter.java @@ -1,5 +1,5 @@ /** - * Copyright 2012 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/UpdateEntityResult.java b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/UpdateEntityResult.java index 53dc66738944..d8496a35f70b 100644 --- a/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/UpdateEntityResult.java +++ b/microsoft-azure-api/src/main/java/com/microsoft/windowsazure/services/table/models/UpdateEntityResult.java @@ -1,5 +1,5 @@ /** - * Copyright 2012 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports b/microsoft-azure-api/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports index 07fdb1c4e7b6..e49188d4c09a 100644 --- a/microsoft-azure-api/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports +++ b/microsoft-azure-api/src/main/resources/META-INF/services/com.microsoft.windowsazure.services.core.Builder$Exports @@ -5,3 +5,5 @@ com.microsoft.windowsazure.services.serviceBus.Exports com.microsoft.windowsazure.services.serviceBus.implementation.Exports com.microsoft.windowsazure.services.core.utils.Exports com.microsoft.windowsazure.services.core.utils.pipeline.Exports +com.microsoft.windowsazure.services.media.Exports + diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/configuration/builder/AlterClassWithProperties.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/configuration/builder/AlterClassWithProperties.java index 2fa253cd5fc8..4c208fd7932b 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/configuration/builder/AlterClassWithProperties.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/configuration/builder/AlterClassWithProperties.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/configuration/builder/ClassWithMultipleCtorMultipleInject.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/configuration/builder/ClassWithMultipleCtorMultipleInject.java index bab655d1c9a7..9ba40b3f1504 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/configuration/builder/ClassWithMultipleCtorMultipleInject.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/configuration/builder/ClassWithMultipleCtorMultipleInject.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/configuration/builder/ClassWithMultipleCtorNoInject.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/configuration/builder/ClassWithMultipleCtorNoInject.java index 9522d97ad251..e0568c1a118a 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/configuration/builder/ClassWithMultipleCtorNoInject.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/configuration/builder/ClassWithMultipleCtorNoInject.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/configuration/builder/ClassWithNamedParameter.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/configuration/builder/ClassWithNamedParameter.java index cef547f4078c..329ef2977c42 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/configuration/builder/ClassWithNamedParameter.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/configuration/builder/ClassWithNamedParameter.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/configuration/builder/ClassWithProperties.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/configuration/builder/ClassWithProperties.java index 2c2005676163..acb256a9aa9b 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/configuration/builder/ClassWithProperties.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/configuration/builder/ClassWithProperties.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/configuration/builder/ClassWithSingleCtorNoInject.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/configuration/builder/ClassWithSingleCtorNoInject.java index 19ed61a0a021..82dc255982b5 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/configuration/builder/ClassWithSingleCtorNoInject.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/configuration/builder/ClassWithSingleCtorNoInject.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/configuration/builder/DefaultBuilderTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/configuration/builder/DefaultBuilderTest.java index 664627699737..0b164cd91178 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/configuration/builder/DefaultBuilderTest.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/configuration/builder/DefaultBuilderTest.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/serviceruntime/FileInputChannelTests.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/serviceruntime/FileInputChannelTests.java index 12f9656c1755..25f95aa4759f 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/serviceruntime/FileInputChannelTests.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/serviceruntime/FileInputChannelTests.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/serviceruntime/MockInputChannel.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/serviceruntime/MockInputChannel.java index 804022b81da6..2cf8df32691f 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/serviceruntime/MockInputChannel.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/serviceruntime/MockInputChannel.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/serviceruntime/Protocol1RuntimeCurrentStateClientTests.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/serviceruntime/Protocol1RuntimeCurrentStateClientTests.java index b18feab92e44..27979f239fc3 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/serviceruntime/Protocol1RuntimeCurrentStateClientTests.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/serviceruntime/Protocol1RuntimeCurrentStateClientTests.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/serviceruntime/Protocol1RuntimeGoalStateClientTests.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/serviceruntime/Protocol1RuntimeGoalStateClientTests.java index c460f04cc62b..42f4d4acab31 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/serviceruntime/Protocol1RuntimeGoalStateClientTests.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/serviceruntime/Protocol1RuntimeGoalStateClientTests.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentTests.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentTests.java index 3ebd677771ca..5e34f5d49e85 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentTests.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/serviceruntime/RoleEnvironmentTests.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/serviceruntime/RuntimeVersionManagerTests.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/serviceruntime/RuntimeVersionManagerTests.java index 2e8c72b0beda..da58a7bd1e25 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/serviceruntime/RuntimeVersionManagerTests.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/serviceruntime/RuntimeVersionManagerTests.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/serviceruntime/XmlGoalStateDeserializerTests.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/serviceruntime/XmlGoalStateDeserializerTests.java index 4222faf05b1f..8fafbe9ef8fa 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/serviceruntime/XmlGoalStateDeserializerTests.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/serviceruntime/XmlGoalStateDeserializerTests.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/blob/BlobServiceIntegrationTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/blob/BlobServiceIntegrationTest.java index d1fbb29871d6..01040883db40 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/blob/BlobServiceIntegrationTest.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/blob/BlobServiceIntegrationTest.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/blob/IntegrationTestBase.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/blob/IntegrationTestBase.java index 4275e212fb8c..fc7b2c07ac80 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/blob/IntegrationTestBase.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/blob/IntegrationTestBase.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/blob/client/BlobTestBase.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/blob/client/BlobTestBase.java index 938db64c06d4..81ac9334d8dc 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/blob/client/BlobTestBase.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/blob/client/BlobTestBase.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/blob/client/CloudBlobContainerTests.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/blob/client/CloudBlobContainerTests.java index 89c983c3852a..f16cfe5a2db6 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/blob/client/CloudBlobContainerTests.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/blob/client/CloudBlobContainerTests.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/blob/implementation/ISO8601DateConverterTests.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/blob/implementation/ISO8601DateConverterTests.java index c69d18d8f1eb..669b1a29fb88 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/blob/implementation/ISO8601DateConverterTests.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/blob/implementation/ISO8601DateConverterTests.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/core/IdempotentClientFilterTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/core/IdempotentClientFilterTest.java new file mode 100644 index 000000000000..82963a885e9c --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/core/IdempotentClientFilterTest.java @@ -0,0 +1,169 @@ +/** + * 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.core; + +import static org.junit.Assert.*; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mockito; + +import com.sun.jersey.api.client.Client; +import com.sun.jersey.api.client.ClientHandlerException; +import com.sun.jersey.api.client.ClientRequest; +import com.sun.jersey.api.client.ClientResponse; +import com.sun.jersey.api.client.WebResource; +import com.sun.jersey.api.client.filter.ClientFilter; + +/** + * Test fixture for IdempotentClientFilter class + * + */ +public class IdempotentClientFilterTest { + Client client; + RetryFilter retry; + CountingFilter filter1; + CountingFilter filter2; + + @Before + public void setup() { + client = Client.create(); + client.addFilter(new MockSinkFilter()); + + retry = new RetryFilter(); + filter1 = new CountingFilter(); + filter2 = new CountingFilter(); + filter2.key = "secondfilter"; + } + + @Test + public void filterRunsFirstTime() throws Exception { + client.addFilter(filter1); + + WebResource r = client.resource("http://test.example"); + ClientResponse response = r.get(ClientResponse.class); + + assertEquals(ClientResponse.Status.ACCEPTED, response.getClientResponseStatus()); + + assertEquals(1, filter1.count); + } + + @Test + public void filterRunsOnlyOnceWhenRequestIsRetried() throws Exception { + retry.triesLeft = 3; + client.addFilter(filter1); + client.addFilter(retry); + + WebResource r = client.resource("http://test.example"); + ClientResponse response = r.get(ClientResponse.class); + + assertEquals(ClientResponse.Status.ACCEPTED, response.getClientResponseStatus()); + assertEquals(1, filter1.count); + } + + @Test + public void multipleIdempotentFiltersRunFirstTime() throws Exception { + client.addFilter(filter1); + client.addFilter(filter2); + + WebResource r = client.resource("http://test.example"); + ClientResponse response = r.get(ClientResponse.class); + + assertEquals(ClientResponse.Status.ACCEPTED, response.getClientResponseStatus()); + + assertEquals(1, filter1.count); + assertEquals(1, filter2.count); + } + + @Test + public void multipleIdempotentFiltersRunOnceWhenRetried() throws Exception { + retry.triesLeft = 4; + + client.addFilter(filter1); + client.addFilter(filter2); + client.addFilter(retry); + + WebResource r = client.resource("http://test.example"); + ClientResponse response = r.get(ClientResponse.class); + + assertEquals(ClientResponse.Status.ACCEPTED, response.getClientResponseStatus()); + + assertEquals(1, filter1.count); + assertEquals(1, filter2.count); + } + + @Test + public void idempotentFilterRunsAgainOnSecondRequest() throws Exception { + client.addFilter(filter1); + + WebResource r = client.resource("http://test.example"); + r.get(ClientResponse.class); + + r = client.resource("http://test.example"); + r.get(ClientResponse.class); + + assertEquals(2, filter1.count); + } + + private class RetryFilter extends ClientFilter { + int triesLeft = 1; + + /* (non-Javadoc) + * @see com.sun.jersey.api.client.filter.ClientFilter#handle(com.sun.jersey.api.client.ClientRequest) + */ + @Override + public ClientResponse handle(ClientRequest cr) throws ClientHandlerException { + ClientResponse response = null; + while (triesLeft > 0) { + --triesLeft; + response = getNext().handle(cr); + } + return response; + } + } + + private class CountingFilter extends IdempotentClientFilter { + public int count; + private String key = null; + + @Override + protected ClientResponse doHandle(ClientRequest cr) throws ClientHandlerException { + ++count; + return getNext().handle(cr); + } + + /* (non-Javadoc) + * @see com.microsoft.windowsazure.services.core.IdempotentClientFilter#getKey() + */ + @Override + protected String getKey() { + if (key != null) { + return key; + } + return super.getKey(); + } + } + + private class MockSinkFilter extends ClientFilter { + + @Override + public ClientResponse handle(ClientRequest cr) throws ClientHandlerException { + ClientResponse response = Mockito.mock(ClientResponse.class); + Mockito.when(response.getClientResponseStatus()).thenReturn(ClientResponse.Status.ACCEPTED); + return response; + } + } +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/core/utils/pipeline/PipelineHelpersTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/core/utils/pipeline/PipelineHelpersTest.java index 670b3e7ae0a2..39ecf8029822 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/core/utils/pipeline/PipelineHelpersTest.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/core/utils/pipeline/PipelineHelpersTest.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/AccessPolicyIntegrationTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/AccessPolicyIntegrationTest.java new file mode 100644 index 000000000000..32bfdbe2dfb9 --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/AccessPolicyIntegrationTest.java @@ -0,0 +1,207 @@ +/** + * 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; + +import static org.junit.Assert.*; + +import java.util.ArrayList; +import java.util.EnumSet; +import java.util.List; + +import org.junit.Test; + +import com.microsoft.windowsazure.services.core.ExponentialRetryPolicy; +import com.microsoft.windowsazure.services.core.RetryPolicyFilter; +import com.microsoft.windowsazure.services.core.ServiceException; +import com.microsoft.windowsazure.services.media.models.AccessPolicy; +import com.microsoft.windowsazure.services.media.models.AccessPolicyInfo; +import com.microsoft.windowsazure.services.media.models.AccessPolicyPermission; + +public class AccessPolicyIntegrationTest extends IntegrationTestBase { + private void verifyInfosEqual(String message, AccessPolicyInfo expected, AccessPolicyInfo actual) { + verifyPolicyProperties(message, expected.getName(), expected.getDurationInMinutes(), expected.getPermissions(), + actual); + } + + private void verifyPolicyProperties(String message, String testName, double duration, + AccessPolicyPermission permission, AccessPolicyInfo policy) { + verifyPolicyProperties(message, testName, duration, EnumSet.of(permission), policy); + } + + private void verifyPolicyProperties(String message, String testName, double duration, + EnumSet permissions, AccessPolicyInfo policy) { + assertNotNull(message, policy); + assertEquals(message + " Name", testName, policy.getName()); + assertEquals(message + " DurationInMinutes", duration, policy.getDurationInMinutes(), 0.00001); + for (AccessPolicyPermission permission : permissions) { + if (permission != AccessPolicyPermission.NONE) { + assertTrue(message + "permissions should contain " + permission, + policy.getPermissions().contains(permission)); + } + } + assertEquals(message + " Permissions", permissions, policy.getPermissions()); + + assertNotNull(message + " Id", policy.getId()); + assertNotNull(message + " Created", policy.getCreated()); + assertNotNull(message + " LastModified", policy.getLastModified()); + assertEquals(message + " Created & LastModified", policy.getCreated(), policy.getLastModified()); + } + + @Test + public void canCreateAccessPolicy() throws Exception { + String testName = testPolicyPrefix + "CanCreate"; + double duration = 5; + + AccessPolicyInfo policy = service.create(AccessPolicy.create(testName, duration, + EnumSet.of(AccessPolicyPermission.WRITE))); + + verifyPolicyProperties("policy", testName, duration, AccessPolicyPermission.WRITE, policy); + } + + @Test + public void canCreateAccessPolicyWithReadPermissions() throws Exception { + String testName = testPolicyPrefix + "CanCreateRead"; + double duration = 5; + + AccessPolicyInfo policy = service.create(AccessPolicy.create(testName, duration, + EnumSet.of(AccessPolicyPermission.READ))); + + verifyPolicyProperties("policy", testName, duration, AccessPolicyPermission.READ, policy); + } + + @Test + public void canGetSinglePolicyById() throws Exception { + String expectedName = testPolicyPrefix + "GetOne"; + double duration = 1; + AccessPolicyInfo policyToGet = service.create(AccessPolicy.create(expectedName, duration, + EnumSet.of(AccessPolicyPermission.WRITE))); + + AccessPolicyInfo retrievedPolicy = service.get(AccessPolicy.get(policyToGet.getId())); + + assertEquals(policyToGet.getId(), retrievedPolicy.getId()); + verifyPolicyProperties("retrievedPolicy", expectedName, duration, AccessPolicyPermission.WRITE, retrievedPolicy); + } + + @Test + public void canGetSinglePolicyByInvalidId() throws Exception { + expectedException.expect(ServiceException.class); + expectedException.expect(new ServiceExceptionMatcher(400)); + service.get(AccessPolicy.get(invalidId)); + } + + @Test + public void canGetSinglePolicyByNonexistId() throws Exception { + expectedException.expect(ServiceException.class); + expectedException.expect(new ServiceExceptionMatcher(404)); + service.get(AccessPolicy.get(validButNonexistAccessPolicyId)); + } + + @Test + public void canRetrieveListOfAccessPolicies() throws Exception { + String[] policyNames = new String[] { testPolicyPrefix + "ListOne", testPolicyPrefix + "ListTwo" }; + double duration = 3; + EnumSet permissions = EnumSet.of(AccessPolicyPermission.WRITE, + AccessPolicyPermission.LIST); + + List expectedAccessPolicies = new ArrayList(); + for (int i = 0; i < policyNames.length; i++) { + AccessPolicyInfo policy = service.create(AccessPolicy.create(policyNames[i], duration, permissions)); + expectedAccessPolicies.add(policy); + } + + List actualAccessPolicies = service.list(AccessPolicy.list()); + + verifyListResultContains("listAccessPolicies", expectedAccessPolicies, actualAccessPolicies, + new ComponentDelegate() { + @Override + public void verifyEquals(String message, Object expected, Object actual) { + verifyInfosEqual(message, (AccessPolicyInfo) expected, (AccessPolicyInfo) actual); + } + }); + } + + @Test + public void canUseQueryParametersWhenListingAccessPolicies() throws Exception { + String[] policyNames = new String[] { testPolicyPrefix + "ListThree", testPolicyPrefix + "ListFour", + testPolicyPrefix + "ListFive", testPolicyPrefix + "ListSix", testPolicyPrefix + "ListSeven" }; + + double duration = 3; + EnumSet permissions = EnumSet.of(AccessPolicyPermission.WRITE, + AccessPolicyPermission.LIST); + + List expectedAccessPolicies = new ArrayList(); + for (int i = 0; i < policyNames.length; i++) { + AccessPolicyInfo policy = service.create(AccessPolicy.create(policyNames[i], duration, permissions)); + expectedAccessPolicies.add(policy); + } + + List actualAccessPolicies = service.list(AccessPolicy.list().setTop(2)); + + assertEquals(2, actualAccessPolicies.size()); + } + + // Note: Access Policy cannot be updated. + + @Test + public void canDeleteAccessPolicyById() throws Exception { + String policyName = testPolicyPrefix + "ToDelete"; + double duration = 1; + AccessPolicyInfo policyToDelete = service.create(AccessPolicy.create(policyName, duration, + EnumSet.of(AccessPolicyPermission.WRITE))); + List listPoliciesResult = service.list(AccessPolicy.list()); + int policyCountBaseline = listPoliciesResult.size(); + + service.delete(AccessPolicy.delete(policyToDelete.getId())); + + listPoliciesResult = service.list(AccessPolicy.list()); + assertEquals("listPoliciesResult.size", policyCountBaseline - 1, listPoliciesResult.size()); + + for (AccessPolicyInfo policy : service.list(AccessPolicy.list())) { + assertFalse(policyToDelete.getId().equals(policy.getId())); + } + + expectedException.expect(ServiceException.class); + expectedException.expect(new ServiceExceptionMatcher(404)); + service.get(AccessPolicy.get(policyToDelete.getId())); + } + + @Test + public void canDeleteAccessPolicyByInvalidId() throws Exception { + expectedException.expect(ServiceException.class); + expectedException.expect(new ServiceExceptionMatcher(400)); + service.delete(AccessPolicy.delete(invalidId)); + } + + @Test + public void canDeleteAccessPolicyByNonexistId() throws Exception { + expectedException.expect(ServiceException.class); + expectedException.expect(new ServiceExceptionMatcher(404)); + service.delete(AccessPolicy.delete(validButNonexistAccessPolicyId)); + } + + @Test + public void canRetryAccessPolicyCreation() throws Exception { + String name = testPolicyPrefix + "canRetryAccessPolicyCreationPolicy"; + double duration = 1; + EnumSet write = EnumSet.of(AccessPolicyPermission.WRITE); + service.create(AccessPolicy.create(name + "1", duration, write)); + + ExponentialRetryPolicy forceRetryPolicy = new ExponentialRetryPolicy(1, 1, new int[] { 201 }); + MediaContract forceRetryService = service.withFilter(new RetryPolicyFilter(forceRetryPolicy)); + + forceRetryService.create(AccessPolicy.create(name + "2", duration, write)); + } +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/AssetFileIntegrationTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/AssetFileIntegrationTest.java new file mode 100644 index 000000000000..8a9bc1d7b76b --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/AssetFileIntegrationTest.java @@ -0,0 +1,236 @@ +/** + * 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; + +import static org.junit.Assert.*; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.EnumSet; + +import org.junit.BeforeClass; +import org.junit.Test; + +import com.microsoft.windowsazure.services.core.ServiceException; +import com.microsoft.windowsazure.services.media.models.AccessPolicy; +import com.microsoft.windowsazure.services.media.models.AccessPolicyInfo; +import com.microsoft.windowsazure.services.media.models.AccessPolicyPermission; +import com.microsoft.windowsazure.services.media.models.Asset; +import com.microsoft.windowsazure.services.media.models.AssetFile; +import com.microsoft.windowsazure.services.media.models.AssetFileInfo; +import com.microsoft.windowsazure.services.media.models.AssetInfo; +import com.microsoft.windowsazure.services.media.models.ListResult; +import com.microsoft.windowsazure.services.media.models.LocatorInfo; + +public class AssetFileIntegrationTest extends IntegrationTestBase { + + // Some dummy binary data for uploading + private static byte[] firstPrimes = new byte[] { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29 }; + private static byte[] onesAndZeros = new byte[] { 1, 0, 1, 0, 1, 0, 1, 0 }; + private static byte[] countingUp = new byte[] { 3, 4, 5, 6, 7, 8, 9, 10, 11 }; + + private static final String BLOB_NAME = "primes.bin"; + private static final String BLOB_NAME_2 = "primes2.bin"; + + private static AccessPolicyInfo writePolicy; + + @BeforeClass + public static void setup() throws Exception { + IntegrationTestBase.setup(); + + writePolicy = createWritePolicy("uploadWritePolicy", 30); + } + + @Test + public void canCreateFileForUploadedBlob() throws Exception { + AssetInfo asset = createTestAsset("createFileForUploadedBlob"); + LocatorInfo locator = createLocator(writePolicy, asset, 5); + WritableBlobContainerContract blobWriter = service.createBlobWriter(locator); + + createAndUploadBlob(blobWriter, BLOB_NAME, firstPrimes); + + service.action(AssetFile.createFileInfos(asset.getId())); + + ListResult files = service.list(AssetFile.list(asset.getAssetFilesLink())); + + assertEquals(1, files.size()); + AssetFileInfo file = files.get(0); + assertEquals(BLOB_NAME, file.getName()); + } + + @Test + public void canCreateFileEntityDirectly() throws Exception { + AssetInfo asset = createTestAsset("createFileEntityDirectly"); + LocatorInfo locator = createLocator(writePolicy, asset, 5); + WritableBlobContainerContract blobWriter = service.createBlobWriter(locator); + + createAndUploadBlob(blobWriter, BLOB_NAME_2, firstPrimes); + + service.create(AssetFile.create(asset.getId(), BLOB_NAME_2)); + + ListResult files = service.list(AssetFile.list(asset.getAssetFilesLink())); + + boolean found = false; + for (AssetFileInfo file : files) { + if (file.getName().equals(BLOB_NAME_2)) { + found = true; + break; + } + } + + assertTrue(found); + } + + @Test + public void canCreateAssetWithMultipleFiles() throws Exception { + AssetInfo asset = createTestAsset("createWithMultipleFiles"); + AccessPolicyInfo policy = createWritePolicy("createWithMultipleFiles", 10); + LocatorInfo locator = createLocator(policy, asset, 5); + + WritableBlobContainerContract blobWriter = service.createBlobWriter(locator); + + createAndUploadBlob(blobWriter, "blob1.bin", firstPrimes); + createAndUploadBlob(blobWriter, "blob2.bin", onesAndZeros); + createAndUploadBlob(blobWriter, "blob3.bin", countingUp); + + AssetFileInfo file1 = service.create(AssetFile.create(asset.getId(), "blob1.bin").setIsPrimary(true) + .setIsEncrypted(false).setContentFileSize(new Long(firstPrimes.length))); + + AssetFileInfo file2 = service.create(AssetFile.create(asset.getId(), "blob2.bin").setIsPrimary(false) + .setIsEncrypted(false).setContentFileSize(new Long(onesAndZeros.length))); + + AssetFileInfo file3 = service.create(AssetFile.create(asset.getId(), "blob3.bin").setIsPrimary(false) + .setIsEncrypted(false).setContentFileSize(new Long(countingUp.length)).setContentChecksum("1234")); + + ListResult files = service.list(AssetFile.list(asset.getAssetFilesLink())); + + assertEquals(3, files.size()); + + ArrayList results = new ArrayList(files); + Collections.sort(results, new Comparator() { + @Override + public int compare(AssetFileInfo o1, AssetFileInfo o2) { + return o1.getName().compareTo(o2.getName()); + } + }); + + assertAssetFileInfoEquals("results.get(0)", file1, results.get(0)); + assertAssetFileInfoEquals("results.get(1)", file2, results.get(1)); + assertAssetFileInfoEquals("results.get(2)", file3, results.get(2)); + } + + @Test + public void canCreateFileAndThenUpdateIt() throws Exception { + AssetInfo asset = createTestAsset("createAndUpdate"); + AccessPolicyInfo policy = createWritePolicy("createAndUpdate", 10); + LocatorInfo locator = createLocator(policy, asset, 5); + WritableBlobContainerContract blobWriter = service.createBlobWriter(locator); + + createAndUploadBlob(blobWriter, "toUpdate.bin", firstPrimes); + + AssetFileInfo file = service.create(AssetFile.create(asset.getId(), "toUpdate.bin")); + + service.update(AssetFile.update(file.getId()).setMimeType("application/octet-stream")); + + AssetFileInfo fromServer = service.get(AssetFile.get(file.getId())); + + assertEquals("application/octet-stream", fromServer.getMimeType()); + } + + @Test + public void canDeleteFileFromAsset() throws Exception { + AssetInfo asset = createTestAsset("deleteFile"); + AccessPolicyInfo policy = createWritePolicy("deleteFile", 10); + LocatorInfo locator = createLocator(policy, asset, 5); + WritableBlobContainerContract blobWriter = service.createBlobWriter(locator); + + createAndUploadBlob(blobWriter, "todelete.bin", firstPrimes); + createAndUploadBlob(blobWriter, "tokeep.bin", onesAndZeros); + + service.action(AssetFile.createFileInfos(asset.getId())); + + ListResult originalFiles = service.list(AssetFile.list(asset.getAssetFilesLink())); + assertEquals(2, originalFiles.size()); + + for (AssetFileInfo file : originalFiles) { + if (file.getName().equals("todelete.bin")) { + service.delete(AssetFile.delete(file.getId())); + break; + } + } + + ListResult newFiles = service.list(AssetFile.list(asset.getAssetFilesLink())); + assertEquals(1, newFiles.size()); + assertEquals("tokeep.bin", newFiles.get(0).getName()); + } + + // + // Helper functions to create various media services entities + // + private static AssetInfo createTestAsset(String name) throws ServiceException { + return service.create(Asset.create().setName(testAssetPrefix + name)); + } + + private static AccessPolicyInfo createWritePolicy(String name, int durationInMinutes) throws ServiceException { + return service.create(AccessPolicy.create(testPolicyPrefix + name, durationInMinutes, + EnumSet.of(AccessPolicyPermission.WRITE))); + } + + private static void createAndUploadBlob(WritableBlobContainerContract blobWriter, String blobName, byte[] data) + throws ServiceException { + InputStream blobContent = new ByteArrayInputStream(data); + blobWriter.createBlockBlob(blobName, blobContent); + } + + // + // Assertion helpers + // + + private void assertAssetFileInfoEquals(String message, AssetFileInfo expected, AssetFileInfo actual) { + verifyAssetInfoProperties(message, expected.getId(), expected.getName(), expected.getParentAssetId(), + expected.getIsPrimary(), expected.getIsEncrypted(), expected.getEncryptionKeyId(), + expected.getEncryptionScheme(), expected.getEncryptionVersion(), expected.getInitializationVector(), + expected.getCreated(), expected.getLastModified(), expected.getContentChecksum(), + expected.getMimeType(), actual); + } + + private void verifyAssetInfoProperties(String message, String id, String name, String parentAssetId, + boolean isPrimary, boolean isEncrypted, String encryptionKeyId, String encryptionScheme, + String encryptionVersion, String initializationVector, Date created, Date lastModified, + String contentChecksum, String mimeType, AssetFileInfo assetFile) { + assertNotNull(message, assetFile); + + assertEquals(message + ".getId", id, assetFile.getId()); + assertEquals(message + ".getName", name, assetFile.getName()); + assertEquals(message + ".getParentAssetId", parentAssetId, assetFile.getParentAssetId()); + assertEquals(message + ".getIsPrimary", isPrimary, assetFile.getIsPrimary()); + + assertEquals(message + ".getIsEncrypted", isEncrypted, assetFile.getIsEncrypted()); + assertEquals(message + ".getEncryptionKeyId", encryptionKeyId, assetFile.getEncryptionKeyId()); + assertEquals(message + ".getEncryptionScheme", encryptionScheme, assetFile.getEncryptionScheme()); + assertEquals(message + ".getEncryptionVersion", encryptionVersion, assetFile.getEncryptionVersion()); + assertEquals(message + ".getInitializationVector", initializationVector, assetFile.getInitializationVector()); + + assertDateApproxEquals(message + ".getCreated", created, assetFile.getCreated()); + assertDateApproxEquals(message + ".getLastModified", lastModified, assetFile.getLastModified()); + assertEquals(message + ".getContentChecksum", contentChecksum, assetFile.getContentChecksum()); + assertEquals(message + ".getMimeType", mimeType, assetFile.getMimeType()); + } +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/AssetIntegrationTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/AssetIntegrationTest.java new file mode 100644 index 000000000000..2c012d168f51 --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/AssetIntegrationTest.java @@ -0,0 +1,358 @@ +/** + * 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; + +import static org.junit.Assert.*; + +import java.io.InputStream; +import java.net.URISyntaxException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; +import java.util.EnumSet; +import java.util.List; +import java.util.UUID; + +import org.junit.Test; + +import com.microsoft.windowsazure.services.core.ServiceException; +import com.microsoft.windowsazure.services.media.models.AccessPolicy; +import com.microsoft.windowsazure.services.media.models.AccessPolicyInfo; +import com.microsoft.windowsazure.services.media.models.AccessPolicyPermission; +import com.microsoft.windowsazure.services.media.models.Asset; +import com.microsoft.windowsazure.services.media.models.AssetFile; +import com.microsoft.windowsazure.services.media.models.AssetInfo; +import com.microsoft.windowsazure.services.media.models.AssetOption; +import com.microsoft.windowsazure.services.media.models.AssetState; +import com.microsoft.windowsazure.services.media.models.ContentKey; +import com.microsoft.windowsazure.services.media.models.ContentKeyInfo; +import com.microsoft.windowsazure.services.media.models.ContentKeyType; +import com.microsoft.windowsazure.services.media.models.Job; +import com.microsoft.windowsazure.services.media.models.JobInfo; +import com.microsoft.windowsazure.services.media.models.LinkInfo; +import com.microsoft.windowsazure.services.media.models.ListResult; +import com.microsoft.windowsazure.services.media.models.Locator; +import com.microsoft.windowsazure.services.media.models.LocatorInfo; +import com.microsoft.windowsazure.services.media.models.LocatorType; +import com.microsoft.windowsazure.services.media.models.Task; +import com.microsoft.windowsazure.services.media.models.Task.CreateBatchOperation; + +public class AssetIntegrationTest extends IntegrationTestBase { + + private void verifyInfosEqual(String message, AssetInfo expected, AssetInfo actual) { + verifyAssetProperties(message, expected.getName(), expected.getAlternateId(), expected.getOptions(), + expected.getState(), actual); + } + + private void verifyAssetProperties(String message, String testName, String altId, AssetOption encryptionOption, + AssetState assetState, AssetInfo actualAsset) { + verifyAssetProperties(message, testName, altId, encryptionOption, assetState, null, null, null, actualAsset); + } + + private void verifyAssetProperties(String message, String testName, String altId, AssetOption encryptionOption, + AssetState assetState, String id, Date created, Date lastModified, AssetInfo actualAsset) { + assertNotNull(message, actualAsset); + assertEquals(message + " Name", testName, actualAsset.getName()); + assertEquals(message + " AlternateId", altId, actualAsset.getAlternateId()); + assertEquals(message + " Options", encryptionOption, actualAsset.getOptions()); + assertEquals(message + " State", assetState, actualAsset.getState()); + if (id != null) { + assertEquals(message + " Id", id, actualAsset.getId()); + } + if (created != null) { + assertEquals(message + " Created", created, actualAsset.getCreated()); + } + if (lastModified != null) { + assertEquals(message + " LastModified", lastModified, actualAsset.getLastModified()); + } + } + + @Test + public void createAssetOptionsSuccess() throws Exception { + // Arrange + String testName = testAssetPrefix + "createAssetOptionsSuccess"; + String altId = "altId"; + AssetOption encryptionOption = AssetOption.StorageEncrypted; + AssetState assetState = AssetState.Published; + + // Act + AssetInfo actualAsset = service.create(Asset.create().setAlternateId(altId).setOptions(encryptionOption) + .setState(assetState).setName(testName)); + + // Assert + verifyAssetProperties("actualAsset", testName, altId, encryptionOption, assetState, actualAsset); + } + + @Test + public void createAssetMeanString() throws Exception { + // Arrange + String meanString = "'\"(?++\\+&==/&?''$@:// +ne " + + "{\"jsonLike\":\"Created\":\"\\/Date(1336368841597)\\/\",\"Name\":null,cksum value\"}}" + + "Some unicode: \uB2E4\uB974\uB2E4\uB294\u0625 \u064A\u062F\u064A\u0648\u0009\r\n"; + + String testName = testAssetPrefix + "createAssetMeanString" + meanString; + + // Act + AssetInfo actualAsset = service.create(Asset.create().setName(testName)); + + // Assert + assertEquals("actualAsset Name", testName, actualAsset.getName()); + } + + @Test + public void createAssetNullNameSuccess() throws Exception { + // Arrange + + // Act + AssetInfo actualAsset = null; + try { + actualAsset = service.create(Asset.create()); + // Assert + verifyAssetProperties("actualAsset", "", "", AssetOption.None, AssetState.Initialized, actualAsset); + } + finally { + // Clean up the anonymous asset now while we have the id, because we + // do not want to delete all anonymous assets in the bulk-cleanup code. + try { + if (actualAsset != null) { + service.delete(Asset.delete(actualAsset.getId())); + } + } + catch (ServiceException ex) { + ex.printStackTrace(); + } + } + } + + @Test + public void getAssetSuccess() throws Exception { + // Arrange + String testName = testAssetPrefix + "GetAssetSuccess"; + String altId = "altId"; + AssetOption encryptionOption = AssetOption.StorageEncrypted; + AssetState assetState = AssetState.Published; + + AssetInfo assetInfo = service.create(Asset.create().setName(testName).setAlternateId(altId) + .setOptions(encryptionOption).setState(assetState)); + + // Act + AssetInfo actualAsset = service.get(Asset.get(assetInfo.getId())); + + // Assert + verifyInfosEqual("actualAsset", assetInfo, actualAsset); + } + + @Test + public void getAssetInvalidId() throws ServiceException { + expectedException.expect(ServiceException.class); + expectedException.expect(new ServiceExceptionMatcher(400)); + service.get(Asset.get(invalidId)); + } + + @Test + public void getAssetNonexistId() throws ServiceException { + expectedException.expect(ServiceException.class); + expectedException.expect(new ServiceExceptionMatcher(404)); + service.get(Asset.get(validButNonexistAssetId)); + } + + @Test + public void listAssetSuccess() throws ServiceException { + // Arrange + String altId = "altId"; + AssetOption encryptionOption = AssetOption.StorageEncrypted; + AssetState assetState = AssetState.Published; + + String[] assetNames = new String[] { testAssetPrefix + "assetA", testAssetPrefix + "assetB" }; + List expectedAssets = new ArrayList(); + for (int i = 0; i < assetNames.length; i++) { + String name = assetNames[i]; + expectedAssets.add(service.create(Asset.create().setName(name).setAlternateId(altId) + .setOptions(encryptionOption).setState(assetState))); + } + + // Act + Collection listAssetResult = service.list(Asset.list()); + + // Assert + + verifyListResultContains("listAssets", expectedAssets, listAssetResult, new ComponentDelegate() { + @Override + public void verifyEquals(String message, Object expected, Object actual) { + verifyInfosEqual(message, (AssetInfo) expected, (AssetInfo) actual); + } + }); + } + + @Test + public void canListAssetsWithOptions() throws ServiceException { + String[] assetNames = new String[] { testAssetPrefix + "assetListOptionsA", + testAssetPrefix + "assetListOptionsB", testAssetPrefix + "assetListOptionsC", + testAssetPrefix + "assetListOptionsD" }; + List expectedAssets = new ArrayList(); + for (int i = 0; i < assetNames.length; i++) { + String name = assetNames[i]; + expectedAssets.add(service.create(Asset.create().setName(name))); + } + + Collection listAssetResult = service.list(Asset.list().setTop(2)); + + // Assert + + assertEquals(2, listAssetResult.size()); + } + + @Test + public void updateAssetSuccess() throws Exception { + // Arrange + String originalTestName = testAssetPrefix + "updateAssetSuccessOriginal"; + AssetOption originalEncryptionOption = AssetOption.StorageEncrypted; + AssetState originalAssetState = AssetState.Initialized; + AssetInfo originalAsset = service.create(Asset.create().setName(originalTestName).setAlternateId("altId") + .setOptions(originalEncryptionOption)); + + String updatedTestName = testAssetPrefix + "updateAssetSuccessUpdated"; + String altId = "otherAltId"; + + // Act + service.update(Asset.update(originalAsset.getId()).setName(updatedTestName).setAlternateId(altId)); + AssetInfo updatedAsset = service.get(Asset.get(originalAsset.getId())); + + // Assert + verifyAssetProperties("updatedAsset", updatedTestName, altId, originalEncryptionOption, originalAssetState, + updatedAsset); + } + + @Test + public void updateAssetNoChangesSuccess() throws Exception { + // Arrange + String originalTestName = testAssetPrefix + "updateAssetNoChangesSuccess"; + String altId = "altId"; + AssetInfo originalAsset = service.create(Asset.create().setName(originalTestName).setAlternateId(altId)); + + // Act + service.update(Asset.update(originalAsset.getId())); + AssetInfo updatedAsset = service.get(Asset.get(originalAsset.getId())); + + // Assert + verifyInfosEqual("updatedAsset", originalAsset, updatedAsset); + } + + @Test + public void updateAssetFailedWithInvalidId() throws ServiceException { + expectedException.expect(ServiceException.class); + expectedException.expect(new ServiceExceptionMatcher(404)); + service.update(Asset.update(validButNonexistAssetId)); + } + + @Test + public void deleteAssetSuccess() throws Exception { + // Arrange + String assetName = testAssetPrefix + "deleteAssetSuccess"; + AssetInfo assetInfo = service.create(Asset.create().setName(assetName)); + List listAssetsResult = service.list(Asset.list()); + int assetCountBaseline = listAssetsResult.size(); + + // Act + service.delete(Asset.delete(assetInfo.getId())); + + // Assert + listAssetsResult = service.list(Asset.list()); + assertEquals("listAssetsResult.size", assetCountBaseline - 1, listAssetsResult.size()); + + expectedException.expect(ServiceException.class); + expectedException.expect(new ServiceExceptionMatcher(404)); + service.get(Asset.get(assetInfo.getId())); + } + + @Test + public void deleteAssetFailedWithInvalidId() throws ServiceException { + expectedException.expect(ServiceException.class); + expectedException.expect(new ServiceExceptionMatcher(404)); + service.delete(Asset.delete(validButNonexistAssetId)); + } + + @Test + public void linkAssetContentKeySuccess() throws ServiceException, URISyntaxException { + // Arrange + String originalTestName = testAssetPrefix + "linkAssetContentKeyInvalidIdFailed"; + AssetInfo assetInfo = service.create(Asset.create().setName(originalTestName) + .setOptions(AssetOption.StorageEncrypted)); + String contentKeyId = String.format("nb:kid:UUID:%s", UUID.randomUUID()); + String encryptedContentKey = "dummyEncryptedContentKey"; + service.create(ContentKey.create(contentKeyId, ContentKeyType.StorageEncryption, encryptedContentKey)); + + // Act + service.action(Asset.linkContentKey(assetInfo.getId(), contentKeyId)); + + // Assert + + List contentKeys = service.list(ContentKey.list(assetInfo.getContentKeysLink())); + assertEquals(1, contentKeys.size()); + assertEquals(contentKeyId, contentKeys.get(0).getId()); + } + + @Test + public void linkAssetContentKeyInvalidIdFailed() throws ServiceException, URISyntaxException { + // Arrange + + // Act + expectedException.expect(ServiceException.class); + expectedException.expect(new ServiceExceptionMatcher(400)); + service.action(Asset.linkContentKey(validButNonexistAssetId, "nb:kid:UUID:invalidContentKeyId")); + + // Assert + } + + @Test + public void canGetParentBackFromAsset() throws ServiceException, InterruptedException { + // Arrange + String originalAssetName = testAssetPrefix + "canGetParentBackFromAsset"; + AssetInfo originalAsset = service.create(Asset.create().setName(originalAssetName)); + + int durationInMinutes = 10; + AccessPolicyInfo accessPolicyInfo = service.create(AccessPolicy.create(testPolicyPrefix + + "uploadAesPortectedAssetSuccess", durationInMinutes, EnumSet.of(AccessPolicyPermission.WRITE))); + + LocatorInfo locatorInfo = service.create(Locator.create(accessPolicyInfo.getId(), originalAsset.getId(), + LocatorType.SAS)); + WritableBlobContainerContract blobWriter = service.createBlobWriter(locatorInfo); + + InputStream mpeg4H264InputStream = getClass().getResourceAsStream("/media/MPEG4-H264.mp4"); + blobWriter.createBlockBlob("MPEG4-H264.mp4", mpeg4H264InputStream); + service.action(AssetFile.createFileInfos(originalAsset.getId())); + + String jobName = testJobPrefix + "createJobSuccess"; + CreateBatchOperation taskCreator = Task + .create(MEDIA_ENCODER_MEDIA_PROCESSOR_2_2_0_0_ID, + "" + "JobInputAsset(0)" + + "JobOutputAsset(0)" + "") + .setConfiguration("H.264 256k DSL CBR").setName("My encoding Task"); + JobInfo jobInfo = service.create(Job.create().setName(jobName).addInputMediaAsset(originalAsset.getId()) + .addTaskCreator(taskCreator)); + + // Act + ListResult outputAssets = service.list(Asset.list(jobInfo.getOutputAssetsLink())); + assertEquals(1, outputAssets.size()); + AssetInfo childAsset = outputAssets.get(0); + + LinkInfo parentAssetLink = childAsset.getParentAssetsLink(); + AssetInfo parentAsset = service.get(Asset.get(parentAssetLink)); + + // Assert + assertEquals(originalAsset.getId(), parentAsset.getId()); + } +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/ContentKeyIntegrationTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/ContentKeyIntegrationTest.java new file mode 100644 index 000000000000..3f479a6ea8b7 --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/ContentKeyIntegrationTest.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.windowsazure.services.media; + +import static org.junit.Assert.*; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +import org.junit.Test; + +import com.microsoft.windowsazure.services.core.ServiceException; +import com.microsoft.windowsazure.services.media.models.ContentKey; +import com.microsoft.windowsazure.services.media.models.ContentKeyInfo; +import com.microsoft.windowsazure.services.media.models.ContentKeyType; +import com.microsoft.windowsazure.services.media.models.ProtectionKeyType; + +public class ContentKeyIntegrationTest extends IntegrationTestBase { + + private final String validButNonexistContentKeyId = "nb:kid:UUID:80dfe751-e5a1-4b29-a992-4a75276473af"; + private final ContentKeyType testContentKeyType = ContentKeyType.CommonEncryption; + private final String testEncryptedContentKey = "ThisIsEncryptedContentKey"; + + private String createRandomContentKeyId() { + UUID uuid = UUID.randomUUID(); + String randomContentKey = String.format("nb:kid:UUID:%s", uuid); + return randomContentKey; + } + + private void verifyInfosEqual(String message, ContentKeyInfo expected, ContentKeyInfo actual) { + verifyContentKeyProperties(message, expected.getId(), expected.getContentKeyType(), + expected.getEncryptedContentKey(), expected.getName(), expected.getProtectionKeyId(), + expected.getProtectionKeyType(), expected.getChecksum(), actual); + } + + private void verifyContentKeyProperties(String message, String id, ContentKeyType contentKeyType, + String encryptedContentKey, String name, String protectionKeyId, ProtectionKeyType protectionKeyType, + String checksum, ContentKeyInfo actual) { + assertNotNull(message, actual); + assertEquals(message + " Id", id, actual.getId()); + assertEquals(message + " ContentKeyType", contentKeyType, actual.getContentKeyType()); + assertEquals(message + " EncryptedContentKey", encryptedContentKey, actual.getEncryptedContentKey()); + assertEquals(message + " Name", name, actual.getName()); + assertEquals(message + " ProtectionKeyId", protectionKeyId, actual.getProtectionKeyId()); + assertEquals(message + " ProtectionKeyType", protectionKeyType, actual.getProtectionKeyType()); + assertEquals(message + " Checksum", checksum, actual.getChecksum()); + } + + @Test + public void canCreateContentKey() throws Exception { + // Arrange + String testCanCreateContentKeyId = createRandomContentKeyId(); + String testCanCreateContentKeyName = "testCanCreateContentKey"; + + // Act + ContentKeyInfo contentKeyInfo = service.create(ContentKey.create(testCanCreateContentKeyId, testContentKeyType, + testEncryptedContentKey).setName(testCanCreateContentKeyName)); + + // Assert + verifyContentKeyProperties("ContentKey", testCanCreateContentKeyId, testContentKeyType, + testEncryptedContentKey, testCanCreateContentKeyName, "", ProtectionKeyType.fromCode(0), "", + contentKeyInfo); + } + + @Test + public void canGetSingleContentKeyById() throws Exception { + // Arrange + String expectedName = testContentKeyPrefix + "GetOne"; + String testGetSingleContentKeyByIdId = createRandomContentKeyId(); + ContentKeyInfo ContentKeyToGet = service.create(ContentKey.create(testGetSingleContentKeyByIdId, + testContentKeyType, testEncryptedContentKey).setName(expectedName)); + + // Act + ContentKeyInfo retrievedContentKeyInfo = service.get(ContentKey.get(ContentKeyToGet.getId())); + + // Assert + assertEquals(ContentKeyToGet.getId(), retrievedContentKeyInfo.getId()); + verifyContentKeyProperties("ContentKey", testGetSingleContentKeyByIdId, testContentKeyType, + testEncryptedContentKey, expectedName, "", ProtectionKeyType.fromCode(0), "", retrievedContentKeyInfo); + } + + @Test + public void cannotGetSingleContentKeyByInvalidId() throws Exception { + expectedException.expect(ServiceException.class); + expectedException.expect(new ServiceExceptionMatcher(400)); + service.get(ContentKey.get(invalidId)); + } + + @Test + public void canRetrieveListOfContentKeys() throws Exception { + String[] ContentKeyNames = new String[] { testContentKeyPrefix + "ListOne", testContentKeyPrefix + "ListTwo" }; + + List expectedContentKeys = new ArrayList(); + for (int i = 0; i < ContentKeyNames.length; i++) { + String testCanRetrieveListOfContentKeysId = createRandomContentKeyId(); + ContentKeyInfo contentKey = service.create(ContentKey.create(testCanRetrieveListOfContentKeysId, + testContentKeyType, testEncryptedContentKey)); + expectedContentKeys.add(contentKey); + } + + List actualContentKeys = service.list(ContentKey.list()); + + verifyListResultContains("listContentKeyss", expectedContentKeys, actualContentKeys, new ComponentDelegate() { + @Override + public void verifyEquals(String message, Object expected, Object actual) { + verifyInfosEqual(message, (ContentKeyInfo) expected, (ContentKeyInfo) actual); + } + }); + } + + @Test + public void canUseQueryParametersWhenListingContentKeys() throws Exception { + String[] ContentKeyNames = new String[] { testContentKeyPrefix + "ListThree", + testContentKeyPrefix + "ListFour", testContentKeyPrefix + "ListFive", testContentKeyPrefix + "ListSix", + testContentKeyPrefix + "ListSeven" }; + + List expectedContentKeys = new ArrayList(); + for (int i = 0; i < ContentKeyNames.length; i++) { + ContentKeyInfo contentKeyInfo = service.create(ContentKey.create(createRandomContentKeyId(), + testContentKeyType, testEncryptedContentKey)); + expectedContentKeys.add(contentKeyInfo); + } + + List actualContentKeys = service.list(ContentKey.list().setTop(2)); + + assertEquals(2, actualContentKeys.size()); + } + + @Test + public void canDeleteContentKeyById() throws Exception { + String contentKeyName = testContentKeyPrefix + "ToDelete"; + ContentKeyInfo contentKeyToDelete = service.create(ContentKey.create(createRandomContentKeyId(), + testContentKeyType, testEncryptedContentKey).setName(contentKeyName)); + List listContentKeysResult = service.list(ContentKey.list()); + int ContentKeyCountBaseline = listContentKeysResult.size(); + + service.delete(ContentKey.delete(contentKeyToDelete.getId())); + + listContentKeysResult = service.list(ContentKey.list()); + assertEquals("listPoliciesResult.size", ContentKeyCountBaseline - 1, listContentKeysResult.size()); + + for (ContentKeyInfo contentKey : service.list(ContentKey.list())) { + assertFalse(contentKeyToDelete.getId().equals(contentKey.getId())); + } + + expectedException.expect(ServiceException.class); + expectedException.expect(new ServiceExceptionMatcher(404)); + service.get(ContentKey.get(contentKeyToDelete.getId())); + } + + @Test + public void cannotDeleteContentKeyByInvalidId() throws Exception { + expectedException.expect(ServiceException.class); + expectedException.expect(new ServiceExceptionMatcher(400)); + service.delete(ContentKey.delete(invalidId)); + } + + @Test + public void cannotDeleteContentKeyByNonexistId() throws Exception { + expectedException.expect(ServiceException.class); + expectedException.expect(new ServiceExceptionMatcher(404)); + service.delete(ContentKey.delete(validButNonexistContentKeyId)); + } + +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/EncryptionHelper.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/EncryptionHelper.java new file mode 100644 index 000000000000..5954e6a8cdc4 --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/EncryptionHelper.java @@ -0,0 +1,77 @@ +/** + * 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; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.security.Key; +import java.security.SecureRandom; +import java.security.cert.Certificate; +import java.security.cert.CertificateFactory; + +import javax.crypto.Cipher; +import javax.crypto.CipherInputStream; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; + +import com.microsoft.windowsazure.services.core.storage.utils.Base64; + +class EncryptionHelper { + public static boolean canUseStrongCrypto() { + try { + Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding"); + SecretKeySpec secretKeySpec = new SecretKeySpec(new byte[32], "AES"); + cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec); + } + catch (Exception e) { + return false; + } + return true; + } + + public static byte[] encryptSymmetricKey(String protectionKey, byte[] inputData) throws Exception { + Cipher cipher = Cipher.getInstance("RSA/ECB/OAEPWithSHA-1AndMGF1Padding"); + CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); + byte[] protectionKeyBytes = Base64.decode(protectionKey); + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(protectionKeyBytes); + Certificate certificate = certificateFactory.generateCertificate(byteArrayInputStream); + Key publicKey = certificate.getPublicKey(); + SecureRandom secureRandom = new SecureRandom(); + cipher.init(Cipher.ENCRYPT_MODE, publicKey, secureRandom); + byte[] cipherText = cipher.doFinal(inputData); + return cipherText; + } + + public static String calculateContentKeyChecksum(String uuid, byte[] aesKey) throws Exception { + Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding"); + SecretKeySpec secretKeySpec = new SecretKeySpec(aesKey, "AES"); + cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec); + byte[] encryptionResult = cipher.doFinal(uuid.getBytes("UTF8")); + byte[] checksumByteArray = new byte[8]; + System.arraycopy(encryptionResult, 0, checksumByteArray, 0, 8); + String checksum = Base64.encode(checksumByteArray); + return checksum; + } + + public static InputStream encryptFile(InputStream inputStream, byte[] key, byte[] iv) throws Exception { + Cipher cipher = Cipher.getInstance("AES/CTR/NoPadding"); + SecretKeySpec keySpec = new SecretKeySpec(key, "AES"); + IvParameterSpec ivParameterSpec = new IvParameterSpec(iv); + cipher.init(Cipher.ENCRYPT_MODE, keySpec, ivParameterSpec); + CipherInputStream cipherInputStream = new CipherInputStream(inputStream, cipher); + return cipherInputStream; + } +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/EncryptionIntegrationTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/EncryptionIntegrationTest.java new file mode 100644 index 000000000000..964bafa5072e --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/EncryptionIntegrationTest.java @@ -0,0 +1,243 @@ +/** + * 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; + +import static org.junit.Assert.*; + +import java.io.IOException; +import java.io.InputStream; +import java.math.BigInteger; +import java.net.URL; +import java.util.EnumSet; +import java.util.List; +import java.util.Random; +import java.util.UUID; + +import junit.framework.Assert; + +import org.junit.Test; + +import com.microsoft.windowsazure.services.core.ServiceException; +import com.microsoft.windowsazure.services.core.storage.utils.Base64; +import com.microsoft.windowsazure.services.media.models.AccessPolicy; +import com.microsoft.windowsazure.services.media.models.AccessPolicyInfo; +import com.microsoft.windowsazure.services.media.models.AccessPolicyPermission; +import com.microsoft.windowsazure.services.media.models.Asset; +import com.microsoft.windowsazure.services.media.models.AssetFile; +import com.microsoft.windowsazure.services.media.models.AssetFileInfo; +import com.microsoft.windowsazure.services.media.models.AssetInfo; +import com.microsoft.windowsazure.services.media.models.AssetOption; +import com.microsoft.windowsazure.services.media.models.ContentKey; +import com.microsoft.windowsazure.services.media.models.ContentKeyInfo; +import com.microsoft.windowsazure.services.media.models.ContentKeyType; +import com.microsoft.windowsazure.services.media.models.Job; +import com.microsoft.windowsazure.services.media.models.JobInfo; +import com.microsoft.windowsazure.services.media.models.JobState; +import com.microsoft.windowsazure.services.media.models.LinkInfo; +import com.microsoft.windowsazure.services.media.models.ListResult; +import com.microsoft.windowsazure.services.media.models.Locator; +import com.microsoft.windowsazure.services.media.models.LocatorInfo; +import com.microsoft.windowsazure.services.media.models.LocatorType; +import com.microsoft.windowsazure.services.media.models.MediaProcessor; +import com.microsoft.windowsazure.services.media.models.MediaProcessorInfo; +import com.microsoft.windowsazure.services.media.models.ProtectionKey; +import com.microsoft.windowsazure.services.media.models.Task; +import com.microsoft.windowsazure.services.media.models.TaskInfo; +import com.microsoft.windowsazure.services.media.models.TaskState; + +public class EncryptionIntegrationTest extends IntegrationTestBase { + private final String strorageDecryptionProcessor = "Storage Decryption"; + + @Test + public void uploadAesProtectedAssetAndDownloadSuccess() throws Exception { + // Arrange + if (!EncryptionHelper.canUseStrongCrypto()) { + Assert.fail("JVM does not support the required encryption"); + } + + // Media Services requires 256-bit (32-byte) keys and + // 128-bit (16-byte) initialization vectors (IV) for AES encryption, + // and also requires that only the first 8 bytes of the IV is filled. + Random random = new Random(); + byte[] aesKey = new byte[32]; + random.nextBytes(aesKey); + byte[] effectiveIv = new byte[8]; + random.nextBytes(effectiveIv); + byte[] iv = new byte[16]; + System.arraycopy(effectiveIv, 0, iv, 0, effectiveIv.length); + + InputStream mpeg4H264InputStream = getClass().getResourceAsStream("/media/MPEG4-H264.mp4"); + InputStream encryptedContent = EncryptionHelper.encryptFile(mpeg4H264InputStream, aesKey, iv); + int durationInMinutes = 10; + + // Act + AssetInfo assetInfo = service.create(Asset.create().setName(testAssetPrefix + "uploadAesProtectedAssetSuccess") + .setOptions(AssetOption.StorageEncrypted)); + WritableBlobContainerContract blobWriter = getBlobWriter(assetInfo.getId(), durationInMinutes); + + // gets the public key for storage encryption. + String contentKeyId = makeContentKeyId(aesKey); + + // link the content key with the asset. + service.action(Asset.linkContentKey(assetInfo.getId(), contentKeyId)); + + // upload the encrypted file to the server. + uploadEncryptedAssetFile(assetInfo, blobWriter, "MPEG4-H264.mp4", encryptedContent, contentKeyId, iv); + + // submit and execute the decoding job. + JobInfo jobInfo = decodeAsset("uploadAesProtectedAssetSuccess", assetInfo.getId()); + + // assert + LinkInfo taskLinkInfo = jobInfo.getTasksLink(); + List taskInfos = service.list(Task.list(taskLinkInfo)); + for (TaskInfo taskInfo : taskInfos) { + assertEquals(TaskState.Completed, taskInfo.getState()); + ListResult outputs = service.list(Asset.list(taskInfo.getOutputAssetsLink())); + assertEquals(1, outputs.size()); + } + assertEquals(JobState.Finished, jobInfo.getState()); + + // Verify that the contents match + InputStream expected = getClass().getResourceAsStream("/media/MPEG4-H264.mp4"); + + ListResult outputAssets = service.list(Asset.list(jobInfo.getOutputAssetsLink())); + assertEquals(1, outputAssets.size()); + AssetInfo outputAsset = outputAssets.get(0); + ListResult assetFiles = service.list(AssetFile.list(assetInfo.getAssetFilesLink())); + assertEquals(1, assetFiles.size()); + AssetFileInfo outputFile = assetFiles.get(0); + + InputStream actual = getFileContents(outputAsset.getId(), outputFile.getName(), durationInMinutes); + assertStreamsEqual(expected, actual); + } + + private JobInfo decodeAsset(String name, String inputAssetId) throws ServiceException, InterruptedException { + MediaProcessorInfo mediaProcessorInfo = service.list( + MediaProcessor.list().set("$filter", "Name eq '" + strorageDecryptionProcessor + "'")).get(0); + + String taskBody = "" + + "JobInputAsset(0)JobOutputAsset(0)"; + JobInfo jobInfo = service.create(Job.create().addInputMediaAsset(inputAssetId) + .addTaskCreator(Task.create(mediaProcessorInfo.getId(), taskBody).setName(name))); + + JobInfo currentJobInfo = jobInfo; + int retryCounter = 0; + while (currentJobInfo.getState().getCode() < 3 && retryCounter < 30) { + Thread.sleep(10000); + currentJobInfo = service.get(Job.get(jobInfo.getId())); + retryCounter++; + } + return currentJobInfo; + } + + private String makeContentKeyId(byte[] aesKey) throws ServiceException, Exception { + String protectionKeyId = service.action(ProtectionKey.getProtectionKeyId(ContentKeyType.StorageEncryption)); + String protectionKey = service.action(ProtectionKey.getProtectionKey(protectionKeyId)); + + String contentKeyIdUuid = UUID.randomUUID().toString(); + String contentKeyId = String.format("nb:kid:UUID:%s", contentKeyIdUuid); + + byte[] encryptedContentKey = EncryptionHelper.encryptSymmetricKey(protectionKey, aesKey); + String encryptedContentKeyString = Base64.encode(encryptedContentKey); + String checksum = EncryptionHelper.calculateContentKeyChecksum(contentKeyIdUuid, aesKey); + + ContentKeyInfo contentKeyInfo = service.create(ContentKey + .create(contentKeyId, ContentKeyType.StorageEncryption, encryptedContentKeyString) + .setChecksum(checksum).setProtectionKeyId(protectionKeyId)); + return contentKeyInfo.getId(); + } + + private void uploadEncryptedAssetFile(AssetInfo asset, WritableBlobContainerContract blobWriter, String blobName, + InputStream blobContent, String encryptionKeyId, byte[] iv) throws ServiceException { + blobWriter.createBlockBlob(blobName, blobContent); + service.action(AssetFile.createFileInfos(asset.getId())); + ListResult files = service.list(AssetFile.list(asset.getAssetFilesLink()).set("$filter", + "Name eq '" + blobName + "'")); + assertEquals(1, files.size()); + AssetFileInfo file = files.get(0); + byte[] sub = new byte[9]; + // Offset bytes to ensure that the sign-bit is not set. + // Media Services expects unsigned Int64 values. + System.arraycopy(iv, 0, sub, 1, 8); + BigInteger longIv = new BigInteger(sub); + String initializationVector = longIv.toString(); + + service.update(AssetFile.update(file.getId()).setIsEncrypted(true).setEncryptionKeyId(encryptionKeyId) + .setEncryptionScheme("StorageEncryption").setEncryptionVersion("1.0") + .setInitializationVector(initializationVector)); + } + + private WritableBlobContainerContract getBlobWriter(String assetId, int durationInMinutes) throws ServiceException { + AccessPolicyInfo accessPolicyInfo = service.create(AccessPolicy.create(testPolicyPrefix + + "uploadAesPortectedAssetSuccess", durationInMinutes, EnumSet.of(AccessPolicyPermission.WRITE))); + + // creates locator for the input media asset + LocatorInfo locatorInfo = service.create(Locator.create(accessPolicyInfo.getId(), assetId, LocatorType.SAS)); + WritableBlobContainerContract blobWriter = service.createBlobWriter(locatorInfo); + return blobWriter; + } + + private InputStream getFileContents(String assetId, String fileName, int availabilityWindowInMinutes) + throws ServiceException, InterruptedException, IOException { + AccessPolicyInfo readAP = service.create(AccessPolicy.create(testPolicyPrefix + "tempAccessPolicy", + availabilityWindowInMinutes, EnumSet.of(AccessPolicyPermission.READ))); + LocatorInfo readLocator = service.create(Locator.create(readAP.getId(), assetId, LocatorType.SAS)); + URL file = new URL(readLocator.getBaseUri() + "/" + fileName + readLocator.getContentAccessToken()); + + // There can be a delay before a new read locator is applied for the asset files. + InputStream reader = null; + for (int counter = 0; true; counter++) { + try { + reader = file.openConnection().getInputStream(); + break; + } + catch (IOException e) { + System.out.println("Got error, wait a bit and try again"); + if (counter < 6) { + Thread.sleep(10000); + } + else { + // No more retries. + throw e; + } + } + } + + return reader; + } + + private void assertStreamsEqual(InputStream inputStream1, InputStream inputStream2) throws IOException { + byte[] buffer1 = new byte[1024]; + byte[] buffer2 = new byte[1024]; + try { + while (true) { + int n1 = inputStream1.read(buffer1); + int n2 = inputStream2.read(buffer2); + assertEquals("number of bytes read from streams", n1, n2); + if (n1 == -1) { + break; + } + for (int i = 0; i < n1; i++) { + assertEquals("byte " + i + " read from streams", buffer1[i], buffer2[i]); + } + } + } + finally { + inputStream1.close(); + inputStream2.close(); + } + } +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/EntityProxyTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/EntityProxyTest.java new file mode 100644 index 000000000000..0d1ca0c78999 --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/EntityProxyTest.java @@ -0,0 +1,148 @@ +/** + * 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; + +import static org.junit.Assert.*; + +import java.util.HashSet; +import java.util.Set; + +import org.junit.BeforeClass; +import org.junit.Test; + +import com.microsoft.windowsazure.services.media.models.Asset; +import com.microsoft.windowsazure.services.media.models.AssetInfo; +import com.microsoft.windowsazure.services.media.models.ListResult; + +public class EntityProxyTest extends IntegrationTestBase { + private static MediaContract entityService; + + @BeforeClass + public static void entityProxyTestSetup() { + entityService = config.create(MediaContract.class); + } + + @Test + public void canCreateEntityProxy() { + assertNotNull(entityService); + } + + @Test + public void canCreateDefaultAssetEntity() throws Exception { + + AssetInfo asset = entityService.create(Asset.create()); + + assertNotNull(asset.getId()); + } + + @Test + public void canCreateAssetOnServerWithNameAndAltId() throws Exception { + String name = testAssetPrefix + "AName"; + String altId = "unit test alt id"; + + AssetInfo asset = entityService.create(Asset.create().setName(name).setAlternateId(altId)); + + assertNotNull(asset.getId()); + assertEquals(name, asset.getName()); + assertEquals(altId, asset.getAlternateId()); + } + + @Test + public void canRetrieveAssetById() throws Exception { + AssetInfo createdAsset = entityService.create(Asset.create().setName(testAssetPrefix + "canRetrieveAssetById")); + + AssetInfo retrieved = entityService.get(Asset.get(createdAsset.getId())); + + assertEquals(createdAsset.getId(), retrieved.getId()); + assertEquals(createdAsset.getName(), retrieved.getName()); + + } + + @Test + public void canListAllAssets() throws Exception { + int numAssetsToCreate = 4; + Set expectedAssets = createTestAssets(numAssetsToCreate, "canList"); + + ListResult assets = entityService.list(Asset.list()); + + assertTrue(assets.size() >= numAssetsToCreate); + + for (AssetInfo asset : assets) { + if (expectedAssets.contains(asset.getId())) { + expectedAssets.remove(asset.getId()); + } + } + assertEquals(0, expectedAssets.size()); + } + + @Test + public void canListAssetsWithQueryParameters() throws Exception { + createTestAssets(4, "withQuery"); + + ListResult assets = entityService.list(Asset.list().setTop(2)); + + assertEquals(2, assets.size()); + } + + @Test + public void canUpdateAssetNameAndAltId() throws Exception { + String newName = testAssetPrefix + "newName"; + String newAltId = "updated alt id"; + + AssetInfo initialAsset = entityService.create(Asset.create().setName(testAssetPrefix + "originalName")); + + entityService.update(Asset.update(initialAsset.getId()).setName(newName).setAlternateId(newAltId)); + + AssetInfo updatedAsset = entityService.get(Asset.get(initialAsset.getId())); + + assertEquals(initialAsset.getId(), updatedAsset.getId()); + assertEquals(newName, updatedAsset.getName()); + assertEquals(newAltId, updatedAsset.getAlternateId()); + } + + @Test + public void canDeleteAssetsById() throws Exception { + int numToDelete = 3; + Set assetsToDelete = createTestAssets(numToDelete, "toDelete"); + + ListResult currentAssets = entityService.list(Asset.list()); + + for (String id : assetsToDelete) { + entityService.delete(Asset.delete(id)); + } + + ListResult afterDeleteAssets = entityService.list(Asset.list()); + + assertEquals(currentAssets.size() - numToDelete, afterDeleteAssets.size()); + + for (AssetInfo asset : afterDeleteAssets) { + assetsToDelete.remove(asset.getId()); + } + + assertEquals(numToDelete, assetsToDelete.size()); + } + + private Set createTestAssets(int numAssets, String namePart) throws Exception { + Set expectedAssets = new HashSet(); + + for (int i = 0; i < numAssets; ++i) { + AssetInfo asset = entityService.create(Asset.create().setName( + testAssetPrefix + namePart + Integer.toString(i))); + expectedAssets.add(asset.getId()); + } + return expectedAssets; + } +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/ExportsTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/ExportsTest.java new file mode 100644 index 000000000000..32c54ede596c --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/ExportsTest.java @@ -0,0 +1,47 @@ +/** + * 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; + +import static org.junit.Assert.*; + +import java.net.URI; + +import org.junit.Test; + +import com.microsoft.windowsazure.services.media.implementation.RedirectFilter; +import com.microsoft.windowsazure.services.media.implementation.ResourceLocationManager; + +/** + * Tests to verify the items exported from media services + * can be resolved from configuration. + * + */ +public class ExportsTest extends IntegrationTestBase { + + @Test + public void canResolveLocationManagerFromConfig() throws Exception { + ResourceLocationManager rlm = config.create(ResourceLocationManager.class); + URI rootUri = new URI((String) config.getProperty(MediaConfiguration.URI)); + + assertEquals(rootUri, rlm.getBaseURI()); + } + + @Test + public void canResolveRedirectFilterFromConfig() throws Exception { + RedirectFilter filter = config.create(RedirectFilter.class); + assertNotNull(filter); + } +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/IntegrationTestBase.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/IntegrationTestBase.java new file mode 100644 index 000000000000..ffa12bb064fa --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/IntegrationTestBase.java @@ -0,0 +1,322 @@ +/** + * 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; + +import static org.junit.Assert.*; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; +import java.util.EnumSet; +import java.util.List; +import java.util.UUID; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.rules.ExpectedException; + +import com.microsoft.windowsazure.services.core.Configuration; +import com.microsoft.windowsazure.services.core.ServiceException; +import com.microsoft.windowsazure.services.media.models.AccessPolicy; +import com.microsoft.windowsazure.services.media.models.AccessPolicyInfo; +import com.microsoft.windowsazure.services.media.models.AccessPolicyPermission; +import com.microsoft.windowsazure.services.media.models.Asset; +import com.microsoft.windowsazure.services.media.models.AssetFile; +import com.microsoft.windowsazure.services.media.models.AssetInfo; +import com.microsoft.windowsazure.services.media.models.ContentKey; +import com.microsoft.windowsazure.services.media.models.ContentKeyInfo; +import com.microsoft.windowsazure.services.media.models.Job; +import com.microsoft.windowsazure.services.media.models.JobInfo; +import com.microsoft.windowsazure.services.media.models.JobState; +import com.microsoft.windowsazure.services.media.models.ListResult; +import com.microsoft.windowsazure.services.media.models.Locator; +import com.microsoft.windowsazure.services.media.models.LocatorInfo; +import com.microsoft.windowsazure.services.media.models.LocatorType; + +public abstract class IntegrationTestBase { + protected static MediaContract service; + protected static Configuration config; + + protected static final String testAssetPrefix = "testAsset"; + protected static final String testPolicyPrefix = "testPolicy"; + protected static final String testContentKeyPrefix = "testContentKey"; + protected static final String testJobPrefix = "testJobPrefix"; + + protected static final String validButNonexistAssetId = "nb:cid:UUID:0239f11f-2d36-4e5f-aa35-44d58ccc0973"; + protected static final String validButNonexistAccessPolicyId = "nb:pid:UUID:38dcb3a0-ef64-4ad0-bbb5-67a14c6df2f7"; + protected static final String validButNonexistLocatorId = "nb:lid:UUID:92a70402-fca9-4aa3-80d7-d4de3792a27a"; + + protected static final String MEDIA_ENCODER_MEDIA_PROCESSOR_2_2_0_0_ID = "nb:mpid:UUID:70bdc2c3-ebf4-42a9-8542-5afc1e55d217"; + + protected static final String invalidId = "notAValidId"; + + @Rule + public ExpectedException expectedException = ExpectedException.none(); + + @BeforeClass + public static void setup() throws Exception { + config = Configuration.getInstance(); + overrideWithEnv(config, MediaConfiguration.URI); + overrideWithEnv(config, MediaConfiguration.OAUTH_URI); + overrideWithEnv(config, MediaConfiguration.OAUTH_CLIENT_ID); + overrideWithEnv(config, MediaConfiguration.OAUTH_CLIENT_SECRET); + overrideWithEnv(config, MediaConfiguration.OAUTH_SCOPE); + + service = MediaService.create(config); + + cleanupEnvironment(); + } + + protected static void overrideWithEnv(Configuration config, String key) { + String value = System.getenv(key); + if (value == null) + return; + + config.setProperty(key, value); + } + + @AfterClass + public static void cleanup() throws Exception { + cleanupEnvironment(); + } + + protected static void cleanupEnvironment() { + removeAllTestLocators(); + removeAllTestAssets(); + removeAllTestAccessPolicies(); + removeAllTestContentKeys(); + removeAllTestJobs(); + } + + private static void removeAllTestContentKeys() { + try { + List contentKeyInfos = service.list(ContentKey.list()); + + for (ContentKeyInfo contentKeyInfo : contentKeyInfos) { + try { + service.delete(ContentKey.delete(contentKeyInfo.getId())); + } + catch (Exception e) { + e.printStackTrace(); + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + } + + private static void removeAllTestAccessPolicies() { + try { + List policies = service.list(AccessPolicy.list()); + + for (AccessPolicyInfo policy : policies) { + if (policy.getName().startsWith(testPolicyPrefix)) { + service.delete(AccessPolicy.delete(policy.getId())); + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + } + + private static void removeAllTestAssets() { + try { + List listAssetsResult = service.list(Asset.list()); + for (AssetInfo assetInfo : listAssetsResult) { + try { + if (assetInfo.getName().startsWith(testAssetPrefix)) { + service.delete(Asset.delete(assetInfo.getId())); + } + else if (assetInfo.getName().startsWith("JobOutputAsset(") + && assetInfo.getName().contains(testJobPrefix)) { + // Delete the temp assets associated with Job results. + service.delete(Asset.delete(assetInfo.getId())); + } + } + catch (Exception e) { + e.printStackTrace(); + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + } + + private static void removeAllTestLocators() { + try { + ListResult listLocatorsResult = service.list(Locator.list()); + for (LocatorInfo locatorInfo : listLocatorsResult) { + AssetInfo ai = service.get(Asset.get(locatorInfo.getAssetId())); + if (ai.getName().startsWith(testAssetPrefix)) { + service.delete(Locator.delete(locatorInfo.getId())); + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + } + + private static void removeAllTestJobs() { + try { + ListResult jobs = service.list(Job.list()); + for (JobInfo job : jobs) { + if (job.getName().startsWith(testJobPrefix)) { + // Job can't be deleted when it's state is + // canceling, scheduled,queued or processing + try { + if (isJobBusy(job.getState())) { + service.action(Job.cancel(job.getId())); + job = service.get(Job.get(job.getId())); + } + + int retryCounter = 0; + while (isJobBusy(job.getState()) && retryCounter < 10) { + Thread.sleep(2000); + job = service.get(Job.get(job.getId())); + retryCounter++; + } + + if (!isJobBusy(job.getState())) { + service.delete(Job.delete(job.getId())); + } + else { + // Not much to do so except wait. + } + } + catch (Exception e) { + e.printStackTrace(); + } + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + } + + private static boolean isJobBusy(JobState state) { + return state == JobState.Canceling || state == JobState.Scheduled || state == JobState.Queued + || state == JobState.Processing; + } + + interface ComponentDelegate { + void verifyEquals(String message, Object expected, Object actual); + } + + protected static AssetInfo setupAssetWithFile() throws ServiceException { + String name = UUID.randomUUID().toString(); + String testBlobName = "test" + name + ".bin"; + AssetInfo assetInfo = service.create(Asset.create().setName(testAssetPrefix + name)); + + AccessPolicyInfo accessPolicyInfo = service.create(AccessPolicy.create(testPolicyPrefix + name, 10, + EnumSet.of(AccessPolicyPermission.WRITE))); + LocatorInfo locator = createLocator(accessPolicyInfo, assetInfo, 5); + WritableBlobContainerContract blobWriter = service.createBlobWriter(locator); + InputStream blobContent = new ByteArrayInputStream(new byte[] { 4, 8, 15, 16, 23, 42 }); + blobWriter.createBlockBlob(testBlobName, blobContent); + + service.action(AssetFile.createFileInfos(assetInfo.getId())); + + return assetInfo; + } + + protected static LocatorInfo createLocator(AccessPolicyInfo accessPolicy, AssetInfo asset, int startDeltaMinutes) + throws ServiceException { + + Date now = new Date(); + Date start = new Date(now.getTime() - (startDeltaMinutes * 60 * 1000)); + + return service.create(Locator.create(accessPolicy.getId(), asset.getId(), LocatorType.SAS).setStartDateTime( + start)); + } + + protected void verifyListResultContains(List expectedInfos, Collection actualInfos, + ComponentDelegate delegate) { + verifyListResultContains("", expectedInfos, actualInfos, delegate); + } + + protected void verifyListResultContains(String message, List expectedInfos, Collection actualInfos, + ComponentDelegate delegate) { + assertNotNull(message + ": actualInfos", actualInfos); + assertTrue(message + ": actual size should be same size or larger than expected size", + actualInfos.size() >= expectedInfos.size()); + + List orderedAndFilteredActualInfo = new ArrayList(); + try { + for (T expectedInfo : expectedInfos) { + Method getId = expectedInfo.getClass().getMethod("getId"); + String expectedId = (String) getId.invoke(expectedInfo); + for (T actualInfo : actualInfos) { + if (((String) getId.invoke(actualInfo)).equals(expectedId)) { + orderedAndFilteredActualInfo.add(actualInfo); + break; + } + } + } + } + catch (Exception e) { + // Don't worry about problems here. + e.printStackTrace(); + } + + assertEquals(message + ": actual filtered size should be same as expected size", expectedInfos.size(), + orderedAndFilteredActualInfo.size()); + + if (delegate != null) { + for (int i = 0; i < expectedInfos.size(); i++) { + delegate.verifyEquals(message + ": orderedAndFilteredActualInfo " + i, expectedInfos.get(i), + orderedAndFilteredActualInfo.get(i)); + } + } + } + + protected void assertEqualsNullEmpty(String message, String expected, String actual) { + if ((expected == null || expected.length() == 0) && (actual == null || actual.length() == 0)) { + // both nullOrEmpty, so match. + } + else { + assertEquals(message, expected, actual); + } + } + + protected void assertDateApproxEquals(Date expected, Date actual) { + assertDateApproxEquals("", expected, actual); + } + + protected void assertDateApproxEquals(String message, Date expected, Date actual) { + // Default allows for a 30 seconds difference in dates, for clock skew, network delays, etc. + long deltaInMilliseconds = 30000; + + if (expected == null || actual == null) { + assertEquals(message, expected, actual); + } + else { + long diffInMilliseconds = Math.abs(expected.getTime() - actual.getTime()); + + if (diffInMilliseconds > deltaInMilliseconds) { + assertEquals(message, expected, actual); + } + } + } +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/JobIntegrationTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/JobIntegrationTest.java new file mode 100644 index 000000000000..d93041f2c533 --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/JobIntegrationTest.java @@ -0,0 +1,347 @@ +/** + * 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; + +import static org.junit.Assert.*; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import org.junit.BeforeClass; +import org.junit.Test; + +import com.microsoft.windowsazure.services.core.ServiceException; +import com.microsoft.windowsazure.services.media.models.Asset; +import com.microsoft.windowsazure.services.media.models.AssetInfo; +import com.microsoft.windowsazure.services.media.models.ErrorDetail; +import com.microsoft.windowsazure.services.media.models.Job; +import com.microsoft.windowsazure.services.media.models.JobInfo; +import com.microsoft.windowsazure.services.media.models.JobState; +import com.microsoft.windowsazure.services.media.models.LinkInfo; +import com.microsoft.windowsazure.services.media.models.ListResult; +import com.microsoft.windowsazure.services.media.models.Task; +import com.microsoft.windowsazure.services.media.models.Task.CreateBatchOperation; +import com.microsoft.windowsazure.services.media.models.TaskInfo; + +public class JobIntegrationTest extends IntegrationTestBase { + + private static AssetInfo assetInfo; + + private void verifyJobInfoEqual(String message, JobInfo expected, JobInfo actual) throws ServiceException { + verifyJobProperties(message, expected.getName(), expected.getPriority(), expected.getRunningDuration(), + expected.getState(), expected.getTemplateId(), expected.getCreated(), expected.getLastModified(), + expected.getStartTime(), expected.getEndTime(), null, actual); + } + + private void verifyJobProperties(String message, String testName, Integer priority, double runningDuration, + JobState state, String templateId, Date created, Date lastModified, Date startTime, Date endTime, + Integer expectedTaskCount, JobInfo actualJob) throws ServiceException { + assertNotNull(message, actualJob); + + assertNotNull(message + "Id", actualJob.getId()); + + assertEquals(message + " Name", testName, actualJob.getName()); + // comment out due to issue 464 + // assertEquals(message + " Priority", priority, actualJob.getPriority()); + assertEquals(message + " RunningDuration", runningDuration, actualJob.getRunningDuration(), 0.001); + assertEquals(message + " State", state, actualJob.getState()); + assertEqualsNullEmpty(message + " TemplateId", templateId, actualJob.getTemplateId()); + + assertDateApproxEquals(message + " Created", created, actualJob.getCreated()); + assertDateApproxEquals(message + " LastModified", lastModified, actualJob.getLastModified()); + assertDateApproxEquals(message + " StartTime", startTime, actualJob.getStartTime()); + assertDateApproxEquals(message + " EndTime", endTime, actualJob.getEndTime()); + + if (expectedTaskCount != null) { + LinkInfo tasksLink = actualJob.getTasksLink(); + ListResult actualTasks = service.list(Task.list(tasksLink)); + assertEquals(message + " tasks size", expectedTaskCount.intValue(), actualTasks.size()); + } + } + + private JobInfo createJob(String name) throws ServiceException { + return service.create(Job.create().setName(name).setPriority(3).addInputMediaAsset(assetInfo.getId()) + .addTaskCreator(getTaskCreator(0))); + } + + private CreateBatchOperation getTaskCreator(int outputAssetPosition) { + return Task + .create(MEDIA_ENCODER_MEDIA_PROCESSOR_2_2_0_0_ID, + "" + "JobInputAsset(0)" + "JobOutputAsset(" + + outputAssetPosition + ")" + "") + .setConfiguration("H.264 256k DSL CBR").setName("My encoding Task"); + } + + @BeforeClass + public static void setup() throws Exception { + IntegrationTestBase.setup(); + assetInfo = setupAssetWithFile(); + } + + @Test + public void createJobSuccess() throws ServiceException { + // Arrange + String name = testJobPrefix + "createJobSuccess"; + int priority = 3; + double duration = 0.0; + JobState state = JobState.Queued; + String templateId = null; + Date created = new Date(); + Date lastModified = new Date(); + Date stateTime = null; + Date endTime = null; + + // Act + JobInfo actualJob = service.create(Job.create().setName(name).setPriority(priority) + .addInputMediaAsset(assetInfo.getId()).addTaskCreator(getTaskCreator(0))); + + // Assert + verifyJobProperties("actualJob", name, priority, duration, state, templateId, created, lastModified, stateTime, + endTime, 1, actualJob); + } + + @Test + public void createJobTwoTasksSuccess() throws ServiceException { + // Arrange + String name = testJobPrefix + "createJobSuccess"; + int priority = 3; + double duration = 0.0; + JobState state = JobState.Queued; + String templateId = null; + Date created = new Date(); + Date lastModified = new Date(); + Date stateTime = null; + Date endTime = null; + List tasks = new ArrayList(); + tasks.add(getTaskCreator(0)); + tasks.add(getTaskCreator(1)); + + // Act + JobInfo actualJob = service.create(Job.create().setName(name).setPriority(priority) + .addInputMediaAsset(assetInfo.getId()).addTaskCreator(tasks.get(0)).addTaskCreator(tasks.get(1))); + + // Assert + verifyJobProperties("actualJob", name, priority, duration, state, templateId, created, lastModified, stateTime, + endTime, 2, actualJob); + } + + @Test + public void getJobSuccess() throws ServiceException { + // Arrange + String name = testJobPrefix + "getJobSuccess"; + int priority = 3; + double duration = 0.0; + JobState state = JobState.Queued; + String templateId = null; + String jobId = createJob(name).getId(); + Date created = new Date(); + Date lastModified = new Date(); + Date stateTime = null; + Date endTime = null; + + // Act + JobInfo actualJob = service.get(Job.get(jobId)); + + // Assert + verifyJobProperties("actualJob", name, priority, duration, state, templateId, created, lastModified, stateTime, + endTime, 1, actualJob); + } + + @Test + public void getJobInvalidIdFailed() throws ServiceException { + expectedException.expect(ServiceException.class); + expectedException.expect(new ServiceExceptionMatcher(400)); + service.get(Job.get(invalidId)); + } + + @Test + public void listJobSuccess() throws ServiceException { + // Arrange + JobInfo jobInfo = createJob(testJobPrefix + "listJobSuccess"); + List jobInfos = new ArrayList(); + jobInfos.add(jobInfo); + ListResult expectedListJobsResult = new ListResult(jobInfos); + + // Act + ListResult actualListJobResult = service.list(Job.list()); + + // Assert + verifyListResultContains("listJobs", expectedListJobsResult, actualListJobResult, new ComponentDelegate() { + @Override + public void verifyEquals(String message, Object expected, Object actual) { + try { + verifyJobInfoEqual(message, (JobInfo) expected, (JobInfo) actual); + } + catch (ServiceException e) { + fail(e.getMessage()); + } + } + }); + } + + @Test + public void canListJobsWithOptions() throws ServiceException { + String[] assetNameSuffixes = new String[] { "A", "B", "C", "D" }; + List expectedJobs = new ArrayList(); + for (String suffix : assetNameSuffixes) { + JobInfo jobInfo = createJob(testJobPrefix + "assetListOptions" + suffix); + expectedJobs.add(jobInfo); + } + + ListResult listJobsResult = service.list(Job.list().setTop(2)); + + // Assert + assertEquals(2, listJobsResult.size()); + } + + @Test + public void cancelJobSuccess() throws ServiceException { + // Arrange + JobInfo jobInfo = createJob(testJobPrefix + "cancelJobSuccess"); + + // Act + service.action(Job.cancel(jobInfo.getId())); + + // Assert + JobInfo canceledJob = service.get(Job.get(jobInfo.getId())); + assertEquals(JobState.Canceling, canceledJob.getState()); + + } + + @Test + public void cancelJobFailedWithInvalidId() throws ServiceException { + // Arrange + expectedException.expect(ServiceException.class); + expectedException.expect(new ServiceExceptionMatcher(400)); + + // Act + service.action(Job.cancel(invalidId)); + + // Assert + } + + @Test + public void deleteJobSuccess() throws ServiceException, InterruptedException { + // Arrange + JobInfo jobInfo = createJob(testJobPrefix + "deleteJobSuccess"); + service.action(Job.cancel(jobInfo.getId())); + JobInfo cancellingJobInfo = service.get(Job.get(jobInfo.getId())); + int retryCounter = 0; + while (cancellingJobInfo.getState() == JobState.Canceling && retryCounter < 10) { + Thread.sleep(2000); + cancellingJobInfo = service.get(Job.get(jobInfo.getId())); + retryCounter++; + } + + // Act + service.delete(Job.delete(jobInfo.getId())); + + // Assert + expectedException.expect(ServiceException.class); + service.get(Job.get(jobInfo.getId())); + + } + + @Test + public void deleteJobInvalidIdFail() throws ServiceException { + // Arrange + expectedException.expect(ServiceException.class); + expectedException.expect(new ServiceExceptionMatcher(400)); + + // Act + service.delete(Job.delete(invalidId)); + + // Assert + } + + @Test + public void canGetInputOutputAssetsFromJob() throws Exception { + String name = testJobPrefix + "canGetInputOutputAssetsFromJob"; + int priority = 3; + + JobInfo actualJob = service.create(Job.create().setName(name).setPriority(priority) + .addInputMediaAsset(assetInfo.getId()).addTaskCreator(getTaskCreator(0))); + + ListResult inputs = service.list(Asset.list(actualJob.getInputAssetsLink())); + ListResult outputs = service.list(Asset.list(actualJob.getOutputAssetsLink())); + + assertEquals(1, inputs.size()); + assertEquals(assetInfo.getId(), inputs.get(0).getId()); + + assertEquals(1, outputs.size()); + assertTrue(outputs.get(0).getName().contains(name)); + } + + @Test + public void canGetTasksFromJob() throws Exception { + String name = testJobPrefix + "canGetTaskAssetsFromJob"; + int priority = 3; + + JobInfo actualJob = service.create(Job.create().setName(name).setPriority(priority) + .addInputMediaAsset(assetInfo.getId()).addTaskCreator(getTaskCreator(0))); + + ListResult tasks = service.list(Task.list(actualJob.getTasksLink())); + + assertEquals(1, tasks.size()); + } + + @Test + public void canGetErrorDetailsFromTask() throws Exception { + cleanupEnvironment(); + String name = testJobPrefix + "canGetErrorDetailsFromTask"; + + JobInfo actualJob = service.create(Job.create().setName(name).addInputMediaAsset(assetInfo.getId()) + .addTaskCreator(getTaskCreator(0))); + + JobInfo currentJobInfo = actualJob; + int retryCounter = 0; + while (currentJobInfo.getState().getCode() < 3 && retryCounter < 30) { + Thread.sleep(10000); + currentJobInfo = service.get(Job.get(actualJob.getId())); + retryCounter++; + } + + ListResult tasks = service.list(Task.list(actualJob.getTasksLink())); + TaskInfo taskInfo = tasks.get(0); + List errorDetails = taskInfo.getErrorDetails(); + + assertEquals(1, errorDetails.size()); + ErrorDetail errorDetail = errorDetails.get(0); + assertNotNull(errorDetail.getCode()); + assertNotNull(errorDetail.getMessage()); + } + + @Test + public void canGetInputOutputAssetsFromTask() throws Exception { + String name = testJobPrefix + "canGetInputOutputAssetsFromTask"; + int priority = 3; + + JobInfo actualJob = service.create(Job.create().setName(name).setPriority(priority) + .addInputMediaAsset(assetInfo.getId()).addTaskCreator(getTaskCreator(0))); + + ListResult tasks = service.list(Task.list(actualJob.getTasksLink())); + ListResult inputs = service.list(Asset.list(tasks.get(0).getInputAssetsLink())); + ListResult outputs = service.list(Asset.list(tasks.get(0).getOutputAssetsLink())); + + assertEquals(1, inputs.size()); + assertEquals(assetInfo.getId(), inputs.get(0).getId()); + + assertEquals(1, outputs.size()); + assertTrue(outputs.get(0).getName().contains(name)); + } + +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/LocatorIntegrationTests.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/LocatorIntegrationTests.java new file mode 100644 index 000000000000..e66162eef69f --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/LocatorIntegrationTests.java @@ -0,0 +1,315 @@ +/** + * 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; + +import static org.junit.Assert.*; + +import java.util.ArrayList; +import java.util.Date; +import java.util.EnumSet; +import java.util.List; +import java.util.UUID; + +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.microsoft.windowsazure.services.core.ServiceException; +import com.microsoft.windowsazure.services.media.models.AccessPolicy; +import com.microsoft.windowsazure.services.media.models.AccessPolicyInfo; +import com.microsoft.windowsazure.services.media.models.AccessPolicyPermission; +import com.microsoft.windowsazure.services.media.models.Asset; +import com.microsoft.windowsazure.services.media.models.AssetInfo; +import com.microsoft.windowsazure.services.media.models.ListResult; +import com.microsoft.windowsazure.services.media.models.Locator; +import com.microsoft.windowsazure.services.media.models.LocatorInfo; +import com.microsoft.windowsazure.services.media.models.LocatorType; + +public class LocatorIntegrationTests extends IntegrationTestBase { + + private static AssetInfo assetInfo; + private static AccessPolicyInfo accessPolicyInfo; + private static AccessPolicyInfo accessPolicyInfoRead; + private static int minuteInMS = 60 * 1000; + private static int tenMinutesInMS = 10 * 60 * 1000; + + private void verifyLocatorInfosEqual(String message, LocatorInfo expected, LocatorInfo actual) { + verifyLocatorProperties(message, expected.getAccessPolicyId(), expected.getAssetId(), + expected.getLocatorType(), expected.getStartTime(), expected.getId(), expected.getPath(), actual); + } + + private void verifyLocatorProperties(String message, String accessPolicyId, String assetId, + LocatorType locatorType, Date startTime, LocatorInfo actualLocator) { + verifyLocatorProperties(message, accessPolicyId, assetId, locatorType, startTime, null, null, actualLocator); + } + + private void verifyLocatorProperties(String message, String accessPolicyId, String assetId, + LocatorType locatorType, Date startTime, String id, String path, LocatorInfo actualLocator) { + assertNotNull(message, actualLocator); + assertEquals(message + " accessPolicyId", accessPolicyId, actualLocator.getAccessPolicyId()); + assertEquals(message + " assetId", assetId, actualLocator.getAssetId()); + assertEquals(message + " locatorType", locatorType, actualLocator.getLocatorType()); + + assertDateApproxEquals(message + " startTime", startTime, actualLocator.getStartTime()); + + if (id == null) { + assertNotNull(message + " Id", actualLocator.getId()); + } + else { + assertEquals(message + " Id", id, actualLocator.getId()); + } + if (path == null) { + assertNotNull(message + " path", actualLocator.getPath()); + } + else { + assertEquals(message + " path", path, actualLocator.getPath()); + } + } + + @BeforeClass + public static void setup() throws Exception { + IntegrationTestBase.setup(); + accessPolicyInfo = service.create(AccessPolicy.create(testPolicyPrefix + "ForLocatorTest", 5, + EnumSet.of(AccessPolicyPermission.WRITE))); + accessPolicyInfoRead = service.create(AccessPolicy.create(testPolicyPrefix + "ForLocatorTestRead", 15, + EnumSet.of(AccessPolicyPermission.READ))); + } + + @Before + public void instanceSetup() throws Exception { + assetInfo = service.create(Asset.create().setName(testAssetPrefix + "ForLocatorTest")); + } + + @Test + public void createLocatorSuccess() throws ServiceException { + // Arrange + LocatorType locatorType = LocatorType.SAS; + + // Act + LocatorInfo locatorInfo = service.create(Locator.create(accessPolicyInfoRead.getId(), assetInfo.getId(), + locatorType)); + + // Assert + verifyLocatorProperties("locatorInfo", accessPolicyInfoRead.getId(), assetInfo.getId(), locatorType, null, + locatorInfo); + } + + @Test + public void createLocatorWithSpecifiedIdSuccess() throws ServiceException { + // Arrange + LocatorType locatorType = LocatorType.SAS; + + // Act + LocatorInfo locatorInfo = service.create(Locator.create(accessPolicyInfoRead.getId(), assetInfo.getId(), + locatorType).setId(String.format("nb:lid:UUID:%s", UUID.randomUUID().toString()))); + + // Assert + verifyLocatorProperties("locatorInfo", accessPolicyInfoRead.getId(), assetInfo.getId(), locatorType, null, + locatorInfo); + } + + @Test + public void createLocatorOptionsSetStartTimeSuccess() throws ServiceException { + // Arrange + Date expectedStartDateTime = new Date(); + expectedStartDateTime.setTime(expectedStartDateTime.getTime() + tenMinutesInMS); + LocatorType locatorType = LocatorType.SAS; + + // Act + LocatorInfo locatorInfo = service.create(Locator.create(accessPolicyInfo.getId(), assetInfo.getId(), + locatorType).setStartDateTime(expectedStartDateTime)); + + // Assert + verifyLocatorProperties("locatorInfo", accessPolicyInfo.getId(), assetInfo.getId(), locatorType, + expectedStartDateTime, locatorInfo); + } + + @Test + public void getLocatorSuccess() throws ServiceException { + // Arrange + LocatorType locatorType = LocatorType.SAS; + Date expectedStartDateTime = new Date(); + expectedStartDateTime.setTime(expectedStartDateTime.getTime() + tenMinutesInMS); + + LocatorInfo expectedLocatorInfo = service.create(Locator.create(accessPolicyInfo.getId(), assetInfo.getId(), + locatorType).setStartDateTime(expectedStartDateTime)); + + // Act + LocatorInfo actualLocatorInfo = service.get(Locator.get(expectedLocatorInfo.getId())); + + // Assert + verifyLocatorInfosEqual("actualLocatorInfo", expectedLocatorInfo, actualLocatorInfo); + } + + @Test + public void getLocatorInvalidId() throws ServiceException { + expectedException.expect(ServiceException.class); + expectedException.expect(new ServiceExceptionMatcher(400)); + service.get(Locator.get(invalidId)); + } + + @Test + public void getLocatorNonexistId() throws ServiceException { + expectedException.expect(ServiceException.class); + expectedException.expect(new ServiceExceptionMatcher(404)); + service.get(Locator.get(validButNonexistLocatorId)); + } + + @Test + public void listLocatorsSuccess() throws ServiceException { + // Arrange + LocatorType locatorType = LocatorType.SAS; + List expectedLocators = new ArrayList(); + for (int i = 0; i < 2; i++) { + expectedLocators + .add(service.create(Locator.create(accessPolicyInfo.getId(), assetInfo.getId(), locatorType))); + } + + // Act + ListResult listLocatorsResult = service.list(Locator.list()); + + // Assert + assertNotNull(listLocatorsResult); + verifyListResultContains("listLocatorsResult", expectedLocators, listLocatorsResult, new ComponentDelegate() { + @Override + public void verifyEquals(String message, Object expected, Object actual) { + verifyLocatorInfosEqual(message, (LocatorInfo) expected, (LocatorInfo) actual); + } + }); + } + + @Test + public void listLocatorsWithOptions() throws ServiceException { + List expectedLocators = new ArrayList(); + for (int i = 0; i < 5; i++) { + expectedLocators.add(service.create(Locator.create(accessPolicyInfo.getId(), assetInfo.getId(), + LocatorType.SAS))); + } + + ListResult result = service.list(Locator + .list() + .setTop(3) + .set("$filter", + "(Id eq '" + expectedLocators.get(1).getId() + "') or (" + "Id eq '" + + expectedLocators.get(3).getId() + "')")); + + assertEquals(2, result.size()); + } + + @Test + public void updateLocatorSuccess() throws ServiceException { + // Arrange + LocatorType locatorType = LocatorType.OnDemandOrigin; + LocatorInfo locatorInfo = service.create(Locator.create(accessPolicyInfoRead.getId(), assetInfo.getId(), + locatorType)); + + Date startTime = new Date(); + startTime.setTime(startTime.getTime() - tenMinutesInMS); + + // Act + service.update(Locator.update(locatorInfo.getId()).setStartDateTime(startTime)); + LocatorInfo updatedLocatorInfo = service.get(Locator.get(locatorInfo.getId())); + + // Assert + Date expectedExpiration = new Date(); + expectedExpiration.setTime(startTime.getTime() + (long) accessPolicyInfoRead.getDurationInMinutes() + * minuteInMS); + + verifyLocatorProperties("updatedLocatorInfo", locatorInfo.getAccessPolicyId(), locatorInfo.getAssetId(), + locatorInfo.getLocatorType(), startTime, locatorInfo.getId(), locatorInfo.getPath(), updatedLocatorInfo); + } + + @Test + public void updateLocatorNoChangesSuccess() throws ServiceException { + // Arrange + LocatorType locatorType = LocatorType.OnDemandOrigin; + Date expirationDateTime = new Date(); + expirationDateTime.setTime(expirationDateTime.getTime() + tenMinutesInMS); + Date startTime = new Date(); + startTime.setTime(startTime.getTime() - tenMinutesInMS); + + LocatorInfo locatorInfo = service.create(Locator.create(accessPolicyInfoRead.getId(), assetInfo.getId(), + locatorType).setStartDateTime(startTime)); + + // Act + service.update(Locator.update(locatorInfo.getId())); + LocatorInfo updatedLocatorInfo = service.get(Locator.get(locatorInfo.getId())); + + // Assert + verifyLocatorInfosEqual("updatedLocatorInfo", locatorInfo, updatedLocatorInfo); + } + + @Test + public void deleteLocatorSuccess() throws ServiceException { + // Arrange + LocatorType locatorType = LocatorType.SAS; + LocatorInfo locatorInfo = service.create(Locator.create(accessPolicyInfo.getId(), assetInfo.getId(), + locatorType)); + ListResult listLocatorsResult = service.list(Locator.list()); + int assetCountBaseline = listLocatorsResult.size(); + + // Act + service.delete(Locator.delete(locatorInfo.getId())); + + // Assert + listLocatorsResult = service.list(Locator.list()); + assertEquals("listLocatorsResult.size", assetCountBaseline - 1, listLocatorsResult.size()); + + expectedException.expect(ServiceException.class); + expectedException.expect(new ServiceExceptionMatcher(404)); + service.get(Locator.get(locatorInfo.getId())); + } + + @Test + public void deleteLocatorInvalidIdFailed() throws ServiceException { + expectedException.expect(ServiceException.class); + expectedException.expect(new ServiceExceptionMatcher(400)); + service.delete(Locator.delete(invalidId)); + } + + @Test + public void canGetLocatorBackFromAsset() throws Exception { + LocatorInfo locator = service.create(Locator.create(accessPolicyInfo.getId(), assetInfo.getId(), + LocatorType.SAS)); + + ListResult locators = service.list(Locator.list(assetInfo.getLocatorsLink())); + + assertEquals(1, locators.size()); + assertEquals(locator.getId(), locators.get(0).getId()); + + } + + @Test + public void canGetAssetFromLocator() throws Exception { + LocatorInfo locator = service.create(Locator.create(accessPolicyInfo.getId(), assetInfo.getId(), + LocatorType.SAS)); + + AssetInfo asset = service.get(Asset.get(locator.getAssetLink())); + + assertEquals(assetInfo.getId(), asset.getId()); + } + + @Test + public void canGetAccessPolicyFromLocator() throws Exception { + LocatorInfo locator = service.create(Locator.create(accessPolicyInfo.getId(), assetInfo.getId(), + LocatorType.SAS)); + + AccessPolicyInfo accessPolicy = service.get(AccessPolicy.get(locator.getAccessPolicyLink())); + + assertEquals(accessPolicyInfo.getId(), accessPolicy.getId()); + + } +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/MediaConfigurationTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/MediaConfigurationTest.java new file mode 100644 index 000000000000..ea1f80c485bc --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/MediaConfigurationTest.java @@ -0,0 +1,80 @@ +/** + * 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; + +import static org.junit.Assert.*; + +import org.junit.Test; + +import com.microsoft.windowsazure.services.core.Configuration; + +public class MediaConfigurationTest { + + @Test + public void createMediaConfigurationTestSuccess() { + // Arrange + + // Act + Configuration configuration = MediaConfiguration.configureWithOAuthAuthentication( + "https://testMediaServiceBaseUri", "testOAuthUri", "testClientId", "testClientSecret", "testScope"); + + // Assert + assertEquals("https://testMediaServiceBaseUri", configuration.getProperty("media.uri")); + assertEquals("testOAuthUri", configuration.getProperty("media.oauth.uri")); + assertEquals("testClientId", configuration.getProperty("media.oauth.client.id")); + assertEquals("testClientSecret", configuration.getProperty("media.oauth.client.secret")); + assertEquals("testScope", configuration.getProperty("media.oauth.scope")); + } + + @Test + public void createMediaConfigurationPassingExistingConfigurationSuccess() { + // Arrange + Configuration preConfiguration = new Configuration(); + preConfiguration.setProperty("preexistingName", "preexistingValue"); + + // Act + Configuration configuration = MediaConfiguration.configureWithOAuthAuthentication(preConfiguration, + "https://testMediaServiceBaseUri", "testOAuthUri", "testClientId", "testClientSecret", "testScope"); + + // Assert + assertEquals("preexistingValue", configuration.getProperty("preexistingName")); + assertEquals("https://testMediaServiceBaseUri", configuration.getProperty("media.uri")); + assertEquals("testOAuthUri", configuration.getProperty("media.oauth.uri")); + assertEquals("testClientId", configuration.getProperty("media.oauth.client.id")); + assertEquals("testClientSecret", configuration.getProperty("media.oauth.client.secret")); + + } + + @Test + public void createMediaConfigurationWithProfileConfigurationSuccess() { + // Arrange + Configuration preConfiguration = new Configuration(); + preConfiguration.setProperty("preexistingName", "preexistingValue"); + + // Act + Configuration configuration = MediaConfiguration.configureWithOAuthAuthentication("testProfile", + preConfiguration, "https://testMediaServiceBaseUri", "testOAuthUri", "testClientId", + "testClientSecret", "testScope"); + + // Assert + assertEquals("preexistingValue", configuration.getProperty("preexistingName")); + assertEquals("https://testMediaServiceBaseUri", configuration.getProperty("testProfile.media.uri")); + assertEquals("testOAuthUri", configuration.getProperty("testProfile.media.oauth.uri")); + assertEquals("testClientId", configuration.getProperty("testProfile.media.oauth.client.id")); + assertEquals("testClientSecret", configuration.getProperty("testProfile.media.oauth.client.secret")); + } + +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/MediaProcessorIntegrationTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/MediaProcessorIntegrationTest.java new file mode 100644 index 000000000000..052fdc0811ef --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/MediaProcessorIntegrationTest.java @@ -0,0 +1,78 @@ +/** + * 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; + +import static org.junit.Assert.*; + +import java.util.List; + +import org.junit.Test; + +import com.microsoft.windowsazure.services.core.ServiceException; +import com.microsoft.windowsazure.services.media.models.ListResult; +import com.microsoft.windowsazure.services.media.models.MediaProcessor; +import com.microsoft.windowsazure.services.media.models.MediaProcessorInfo; + +public class MediaProcessorIntegrationTest extends IntegrationTestBase { + + private void verifyMediaProcessorInfo(String message, MediaProcessorInfo mediaProcessorInfo) { + assertEquals(message + " id length", 49, mediaProcessorInfo.getId().length()); + assertTrue(message + " name length > 0", mediaProcessorInfo.getName().length() > 0); + assertNotNull(message + " description", mediaProcessorInfo.getDescription()); + assertNotNull(message + " sku", mediaProcessorInfo.getSku()); + assertTrue(message + " vendor length > 0", mediaProcessorInfo.getVendor().length() > 0); + assertTrue(message + " version length > 0", mediaProcessorInfo.getVersion().length() > 0); + } + + private void verifyMediaProcessorInfo(String message, String id, String name, String description, String sku, + String vendor, String version, MediaProcessorInfo mediaProcessorInfo) { + assertEquals(message + " id", id, mediaProcessorInfo.getId()); + assertEquals(message + " name", name, mediaProcessorInfo.getName()); + assertEquals(message + " description", description, mediaProcessorInfo.getDescription()); + assertEquals(message + " sku", sku, mediaProcessorInfo.getSku()); + assertEquals(message + " vendor", vendor, mediaProcessorInfo.getVendor()); + assertEquals(message + " version", version, mediaProcessorInfo.getVersion()); + } + + @Test + public void listMediaProcessorsSuccess() throws ServiceException { + // Arrange + + // Act + ListResult listMediaProcessorsResult = service.list(MediaProcessor.list()); + + // Assert + assertNotNull("listMediaProcessorsResult", listMediaProcessorsResult); + assertTrue("listMediaProcessorsResult size > 0", listMediaProcessorsResult.size() > 0); + List ps = listMediaProcessorsResult; + for (int i = 0; i < ps.size(); i++) { + MediaProcessorInfo mediaProcessorInfo = ps.get(i); + verifyMediaProcessorInfo("mediaProcessorInfo:" + i, mediaProcessorInfo); + } + } + + @Test + public void listMediaProcessorWithOptionSuccess() throws ServiceException { + ListResult listMediaProcessorsResult = service.list(MediaProcessor.list().setTop(2) + .set("$filter", "Id eq 'nb:mpid:UUID:aec03716-7c5e-4f68-b592-f4850eba9f10'")); + + assertNotNull("listMediaProcessorsResult", listMediaProcessorsResult); + assertEquals("listMediaProcessors size", 1, listMediaProcessorsResult.size()); + MediaProcessorInfo mediaProcessorInfo = listMediaProcessorsResult.get(0); + verifyMediaProcessorInfo("mediaProcessorInfo", "nb:mpid:UUID:aec03716-7c5e-4f68-b592-f4850eba9f10", + "Storage Decryption", "Storage Decryption", "", "Microsoft", "1.5.3", mediaProcessorInfo); + } +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/MediaServiceTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/MediaServiceTest.java new file mode 100644 index 000000000000..59713c861809 --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/MediaServiceTest.java @@ -0,0 +1,81 @@ +/** + * 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; + +import static org.junit.Assert.*; + +import org.junit.Test; + +import com.microsoft.windowsazure.services.core.Configuration; + +public class MediaServiceTest { + + @Test + public void createMediaContractSuccessTest() { + // Arrange + Configuration configurationInstance = Configuration.getInstance(); + configurationInstance = MediaConfiguration.configureWithOAuthAuthentication(configurationInstance, + "mediaServiceBaseUri", "oAuthUri", "clientId", "clientSecret", "testScope"); + + // Act + MediaContract mediaContract = MediaService.create(); + + // Assert + assertNotNull(mediaContract); + configurationInstance = null; + + } + + @Test + public void createMediaContractWithSpecifiedConfigurationTest() { + // Arrange + Configuration configuration = MediaConfiguration.configureWithOAuthAuthentication("mediaServiceBaseUri", + "oAuthUri", "clientId", "clientSecret", "testScope"); + + // Act + MediaContract mediaContract = MediaService.create(configuration); + + // Assert + assertNotNull(mediaContract); + } + + @Test + public void createMediaContractWithSpecifiedProfileTest() { + // Arrange + String profile = "testProfile"; + + // Act + MediaContract mediaContract = MediaService.create(profile); + + // Assert + assertNotNull(mediaContract); + + } + + @Test + public void createMediaContractWithSpecifiedProfileAndConfiguration() { + // Arrange + String profile = "testProfile"; + Configuration configuration = MediaConfiguration.configureWithOAuthAuthentication(profile, new Configuration(), + "mediaServiceBaseUri", "oAuthUri", "clientId", "clientSecret", "testScope"); + + // Act + MediaContract mediaContract = MediaService.create(profile, configuration); + + // Assert + assertNotNull(mediaContract); + } +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/ProtectionKeyIntegrationTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/ProtectionKeyIntegrationTest.java new file mode 100644 index 000000000000..7749249e66a8 --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/ProtectionKeyIntegrationTest.java @@ -0,0 +1,51 @@ +/** + * 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; + +import static org.junit.Assert.*; + +import org.junit.Test; + +import com.microsoft.windowsazure.services.core.ServiceException; +import com.microsoft.windowsazure.services.media.models.ContentKeyType; +import com.microsoft.windowsazure.services.media.models.ProtectionKey; + +public class ProtectionKeyIntegrationTest extends IntegrationTestBase { + + @Test + public void canGetProtectionKeyId() throws ServiceException { + // Arrange + + // Act + String protectionKeyId = service.action(ProtectionKey.getProtectionKeyId(ContentKeyType.CommonEncryption)); + + // Assert + assertNotNull(protectionKeyId); + } + + @Test + public void canGetProtectionKey() throws ServiceException { + // Arrange + String protectionKeyId = service.action(ProtectionKey.getProtectionKeyId(ContentKeyType.CommonEncryption)); + + // Act + String protectionKey = service.action(ProtectionKey.getProtectionKey(protectionKeyId)); + + // Assert + assertNotNull(protectionKey); + } + +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/ServiceExceptionMatcher.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/ServiceExceptionMatcher.java new file mode 100644 index 000000000000..5baee5b57cd2 --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/ServiceExceptionMatcher.java @@ -0,0 +1,47 @@ +/** + * 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; + +import org.hamcrest.BaseMatcher; +import org.hamcrest.Description; + +import com.microsoft.windowsazure.services.core.ServiceException; + +public class ServiceExceptionMatcher extends BaseMatcher { + private final int httpStatusCode; + + public ServiceExceptionMatcher(int httpStatusCode) { + this.httpStatusCode = httpStatusCode; + } + + @Override + public boolean matches(Object item) { + if (item == null || item.getClass() != ServiceException.class) { + return false; + } + + if (((ServiceException) item).getHttpStatusCode() != this.httpStatusCode) { + return false; + } + + return true; + } + + @Override + public void describeTo(Description description) { + description.appendText("Must be ServiceException with status code" + this.httpStatusCode); + } +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/TaskIntegrationTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/TaskIntegrationTest.java new file mode 100644 index 000000000000..ad9ca21b6750 --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/TaskIntegrationTest.java @@ -0,0 +1,287 @@ +/** + * 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; + +import static org.junit.Assert.*; + +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.UUID; + +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.microsoft.windowsazure.services.core.ServiceException; +import com.microsoft.windowsazure.services.media.models.Asset; +import com.microsoft.windowsazure.services.media.models.AssetInfo; +import com.microsoft.windowsazure.services.media.models.Job; +import com.microsoft.windowsazure.services.media.models.Job.Creator; +import com.microsoft.windowsazure.services.media.models.JobInfo; +import com.microsoft.windowsazure.services.media.models.JobState; +import com.microsoft.windowsazure.services.media.models.ListResult; +import com.microsoft.windowsazure.services.media.models.Task; +import com.microsoft.windowsazure.services.media.models.Task.CreateBatchOperation; +import com.microsoft.windowsazure.services.media.models.TaskInfo; +import com.microsoft.windowsazure.services.media.models.TaskOption; +import com.microsoft.windowsazure.services.media.models.TaskState; +import com.sun.jersey.core.util.Base64; + +public class TaskIntegrationTest extends IntegrationTestBase { + private static AssetInfo assetInfo; + private Creator jobCreator; + + private static final String commonConfiguration = "H.264 256k DSL CBR"; + + @BeforeClass + public static void setup() throws Exception { + IntegrationTestBase.setup(); + assetInfo = setupAssetWithFile(); + } + + @Before + public void instanceSetup() { + this.jobCreator = Job.create().setName(testJobPrefix + UUID.randomUUID().toString()).setPriority(3) + .addInputMediaAsset(assetInfo.getId()); + } + + @Test + public void createTaskSuccess() throws ServiceException, UnsupportedEncodingException { + // Arrange + + // Required + String mediaProcessorId = MEDIA_ENCODER_MEDIA_PROCESSOR_2_2_0_0_ID; + String taskBody = constructTaskBody(0); + + // Optional parameters + String configuration = new String(Base64.encode(commonConfiguration), "UTF8"); + String name = "My encoding Task " + UUID.randomUUID().toString(); + int priority = 0; + TaskOption options = TaskOption.ProtectedConfiguration; + // Use a fake id, to simulate real use. + String encryptionKeyId = "nb:kid:UUID:" + UUID.randomUUID().toString(); + String encryptionScheme = "ConfigurationEncryption"; + String encryptionVersion = "1.0"; + // Use a trivial vector, 16 bytes of zeros, base-64 encoded. + String initializationVector = new String(Base64.encode(new byte[16]), "UTF8"); + + CreateBatchOperation taskCreator = Task.create(mediaProcessorId, taskBody).setConfiguration(configuration) + .setName(name).setPriority(priority).setOptions(options).setEncryptionKeyId(encryptionKeyId) + .setEncryptionScheme(encryptionScheme).setEncryptionVersion(encryptionVersion) + .setInitializationVector(initializationVector); + jobCreator.addTaskCreator(taskCreator); + + // Act + JobInfo job = service.create(jobCreator); + List taskInfos = service.list(Task.list(job.getTasksLink())); + + // Assert + assertEquals("taskInfos count", 1, taskInfos.size()); + verifyTaskPropertiesJustStarted("taskInfo", mediaProcessorId, options, taskBody, configuration, name, priority, + encryptionKeyId, encryptionScheme, encryptionVersion, initializationVector, taskInfos.get(0)); + } + + @Test + public void createTwoTasksSuccess() throws ServiceException { + // Arrange + + // Required + String mediaProcessorId = MEDIA_ENCODER_MEDIA_PROCESSOR_2_2_0_0_ID; + String[] taskBodies = new String[] { constructTaskBody(0), constructTaskBody(1) }; + + // Optional parameters + String configuration = commonConfiguration; + String baseName = "My encoding Task " + UUID.randomUUID().toString(); + String[] suffixes = new String[] { " 1", " 2" }; + int priority = 0; + TaskOption options = TaskOption.None; + + List taskCreators = new ArrayList(); + + for (int i = 0; i < taskBodies.length; i++) { + CreateBatchOperation taskCreator = Task.create(mediaProcessorId, taskBodies[i]) + .setConfiguration(configuration).setName(baseName + suffixes[i]); + taskCreators.add(taskCreator); + jobCreator.addTaskCreator(taskCreator); + } + + // Act + JobInfo job = service.create(jobCreator); + List taskInfos = service.list(Task.list(job.getTasksLink())); + + // Assert + assertEquals("taskInfos count", taskCreators.size(), taskInfos.size()); + for (int i = 0; i < taskCreators.size(); i++) { + verifyTaskPropertiesJustStartedNoEncryption("taskInfo", mediaProcessorId, options, taskBodies[i], + configuration, baseName + suffixes[i], priority, taskInfos.get(i)); + } + } + + @Test + public void canListTasksWithOptions() throws ServiceException { + // Arrange + String mediaProcessorId = MEDIA_ENCODER_MEDIA_PROCESSOR_2_2_0_0_ID; + String configuration = commonConfiguration; + String[] taskNameSuffixes = new String[] { "A", "B", "C", "D" }; + String baseName = "My encoding Task " + UUID.randomUUID().toString(); + int taskCounter = 0; + for (String suffix : taskNameSuffixes) { + CreateBatchOperation taskCreator = Task.create(mediaProcessorId, constructTaskBody(taskCounter++)) + .setConfiguration(configuration).setName(baseName + suffix); + jobCreator.addTaskCreator(taskCreator); + } + + service.create(jobCreator); + + // Act + ListResult listTaskResult1 = service.list(Task.list().set("$filter", + "startswith(Name, '" + baseName + "') eq true")); + ListResult listTaskResult2 = service.list(Task.list() + .set("$filter", "startswith(Name, '" + baseName + "') eq true").setTop(2)); + + // Assert + assertEquals("listTaskResult1.size", 4, listTaskResult1.size()); + assertEquals("listTaskResult2.size", 2, listTaskResult2.size()); + } + + @Test + public void cancelTaskSuccess() throws ServiceException, InterruptedException { + // Arrange + String mediaProcessorId = MEDIA_ENCODER_MEDIA_PROCESSOR_2_2_0_0_ID; + String taskBody = constructTaskBody(0); + String configuration = commonConfiguration; + String name = "My encoding Task " + UUID.randomUUID().toString(); + CreateBatchOperation taskCreator = Task.create(mediaProcessorId, taskBody).setConfiguration(configuration) + .setName(name); + jobCreator.addTaskCreator(taskCreator); + + JobInfo jobInfo = service.create(jobCreator); + + // Act + service.action(Job.cancel(jobInfo.getId())); + JobInfo cancellingJobInfo = service.get(Job.get(jobInfo.getId())); + while (cancellingJobInfo.getState() == JobState.Canceling) { + Thread.sleep(2000); + cancellingJobInfo = service.get(Job.get(jobInfo.getId())); + } + + //Assert + List taskInfos = service.list(Task.list(cancellingJobInfo.getTasksLink())); + for (TaskInfo taskInfo : taskInfos) { + verifyTaskPropertiesNoEncryption("canceled task", mediaProcessorId, TaskOption.None, taskBody, + configuration, name, 0, new Date(), null, 0.0, 0.0, null, TaskState.Canceled, taskInfo); + } + } + + private void verifyTaskProperties(String message, String mediaProcessorId, TaskOption options, String taskBody, + String configuration, String name, int priority, String encryptionKeyId, String encryptionScheme, + String encryptionVersion, String initializationVector, Date endTime, String errorDetails, double progress, + double runningDuration, Date startTime, TaskState state, TaskInfo actual) throws ServiceException { + assertNotNull(message, actual); + assertNotNull(message + " id", actual.getId()); + + // Required fields + assertEquals(message + " getMediaProcessorId", mediaProcessorId, actual.getMediaProcessorId()); + assertEquals(message + " getOptions", options, actual.getOptions()); + assertEquals(message + " getTaskBody", taskBody, actual.getTaskBody()); + + // Optional fields + assertEquals(message + " getConfiguration", configuration, actual.getConfiguration()); + assertEquals(message + " getName", name, actual.getName()); + assertEquals(message + " getPriority", priority, actual.getPriority()); + + // Optional encryption fields + assertEqualsNullEmpty(message + " getEncryptionKeyId", encryptionKeyId, actual.getEncryptionKeyId()); + assertEqualsNullEmpty(message + " getEncryptionScheme", encryptionScheme, actual.getEncryptionScheme()); + assertEqualsNullEmpty(message + " getEncryptionVersion", encryptionVersion, actual.getEncryptionVersion()); + assertEqualsNullEmpty(message + " getInitializationVector", initializationVector, + actual.getInitializationVector()); + + // Read-only fields + assertDateApproxEquals(message + " getEndTime", endTime, actual.getEndTime()); + assertNotNull(message + " getErrorDetails", actual.getErrorDetails()); + assertEquals(message + " getErrorDetails.size", 0, actual.getErrorDetails().size()); + + ListResult inputAssets = service.list(Asset.list(actual.getInputAssetsLink())); + ListResult outputAssets = service.list(Asset.list(actual.getOutputAssetsLink())); + + assertEquals(message + " inputAssets.size", 1, inputAssets.size()); + assertEquals(message + " inputAssets.get(0).getId", assetInfo.getId(), inputAssets.get(0).getId()); + + assertEquals(message + " outputAssets.size", 1, outputAssets.size()); + // Because this is a new asset, there is not much else to test + assertTrue(message + " outputAssets.get(0).getId != assetInfo.getId", + !assetInfo.getId().equals(outputAssets.get(0).getId())); + + assertEquals(message + " getProgress", progress, actual.getProgress(), 0.01); + assertEquals(message + " getRunningDuration", runningDuration, actual.getRunningDuration(), 0.01); + assertDateApproxEquals(message + " getStartTime", startTime, actual.getStartTime()); + assertEquals(message + " getState", state, actual.getState()); + + // Note: The PerfMessage is not validated because it is server generated. + } + + private void verifyTaskPropertiesJustStarted(String message, String mediaProcessorId, TaskOption options, + String taskBody, String configuration, String name, int priority, String encryptionKeyId, + String encryptionScheme, String encryptionVersion, String initializationVector, TaskInfo actual) + throws ServiceException { + + // Read-only + Date endTime = null; + String errorDetails = null; + double progress = 0.0; + int runningDuration = 0; + Date startTime = null; + TaskState state = TaskState.None; + + verifyTaskProperties(message, mediaProcessorId, options, taskBody, configuration, name, priority, + encryptionKeyId, encryptionScheme, encryptionVersion, initializationVector, endTime, errorDetails, + progress, runningDuration, startTime, state, actual); + } + + private void verifyTaskPropertiesJustStartedNoEncryption(String message, String mediaProcessorId, + TaskOption options, String taskBody, String configuration, String name, int priority, TaskInfo actual) + throws ServiceException { + String encryptionKeyId = null; + String encryptionScheme = null; + String encryptionVersion = null; + String initializationVector = null; + + verifyTaskPropertiesJustStarted(message, mediaProcessorId, options, taskBody, configuration, name, priority, + encryptionKeyId, encryptionScheme, encryptionVersion, initializationVector, actual); + } + + private void verifyTaskPropertiesNoEncryption(String message, String mediaProcessorId, TaskOption options, + String taskBody, String configuration, String name, int priority, Date endTime, String errorDetails, + double progress, double runningDuration, Date startTime, TaskState state, TaskInfo actual) + throws ServiceException { + String encryptionKeyId = null; + String encryptionScheme = null; + String encryptionVersion = null; + String initializationVector = null; + + verifyTaskProperties(message, mediaProcessorId, options, taskBody, configuration, name, priority, + encryptionKeyId, encryptionScheme, encryptionVersion, initializationVector, endTime, errorDetails, + progress, runningDuration, startTime, state, actual); + } + + private String constructTaskBody(int outputIndex) { + return "JobInputAsset(0)" + "JobOutputAsset(" + outputIndex + + ")"; + } +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/UploadingIntegrationTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/UploadingIntegrationTest.java new file mode 100644 index 000000000000..080fe6fc4cf1 --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/UploadingIntegrationTest.java @@ -0,0 +1,115 @@ +/** + * 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; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.util.EnumSet; + +import org.junit.BeforeClass; +import org.junit.Test; + +import com.microsoft.windowsazure.services.blob.models.BlockList; +import com.microsoft.windowsazure.services.blob.models.CommitBlobBlocksOptions; +import com.microsoft.windowsazure.services.blob.models.CreateBlobBlockOptions; +import com.microsoft.windowsazure.services.blob.models.CreateBlobOptions; +import com.microsoft.windowsazure.services.core.ExponentialRetryPolicy; +import com.microsoft.windowsazure.services.core.RetryPolicyFilter; +import com.microsoft.windowsazure.services.media.models.AccessPolicy; +import com.microsoft.windowsazure.services.media.models.AccessPolicyInfo; +import com.microsoft.windowsazure.services.media.models.AccessPolicyPermission; +import com.microsoft.windowsazure.services.media.models.Asset; +import com.microsoft.windowsazure.services.media.models.AssetInfo; +import com.microsoft.windowsazure.services.media.models.LocatorInfo; + +/** + * Testing uploading in various permutations. + * + */ +public class UploadingIntegrationTest extends IntegrationTestBase { + private static WritableBlobContainerContract blobWriter; + private static byte[] firstPrimes = new byte[] { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29 }; + + @BeforeClass + public static void setup() throws Exception { + IntegrationTestBase.setup(); + + AssetInfo asset = service.create(Asset.create().setName(testAssetPrefix + "uploadBlockBlobAsset")); + + AccessPolicyInfo policy = service.create(AccessPolicy.create(testPolicyPrefix + "uploadWritePolicy", 10, + EnumSet.of(AccessPolicyPermission.WRITE))); + + LocatorInfo locator = createLocator(policy, asset, 5); + + blobWriter = service.createBlobWriter(locator); + + ExponentialRetryPolicy retryPolicy = new ExponentialRetryPolicy(5000, 5, new int[] { 400, 404 }); + blobWriter = blobWriter.withFilter(new RetryPolicyFilter(retryPolicy)); + } + + @Test + public void canUploadBlockBlob() throws Exception { + InputStream blobContent = new ByteArrayInputStream(firstPrimes); + blobWriter.createBlockBlob("uploadBlockBlobTest", blobContent); + } + + @Test + public void canUploadBlockBlobWithOptions() throws Exception { + InputStream blobContent = new ByteArrayInputStream(firstPrimes); + CreateBlobOptions options = new CreateBlobOptions().addMetadata("testMetadataKey", "testMetadataValue"); + blobWriter.createBlockBlob("canUploadBlockBlobWithOptions", blobContent, options); + } + + @Test + public void canCreateBlobBlock() throws Exception { + InputStream blobContent = new ByteArrayInputStream(firstPrimes); + blobWriter.createBlobBlock("canCreateBlobBlock", "123", blobContent); + } + + @Test + public void canCreateBlobBlockWithOptions() throws Exception { + InputStream blobContent = new ByteArrayInputStream(firstPrimes); + CreateBlobBlockOptions options = new CreateBlobBlockOptions().setTimeout(100); + blobWriter.createBlobBlock("canCreateBlobBlockWithOptions", "123", blobContent, options); + } + + @Test + public void canCommitBlobBlocks() throws Exception { + BlockList blockList = new BlockList(); + blobWriter.commitBlobBlocks("canCommitBlobBlocks", blockList); + } + + @Test + public void canCommitBlobBlocksWithOptions() throws Exception { + BlockList blockList = new BlockList(); + CommitBlobBlocksOptions options = new CommitBlobBlocksOptions() + .setBlobContentType("text/html;charset=ISO-8859-1"); + blobWriter.commitBlobBlocks("canCommitBlobBlocksWithOptions", blockList, options); + } + + @Test + public void canUploadBlockBlobWithExplicitRetry() throws Exception { + InputStream blobContent = new ByteArrayInputStream(firstPrimes); + blobWriter.createBlockBlob("canUploadBlockBlobWithExplicitRetry1", blobContent); + + ExponentialRetryPolicy forceRetryPolicy = new ExponentialRetryPolicy(1, 1, new int[] { 201 }); + WritableBlobContainerContract forceRetryBlobWriter = blobWriter.withFilter(new RetryPolicyFilter( + forceRetryPolicy)); + + blobContent.reset(); + forceRetryBlobWriter.createBlockBlob("canUploadBlockBlobWithExplicitRetry2", blobContent); + } +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/implementation/LinkRetrievalTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/implementation/LinkRetrievalTest.java new file mode 100644 index 000000000000..6e8c9e048327 --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/implementation/LinkRetrievalTest.java @@ -0,0 +1,100 @@ +/** + * 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; + +import static org.junit.Assert.*; + +import javax.xml.bind.JAXBElement; +import javax.xml.namespace.QName; + +import org.junit.Before; +import org.junit.Test; + +import com.microsoft.windowsazure.services.media.implementation.atom.ContentType; +import com.microsoft.windowsazure.services.media.implementation.atom.EntryType; +import com.microsoft.windowsazure.services.media.implementation.atom.LinkType; +import com.microsoft.windowsazure.services.media.implementation.content.Constants; +import com.microsoft.windowsazure.services.media.implementation.content.MediaProcessorType; +import com.microsoft.windowsazure.services.media.models.LinkInfo; +import com.microsoft.windowsazure.services.media.models.MediaProcessorInfo; + +/** + * Testing retrieval of links from ATOM entities + * + */ +public class LinkRetrievalTest { + private static QName linkName = new QName("link", Constants.ATOM_NS); + private MediaProcessorInfo info; + private LinkType link1; + private LinkType link2; + + @Before + public void setup() { + EntryType entry = new EntryType(); + + link1 = new LinkType(); + link1.setTitle("someLink"); + link1.setRel("Related/something"); + link1.setHref("some/uri/somewhere"); + + link2 = new LinkType(); + link2.setTitle("someOtherLink"); + link2.setRel("Related/else"); + link2.setHref("some/other/href/somewhere"); + + entry.getEntryChildren().add(new JAXBElement(linkName, LinkType.class, link1)); + entry.getEntryChildren().add(new JAXBElement(linkName, LinkType.class, link2)); + + MediaProcessorType payload = new MediaProcessorType().setId("DummyId").setName("Dummy Name") + .setVersion("0.0.0").setVendor("Contoso").setSku("sku skiddo").setDescription("For testing links only"); + + ContentType contentElement = new ContentType(); + contentElement.getContent().add( + new JAXBElement(Constants.ODATA_PROPERTIES_ELEMENT_NAME, MediaProcessorType.class, + payload)); + + entry.getEntryChildren().add( + new JAXBElement(Constants.ATOM_CONTENT_ELEMENT_NAME, ContentType.class, contentElement)); + + info = new MediaProcessorInfo(entry, payload); + } + + @Test + public void canRetrieveSingleLinkFromEntity() { + assertTrue(info.hasLink(link1.getRel())); + } + + @Test + public void getFalseWhenLinkIsntThere() { + assertFalse(info.hasLink("noSuchLink")); + } + + @Test + public void canRetrieveEntireLinkByRel() { + LinkInfo link = info.getLink(link2.getRel()); + + assertLinksEqual(link2, link); + } + + @Test + public void getNullWhenLinkIsntThere() { + assertNull(info.getLink("noSuchLink")); + } + + private static void assertLinksEqual(LinkType expected, LinkInfo actual) { + assertEquals(expected.getHref(), actual.getHref()); + } +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/implementation/MediaBatchOperationsTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/implementation/MediaBatchOperationsTest.java new file mode 100644 index 000000000000..22293c734766 --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/implementation/MediaBatchOperationsTest.java @@ -0,0 +1,120 @@ +/** + * 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; + +import static org.junit.Assert.*; + +import java.io.IOException; +import java.net.URI; + +import javax.mail.MessagingException; +import javax.mail.internet.MimeMultipart; +import javax.ws.rs.core.UriBuilder; +import javax.xml.bind.JAXBException; +import javax.xml.parsers.ParserConfigurationException; + +import org.junit.Test; + +import com.microsoft.windowsazure.services.media.models.Job; +import com.microsoft.windowsazure.services.media.models.Task; + +public class MediaBatchOperationsTest { + + @Test + public void createMediaBatchOperationSuccess() throws JAXBException, ParserConfigurationException { + // Arrange + URI serviceUri = UriBuilder.fromPath("http://www.contoso.com/media").build(); + + // Act + MediaBatchOperations mediaBatchOperations = new MediaBatchOperations(serviceUri); + + // Assert + assertNotNull(mediaBatchOperations); + + } + + @Test(expected = IllegalArgumentException.class) + public void createMediaBatchOperationFailedWithNullUri() throws JAXBException, ParserConfigurationException { + // Arrange + URI serviceUri = null; + + // Act + @SuppressWarnings("unused") + MediaBatchOperations mediaBatchOperations = new MediaBatchOperations(serviceUri); + + // Assert + assertTrue(false); + + } + + @Test + public void addCreateJobOperationToMediaBatchOperationsSuccess() throws JAXBException, ParserConfigurationException { + // Arrange + URI serviceUri = UriBuilder.fromPath("http://www.contoso.com/media").build(); + Job.CreateBatchOperation createJobOperation = new Job.CreateBatchOperation(serviceUri); + + // Act + MediaBatchOperations mediaBatchOperations = new MediaBatchOperations(serviceUri); + mediaBatchOperations.addOperation(createJobOperation); + + // Assert + assertNotNull(mediaBatchOperations); + assertEquals(1, mediaBatchOperations.getOperations().size()); + + } + + @Test + public void addCreateTaskOperationToMediaBatchOperationsSuccess() throws JAXBException, + ParserConfigurationException { + // Arrange + URI serviceUri = UriBuilder.fromPath("http://www.contoso.com/media").build(); + String mediaProcessorId = "testMediaProcessorId"; + String taskBody = "testTaskBody"; + + Task.CreateBatchOperation taskCreateBatchOperation = new Task.CreateBatchOperation(mediaProcessorId, taskBody); + + // Act + MediaBatchOperations mediaBatchOperations = new MediaBatchOperations(serviceUri); + mediaBatchOperations.addOperation(taskCreateBatchOperation); + + // Assert + assertNotNull(mediaBatchOperations); + assertEquals(1, mediaBatchOperations.getOperations().size()); + } + + @Test + public void getMimeMultipartSuccess() throws JAXBException, ParserConfigurationException, MessagingException, + IOException { + // Arrange + String mediaProcessorId = "testMediaProcessorId"; + String taskBody = "testTaskBody"; + URI serviceUri = UriBuilder.fromPath("http://www.contoso.com/media").build(); + Task.CreateBatchOperation taskCreateBatchOperation = new Task.CreateBatchOperation(mediaProcessorId, taskBody); + Job.CreateBatchOperation jobCreateBatchOperation = new Job.CreateBatchOperation(serviceUri); + + // Act + MediaBatchOperations mediaBatchOperations = new MediaBatchOperations(serviceUri); + mediaBatchOperations.addOperation(jobCreateBatchOperation); + mediaBatchOperations.addOperation(taskCreateBatchOperation); + MimeMultipart mimeMultipart = mediaBatchOperations.getMimeMultipart(); + + // Assert + assertNotNull(mediaBatchOperations); + assertEquals(2, mediaBatchOperations.getOperations().size()); + assertNotNull(mimeMultipart); + } + +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/implementation/OAuthRestProxyIntegrationTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/implementation/OAuthRestProxyIntegrationTest.java new file mode 100644 index 000000000000..f559ba17d5a6 --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/implementation/OAuthRestProxyIntegrationTest.java @@ -0,0 +1,44 @@ +/** + * 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; + +import static org.junit.Assert.*; + +import java.net.URI; + +import org.junit.Test; + +import com.microsoft.windowsazure.services.media.IntegrationTestBase; +import com.microsoft.windowsazure.services.media.MediaConfiguration; +import com.sun.jersey.api.client.Client; + +public class OAuthRestProxyIntegrationTest extends IntegrationTestBase { + @Test + public void serviceCanBeCalledToCreateAccessToken() throws Exception { + // Arrange + OAuthContract oAuthContract = new OAuthRestProxy(config.create(Client.class)); + + // Act + URI oAuthUri = new URI((String) config.getProperty(MediaConfiguration.OAUTH_URI)); + String clientId = (String) config.getProperty(MediaConfiguration.OAUTH_CLIENT_ID); + String clientSecret = (String) config.getProperty(MediaConfiguration.OAUTH_CLIENT_SECRET); + String scope = (String) config.getProperty(MediaConfiguration.OAUTH_SCOPE); + OAuthTokenResponse result = oAuthContract.getAccessToken(oAuthUri, clientId, clientSecret, scope); + + // Assert + assertNotNull(result); + assertNotNull(result.getAccessToken()); + } +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/implementation/OAuthTokenManagerTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/implementation/OAuthTokenManagerTest.java new file mode 100644 index 000000000000..50794db32c08 --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/implementation/OAuthTokenManagerTest.java @@ -0,0 +1,138 @@ +/** + * 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; + +import static org.junit.Assert.*; +import static org.mockito.Mockito.*; + +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Calendar; +import java.util.Date; +import java.util.TimeZone; + +import org.codehaus.jackson.JsonParseException; +import org.codehaus.jackson.map.JsonMappingException; +import org.junit.Before; +import org.junit.Test; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; + +import com.microsoft.windowsazure.services.core.ServiceException; +import com.microsoft.windowsazure.services.core.utils.DateFactory; + +public class OAuthTokenManagerTest { + private OAuthContract contract; + private OAuthTokenManager client; + private DateFactory dateFactory; + private Calendar calendar; + + @Before + public void init() throws URISyntaxException { + calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT")); + + dateFactory = mock(DateFactory.class); + + // Client channel = new Client(); + contract = mock(OAuthRestProxy.class); + + String acsBaseUri = "testurl"; + String accountName = "testname"; + String accountPassword = "testpassword"; + String scope = "testscope"; + + client = new OAuthTokenManager(contract, dateFactory, acsBaseUri, accountName, accountPassword, scope); + + when(dateFactory.getDate()).thenAnswer(new Answer() { + @Override + public Date answer(InvocationOnMock invocation) throws Throwable { + return calendar.getTime(); + } + }); + } + + private void doIncrementingTokens() throws ServiceException, URISyntaxException, JsonParseException, + JsonMappingException, IOException { + doAnswer(new Answer() { + int count = 0; + + @Override + public OAuthTokenResponse answer(InvocationOnMock invocation) throws Throwable { + ++count; + OAuthTokenResponse wrapResponse = new OAuthTokenResponse(); + wrapResponse.setAccessToken("testaccesstoken1-" + count); + wrapResponse.setExpiresIn(83); + return wrapResponse; + } + }).when(contract).getAccessToken(new URI("testurl"), "testname", "testpassword", "testscope"); + + } + + @Test + public void clientUsesContractToGetToken() throws ServiceException, URISyntaxException, JsonParseException, + JsonMappingException, IOException { + // Arrange + doIncrementingTokens(); + + // Act + String accessToken = client.getAccessToken(); + + // Assert + assertNotNull(accessToken); + assertEquals("testaccesstoken1-1", accessToken); + } + + @Test + public void clientWillNotCallMultipleTimesWhileAccessTokenIsValid() throws ServiceException, URISyntaxException, + JsonParseException, JsonMappingException, IOException { + // Arrange + doIncrementingTokens(); + + // Act + String accessToken1 = client.getAccessToken(); + String accessToken2 = client.getAccessToken(); + calendar.add(Calendar.SECOND, 40); + String accessToken3 = client.getAccessToken(); + + // Assert + assertEquals("testaccesstoken1-1", accessToken1); + assertEquals("testaccesstoken1-1", accessToken2); + assertEquals("testaccesstoken1-1", accessToken3); + + verify(contract, times(1)).getAccessToken(new URI("testurl"), "testname", "testpassword", "testscope"); + } + + @Test + public void clientWillBeCalledWhenTokenIsHalfwayToExpiring() throws ServiceException, URISyntaxException, + JsonParseException, JsonMappingException, IOException { + // Arrange + doIncrementingTokens(); + + // Act + String accessToken1 = client.getAccessToken(); + String accessToken2 = client.getAccessToken(); + calendar.add(Calendar.SECOND, 45); + String accessToken3 = client.getAccessToken(); + + // Assert + assertEquals("testaccesstoken1-1", accessToken1); + assertEquals("testaccesstoken1-1", accessToken2); + assertEquals("testaccesstoken1-2", accessToken3); + + verify(contract, times(2)).getAccessToken(new URI("testurl"), "testname", "testpassword", "testscope"); + } + +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/implementation/ODataDateParsingTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/implementation/ODataDateParsingTest.java new file mode 100644 index 000000000000..faea8a747fc6 --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/implementation/ODataDateParsingTest.java @@ -0,0 +1,143 @@ +/** + * 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; + +import static org.junit.Assert.*; + +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.TimeZone; + +import org.junit.BeforeClass; +import org.junit.Test; + +/** + * Tests around parsing dates - OData requires date + * strings without timezones be treated as UTC. + * ISO spec, and Java default, is to use local timezone. + * So we need to plug in to tweak Jaxb to use OData + * conventions. + * + */ +public class ODataDateParsingTest { + private static TimeZone utc; + private static TimeZone pst; + + @BeforeClass + public static void setupClass() { + utc = TimeZone.getDefault(); + utc.setRawOffset(0); + + pst = TimeZone.getDefault(); + pst.setRawOffset(-8 * 60 * 60 * 1000); + } + + @Test + public void canConvertDateToString() throws Exception { + + Calendar sampleTime = new GregorianCalendar(2012, 11, 28, 17, 43, 12); + sampleTime.setTimeZone(utc); + + Date sampleDate = sampleTime.getTime(); + + String formatted = new ODataDateAdapter().marshal(sampleDate); + + assertEquals("2012-12-28T17:43:12Z", formatted); + + } + + @Test + public void stringWithTimezoneRoundTripsCorrectly() throws Exception { + String exampleDate = "2012-11-28T17:43:12-08:00"; + + Date parsedTime = new ODataDateAdapter().unmarshal(exampleDate); + + Calendar expectedTime = new GregorianCalendar(2012, 10, 28, 17, 43, 12); + expectedTime.setTimeZone(pst); + + assertEquals(expectedTime.getTimeInMillis(), parsedTime.getTime()); + } + + @Test + public void stringWithUTCTimezoneRoundTripsCorrectly() throws Exception { + String exampleDate = "2012-11-28T17:43:12Z"; + + Date parsedTime = new ODataDateAdapter().unmarshal(exampleDate); + + Calendar expectedTime = new GregorianCalendar(2012, 10, 28, 17, 43, 12); + expectedTime.setTimeZone(utc); + + assertEquals(expectedTime.getTimeInMillis(), parsedTime.getTime()); + } + + @Test + public void stringWithNoTimezoneActsAsUTC() throws Exception { + String exampleDate = "2012-11-28T17:43:12"; + + Date parsedTime = new ODataDateAdapter().unmarshal(exampleDate); + + Calendar expectedTime = new GregorianCalendar(2012, 10, 28, 17, 43, 12); + expectedTime.setTimeZone(utc); + + assertEquals(expectedTime.getTimeInMillis(), parsedTime.getTime()); + } + + @Test + public void stringWithFractionalTimeReturnsCorrectMillisecondsTo100nsBoundary() throws Exception { + String exampleDate = "2012-11-28T17:43:12.1234567Z"; + + Date parsedTime = new ODataDateAdapter().unmarshal(exampleDate); + + Calendar timeToNearestSecond = Calendar.getInstance(); + timeToNearestSecond.setTimeZone(utc); + timeToNearestSecond.set(2012, 10, 28, 17, 43, 12); + timeToNearestSecond.set(Calendar.MILLISECOND, 0); + + long millis = parsedTime.getTime() - timeToNearestSecond.getTimeInMillis(); + + assertEquals(123, millis); + } + + @Test + public void stringWithFractionalTimeReturnsCorrectMillisecondsAsFractionNotCount() throws Exception { + String exampleDate = "2012-11-28T17:43:12.1Z"; + + Date parsedTime = new ODataDateAdapter().unmarshal(exampleDate); + + Calendar timeToNearestSecond = Calendar.getInstance(); + timeToNearestSecond.setTimeZone(utc); + timeToNearestSecond.set(2012, 10, 28, 17, 43, 12); + timeToNearestSecond.set(Calendar.MILLISECOND, 0); + + long millis = parsedTime.getTime() - timeToNearestSecond.getTimeInMillis(); + assertEquals(100, millis); + + } + + @Test + public void stringWithFractionalSecondsAndTimezoneOffsetParses() throws Exception { + String exampleDate = "2012-11-28T17:43:12.1-08:00"; + Date parsedTime = new ODataDateAdapter().unmarshal(exampleDate); + + Calendar expectedTime = new GregorianCalendar(2012, 10, 28, 17, 43, 12); + expectedTime.setTimeZone(pst); + expectedTime.set(Calendar.MILLISECOND, 100); + + assertEquals(expectedTime.getTimeInMillis(), parsedTime.getTime()); + + } +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/implementation/ODataSerializationFromJerseyTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/implementation/ODataSerializationFromJerseyTest.java new file mode 100644 index 000000000000..580a8909fec5 --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/implementation/ODataSerializationFromJerseyTest.java @@ -0,0 +1,109 @@ +/** + * 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; + +import java.net.URISyntaxException; +import java.util.List; + +import javax.ws.rs.core.MediaType; + +import org.junit.Assert; +import org.junit.Test; + +import com.microsoft.windowsazure.services.core.utils.DefaultDateFactory; +import com.microsoft.windowsazure.services.media.IntegrationTestBase; +import com.microsoft.windowsazure.services.media.MediaConfiguration; +import com.microsoft.windowsazure.services.media.MediaContract; +import com.microsoft.windowsazure.services.media.implementation.content.AssetType; +import com.microsoft.windowsazure.services.media.models.Asset; +import com.microsoft.windowsazure.services.media.models.AssetInfo; +import com.sun.jersey.api.client.Client; +import com.sun.jersey.api.client.WebResource; +import com.sun.jersey.api.client.config.ClientConfig; +import com.sun.jersey.api.client.config.DefaultClientConfig; +import com.sun.jersey.api.client.filter.LoggingFilter; +import com.sun.jersey.api.json.JSONConfiguration; + +public class ODataSerializationFromJerseyTest extends IntegrationTestBase { + + @Test + public void canBuildJerseyClientToCreateAnAssetWhichIsProperlyDeserialized() throws Exception { + // Build a jersey client object by hand; this is working up to the + // full integration into the media services rest proxy, but we + // need to go step by step to begin. + + ClientConfig cc = new DefaultClientConfig(); + cc.getProperties().put(ClientConfig.PROPERTY_FOLLOW_REDIRECTS, false); + cc.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, true); + cc.getSingletons().add(new ODataEntityProvider()); + Client c = Client.create(cc); + + c.addFilter(new LoggingFilter(System.out)); + c.addFilter(new RedirectFilter(createLocationManager())); + c.addFilter(new OAuthFilter(createTokenManager())); + c.addFilter(new VersionHeadersFilter()); + + WebResource assetResource = c.resource("Assets"); + + ODataAtomMarshaller m = new ODataAtomMarshaller(); + AssetType requestData = new AssetType(); + requestData.setName("firstTestAsset"); + requestData.setAlternateId("some external id"); + + AssetInfo newAsset = assetResource.type(MediaType.APPLICATION_ATOM_XML).accept(MediaType.APPLICATION_ATOM_XML) + .post(AssetInfo.class, m.marshalEntry(requestData)); + + Assert.assertNotNull(newAsset); + Assert.assertEquals("firstTestAsset", newAsset.getName()); + Assert.assertEquals("some external id", newAsset.getAlternateId()); + } + + private OAuthContract createOAuthContract() { + return new OAuthRestProxy(Client.create()); + } + + private OAuthTokenManager createTokenManager() throws URISyntaxException { + return new OAuthTokenManager(createOAuthContract(), new DefaultDateFactory(), + (String) config.getProperty(MediaConfiguration.OAUTH_URI), + (String) config.getProperty(MediaConfiguration.OAUTH_CLIENT_ID), + (String) config.getProperty(MediaConfiguration.OAUTH_CLIENT_SECRET), + (String) config.getProperty(MediaConfiguration.OAUTH_SCOPE)); + } + + private ResourceLocationManager createLocationManager() throws URISyntaxException { + return new ResourceLocationManager((String) config.getProperty(MediaConfiguration.URI)); + } + + @Test + public void canCreateAssetThroughMediaServiceAPI() throws Exception { + MediaContract client = createService(); + AssetInfo newAsset = client.create(Asset.create().setName("secondTestAsset")); + + Assert.assertEquals("secondTestAsset", newAsset.getName()); + } + + @Test + public void canRetrieveListOfAssets() throws Exception { + MediaContract client = createService(); + List assets = client.list(Asset.list()); + + Assert.assertNotNull(assets); + } + + private MediaContract createService() { + return config.create(MediaContract.class); + } +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/implementation/ODataSerializationTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/implementation/ODataSerializationTest.java new file mode 100644 index 000000000000..c64b32afd905 --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/implementation/ODataSerializationTest.java @@ -0,0 +1,96 @@ +/** + * 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; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.util.List; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBElement; +import javax.xml.bind.Marshaller; +import javax.xml.namespace.QName; + +import junit.framework.Assert; + +import org.junit.Test; + +import com.microsoft.windowsazure.services.media.implementation.atom.ContentType; +import com.microsoft.windowsazure.services.media.implementation.atom.EntryType; +import com.microsoft.windowsazure.services.media.implementation.content.AssetType; +import com.microsoft.windowsazure.services.media.implementation.content.Constants; +import com.microsoft.windowsazure.services.media.models.AssetInfo; + +public class ODataSerializationTest { + + private final String sampleFeedOneAsset = "\n" + + "\n" + + " https://wamsbayclus001rest-hs.cloudapp.net/api/Assets\n" + + " Assets\n" + + " 2012-08-28T18:35:15Z\n" + + " \n" + + " \n" + + " https://wamsbayclus001rest-hs.cloudapp.net/api/Assets('nb%3Acid%3AUUID%3A1f6c7bb4-8013-486e-b4c9-2e4a6842b9a6')\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " <updated>2012-08-28T18:35:15Z</updated>\n" + + " <author>\n" + + " <name />\n" + + " </author>\n" + + " <m:action metadata=\"https://wamsbayclus001rest-hs.cloudapp.net/api/$metadata#WindowsAzureMediaServices.Publish\" title=\"Publish\" target=\"https://wamsbayclus001rest-hs.cloudapp.net/api/Assets('nb%3Acid%3AUUID%3A1f6c7bb4-8013-486e-b4c9-2e4a6842b9a6')/Publish\" />\n" + + " <content type=\"application/xml\">\n" + " <m:properties>\n" + + " <d:Id>nb:cid:UUID:1f6c7bb4-8013-486e-b4c9-2e4a6842b9a6</d:Id>\n" + + " <d:State m:type=\"Edm.Int32\">0</d:State>\n" + + " <d:Created m:type=\"Edm.DateTime\">2012-08-28T18:34:06.123</d:Created>\n" + + " <d:LastModified m:type=\"Edm.DateTime\">2012-08-28T18:34:06.123</d:LastModified>\n" + + " <d:AlternateId m:null=\"true\" />\n" + " <d:Name>testAsset</d:Name>\n" + + " <d:Options m:type=\"Edm.Int32\">0</d:Options>\n" + " </m:properties>\n" + + " </content>\n" + " </entry>\n" + "</feed>"; + + @Test + public void canUnmarshallAssetFromFeed() throws Exception { + ODataAtomUnmarshaller um = new ODataAtomUnmarshaller(); + InputStream input = new ByteArrayInputStream(sampleFeedOneAsset.getBytes("UTF-8")); + List<AssetInfo> entries = um.unmarshalFeed(input, AssetInfo.class); + Assert.assertEquals(1, entries.size()); + Assert.assertEquals("nb:cid:UUID:1f6c7bb4-8013-486e-b4c9-2e4a6842b9a6", entries.get(0).getId()); + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + @Test + public void canMarshalEntryFromJavaObject() throws Exception { + AssetType a = new AssetType(); + a.setName("testNewAsset"); + a.setOptions(0); + a.setAlternateId("some other id"); + + JAXBContext context = JAXBContext.newInstance(EntryType.class, AssetType.class); + Marshaller m = context.createMarshaller(); + + EntryType e = new EntryType(); + ContentType c = new ContentType(); + c.getContent().add(new JAXBElement(Constants.ODATA_PROPERTIES_ELEMENT_NAME, AssetType.class, a)); + e.getEntryChildren().add(new JAXBElement(Constants.ATOM_CONTENT_ELEMENT_NAME, ContentType.class, c)); + + m.marshal(new JAXBElement(new QName(Constants.ATOM_NS, "entry"), EntryType.class, e), System.out); + + } +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/implementation/RedirectionFilterTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/implementation/RedirectionFilterTest.java new file mode 100644 index 000000000000..32c6f5525cca --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/implementation/RedirectionFilterTest.java @@ -0,0 +1,160 @@ +/** + * 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; + +import static org.junit.Assert.*; + +import javax.ws.rs.core.MultivaluedMap; + +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.mockito.Mockito; + +import com.sun.jersey.api.client.Client; +import com.sun.jersey.api.client.ClientHandlerException; +import com.sun.jersey.api.client.ClientRequest; +import com.sun.jersey.api.client.ClientResponse; +import com.sun.jersey.api.client.filter.ClientFilter; +import com.sun.jersey.core.header.InBoundHeaders; + +public class RedirectionFilterTest { + @Rule + public ExpectedException thrown = ExpectedException.none(); + + private final String originalBaseURI = "https://base.somewhere.example/API/"; + private final String redirectedBaseURI = "http://redirected.somewhere.example/Stuff/"; + + @Test + public void whenInvokedAndNotRedirected_shouldAddBaseURIToRequest() throws Exception { + RequestRecordingFilter sink = new RequestRecordingFilter(); + Client c = Client.create(); + c.addFilter(sink); + c.addFilter(new RedirectFilter(new ResourceLocationManager(originalBaseURI))); + + c.resource("Files").get(ClientResponse.class); + + assertEquals(originalBaseURI + "Files", sink.request.getURI().toString()); + } + + @Test + public void whenInvokedAndRedirected_shouldHaveRedirectedURIInRequest() throws Exception { + RequestRecordingFilter sink = new RequestRecordingFilter(); + Client c = Client.create(); + c.addFilter(sink); + c.addFilter(new RedirectingTestFilter(originalBaseURI, redirectedBaseURI)); + + c.addFilter(new RedirectFilter(new ResourceLocationManager(originalBaseURI))); + + ClientResponse response = c.resource("Things").get(ClientResponse.class); + + assertEquals(200, response.getStatus()); + assertEquals(redirectedBaseURI + "Things", sink.request.getURI().toString()); + } + + @Test + public void whenRedirectedMultipleTimes_requestEndsUpAtFinalRediret() throws Exception { + RequestRecordingFilter sink = new RequestRecordingFilter(); + Client c = Client.create(); + c.addFilter(sink); + c.addFilter(new RedirectingTestFilter("https://a.example/API/", "https://b.example/API/")); + c.addFilter(new RedirectingTestFilter("https://b.example/API/", "https://c.example/API/")); + c.addFilter(new RedirectingTestFilter("https://c.example/API/", "https://final.example/Code/")); + + c.addFilter(new RedirectFilter(new ResourceLocationManager("https://a.example/API/"))); + + ClientResponse response = c.resource("Stuff").get(ClientResponse.class); + + assertEquals(200, response.getStatus()); + + assertEquals("https://final.example/Code/Stuff", sink.request.getURI().toString()); + } + + @Test + public void whenRedirectingToNull_shouldGetClientException() throws Exception { + RequestRecordingFilter sink = new RequestRecordingFilter(); + Client c = Client.create(); + c.addFilter(sink); + c.addFilter(new RedirectingTestFilter(originalBaseURI, null)); + c.addFilter(new RedirectFilter(new ResourceLocationManager(originalBaseURI))); + + thrown.expect(ClientHandlerException.class); + c.resource("Something").get(ClientResponse.class); + } + + @Test + public void whenRedirectingToBadURI_shouldGetClientException() throws Exception { + RequestRecordingFilter sink = new RequestRecordingFilter(); + Client c = Client.create(); + c.addFilter(sink); + c.addFilter(new RedirectingTestFilter(originalBaseURI, "no way this is valid!")); + c.addFilter(new RedirectFilter(new ResourceLocationManager(originalBaseURI))); + + thrown.expect(ClientHandlerException.class); + c.resource("Something").get(ClientResponse.class); + } + + // Test support classes + + // + // Filter that acts as a "sink" so the request doesn't go out over + // the wire. Also holds onto the request object that went through + // the pipeline so that it can be asserted against in the test. + // + private class RequestRecordingFilter extends ClientFilter { + public ClientRequest request; + + @Override + public ClientResponse handle(ClientRequest request) throws ClientHandlerException { + this.request = request; + + ClientResponse response = Mockito.mock(ClientResponse.class); + Mockito.when(response.getStatus()).thenReturn(200); + return response; + } + } + + // + // Filter that will 301-redirect requests depending on which URI + // the request goes to. + // + + private class RedirectingTestFilter extends ClientFilter { + private final String uriToRedirect; + private final String uriRedirectedTo; + + public RedirectingTestFilter(String uriToRedirect, String uriRedirectedTo) { + this.uriToRedirect = uriToRedirect; + this.uriRedirectedTo = uriRedirectedTo; + } + + @Override + public ClientResponse handle(ClientRequest request) throws ClientHandlerException { + + if (request.getURI().toString().startsWith(uriToRedirect)) { + ClientResponse response = Mockito.mock(ClientResponse.class); + Mockito.when(response.getClientResponseStatus()).thenReturn(ClientResponse.Status.MOVED_PERMANENTLY); + MultivaluedMap<String, String> headers = new InBoundHeaders(); + headers.add("location", uriRedirectedTo); + Mockito.when(response.getHeaders()).thenReturn(headers); + return response; + } + else { + return getNext().handle(request); + } + } + } +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/implementation/ResourceLocationManagerTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/implementation/ResourceLocationManagerTest.java new file mode 100644 index 000000000000..d7c11ae94764 --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/implementation/ResourceLocationManagerTest.java @@ -0,0 +1,61 @@ +/** + * 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; + +import static org.junit.Assert.*; + +import java.net.URI; + +import org.junit.Test; + +public class ResourceLocationManagerTest { + + @Test + public void testCanCreateWithBaseUri() throws Exception { + String baseUri = "https://base.uri.example"; + ResourceLocationManager m = new ResourceLocationManager(baseUri); + + assertEquals(baseUri, m.getBaseURI().toString()); + } + + @Test + public void testWhenCallingGetRedirectedURI_shouldReturnURIWithBaseURIPreprended() throws Exception { + String baseURI = "http://base.uri.example/path/"; + ResourceLocationManager m = new ResourceLocationManager(baseURI); + + URI originalURI = new URI("Assets"); + + URI redirectedURI = m.getRedirectedURI(originalURI); + + assertEquals(baseURI + "Assets", redirectedURI.toString()); + } + + @Test + public void settingBaseURIAfterRedirecting_shouldReturnURIWithNewBaseURI() throws Exception { + String baseURI = "http://base.uri.example/path/"; + String redirectedBaseURI = "http://other.uri.example/API/"; + ResourceLocationManager m = new ResourceLocationManager(baseURI); + + URI targetURI = new URI("Assets"); + + URI originalURI = m.getRedirectedURI(targetURI); + m.setRedirectedURI(redirectedBaseURI); + URI redirectedURI = m.getRedirectedURI(targetURI); + + assertEquals(baseURI + "Assets", originalURI.toString()); + assertEquals(redirectedBaseURI + "Assets", redirectedURI.toString()); + } +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/implementation/SASTokenFilterTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/implementation/SASTokenFilterTest.java new file mode 100644 index 000000000000..ac543d83b54c --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/implementation/SASTokenFilterTest.java @@ -0,0 +1,128 @@ +/** + * 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; + +import static org.junit.Assert.*; + +import java.net.URI; +import java.util.HashMap; +import java.util.Map; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mockito; + +import com.sun.jersey.api.client.Client; +import com.sun.jersey.api.client.ClientHandlerException; +import com.sun.jersey.api.client.ClientRequest; +import com.sun.jersey.api.client.ClientResponse; +import com.sun.jersey.api.client.WebResource; +import com.sun.jersey.api.client.filter.ClientFilter; + +public class SASTokenFilterTest { + + private final String sampleSASToken = "st=2012-10-05T21%3A10%3A25Z&se=2012-10-05T21%3A15%3A25Z&sr=c&si=89fa57b4-293f-40df-a0cb-9d84ee493b8c&sig=iMDPr8V%2FIJrYG8t2GeSqBh5tTUdM7ykOObFVICa%2F%2F1Q%3D"; + private RequestRecordingFilter sink; + private Client client; + + @Before + public void setup() throws Exception { + sink = new RequestRecordingFilter(); + client = Client.create(); + client.addFilter(sink); + client.addFilter(new SASTokenFilter(sampleSASToken)); + } + + @Test + public void filterAddsQueryParameterToRequestUrl() throws Exception { + + WebResource r = client.resource("http://astorageaccount.blob.something.example/asset-abcd"); + + r.get(ClientResponse.class); + + assertContainsSASToken(sink.request.getURI()); + } + + @Test + public void filterPreservesQueryParameters() throws Exception { + client.resource("http://storage.service.example/asset-efgh").queryParam("param0", "first") + .queryParam("param1", "second").get(ClientResponse.class); + + assertContainsSASToken(sink.request.getURI()); + + Map<String, String> queryParams = parseQueryParameters(sink.request.getURI()); + assertTrue(queryParams.containsKey("param0")); + assertTrue(queryParams.containsKey("param1")); + assertEquals("first", queryParams.get("param0")); + assertEquals("second", queryParams.get("param1")); + } + + // Test support code + + // + // Filter that acts as a "sink" so the request doesn't go out over + // the wire. Also holds onto the request object that went through + // the pipeline so that it can be asserted against in the test. + // + private class RequestRecordingFilter extends ClientFilter { + public ClientRequest request; + + @Override + public ClientResponse handle(ClientRequest request) throws ClientHandlerException { + this.request = request; + + ClientResponse response = Mockito.mock(ClientResponse.class); + Mockito.when(response.getStatus()).thenReturn(200); + return response; + } + } + + // Assertion helpers + + private void assertContainsSASToken(URI uri) { + Map<String, String> queryParams = parseQueryParameters(uri); + + assertTrue(queryParams.containsKey("st")); + assertTrue(queryParams.containsKey("se")); + assertTrue(queryParams.containsKey("sr")); + assertTrue(queryParams.containsKey("si")); + assertTrue(queryParams.containsKey("sig")); + + assertEquals("iMDPr8V%2FIJrYG8t2GeSqBh5tTUdM7ykOObFVICa%2F%2F1Q%3D", queryParams.get("sig")); + } + + // Simplistic parsing of query parameters into map so we can assert against contents + // easily. + private Map<String, String> parseQueryParameters(URI uri) { + HashMap<String, String> queryParameters = new HashMap<String, String>(); + String queryString = uri.getRawQuery(); + if (queryString.startsWith("?")) { + queryString = queryString.substring(1); + } + + String[] parameters = queryString.split("&"); + + for (String param : parameters) { + int firstEqualIndex = param.indexOf('='); + String paramName = param.substring(0, firstEqualIndex); + String value = param.substring(firstEqualIndex + 1); + + queryParameters.put(paramName, value); + } + return queryParameters; + } + +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/implementation/StatusLineTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/implementation/StatusLineTest.java new file mode 100644 index 000000000000..4c5b2d2d2518 --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/implementation/StatusLineTest.java @@ -0,0 +1,71 @@ +/** + * 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; + +import static org.junit.Assert.*; + +import java.io.ByteArrayInputStream; + +import javax.activation.DataSource; + +import org.junit.Test; + +import com.microsoft.windowsazure.services.table.implementation.InputStreamDataSource; + +public class StatusLineTest { + + @Test + public void testCanCreateStatus() throws Exception { + // Arrange + String httpResponse = "HTTP/1.1 200 OK"; + int expectedStatus = 200; + String expectedReason = "OK"; + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(httpResponse.getBytes()); + DataSource dataSource = new InputStreamDataSource(byteArrayInputStream, "defaultContentType"); + + // Act + StatusLine statusLine = StatusLine.create(dataSource); + + // Assert + assertEquals(expectedStatus, statusLine.getStatus()); + assertEquals(expectedReason, statusLine.getReason()); + } + + @Test + public void testGetSetStatus() { + // Arrange + String httpResponse = "HTTP/1.1 200 OK"; + int expectedStatus = 300; + String expectedReason = "NotOK"; + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(httpResponse.getBytes()); + DataSource dataSource = new InputStreamDataSource(byteArrayInputStream, "defaultContentType"); + StatusLine statusLine = StatusLine.create(dataSource); + + // Act + statusLine.setStatus(expectedStatus); + statusLine.setReason(expectedReason); + + // Assert + assertEquals(expectedStatus, statusLine.getStatus()); + assertEquals(expectedReason, statusLine.getReason()); + } + + @Test + public void testGetSetReason() { + + } + +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/AccessPolicyEntityTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/AccessPolicyEntityTest.java new file mode 100644 index 000000000000..6c7ec9b6b604 --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/AccessPolicyEntityTest.java @@ -0,0 +1,85 @@ +/** + * 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.models; + +import static org.junit.Assert.*; + +import java.net.URLEncoder; +import java.util.EnumSet; + +import org.junit.Test; + +import com.microsoft.windowsazure.services.media.entityoperations.EntityCreateOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityGetOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityListOperation; +import com.microsoft.windowsazure.services.media.implementation.content.AccessPolicyType; + +/** + * Tests for access policy entity + * + */ +public class AccessPolicyEntityTest { + private static final String examplePolicyId = "nb:pid:UUID:c577052a-6c0a-45b0-bf15-3ff3a2a41802"; + private final String expectedUri; + + public AccessPolicyEntityTest() throws Exception { + expectedUri = String.format("AccessPolicies('%s')", URLEncoder.encode(examplePolicyId, "UTF-8")); + } + + @Test + public void createAccessPolicyProvidesExpectedPayload() throws Exception { + String name = "some Access Policy"; + double duration = 10; + EnumSet<AccessPolicyPermission> permissions = EnumSet.of(AccessPolicyPermission.READ, + AccessPolicyPermission.LIST); + + EntityCreateOperation<AccessPolicyInfo> creator = AccessPolicy.create(name, duration, permissions); + + AccessPolicyType payload = (AccessPolicyType) creator.getRequestContents(); + + assertEquals(name, payload.getName()); + assertEquals(duration, payload.getDurationInMinutes(), 0.0); + assertEquals(AccessPolicyPermission.bitsFromPermissions(permissions), payload.getPermissions().intValue()); + } + + @Test + public void getReturnsExpectedUri() throws Exception { + EntityGetOperation<AccessPolicyInfo> getter = AccessPolicy.get(examplePolicyId); + + assertEquals(expectedUri, getter.getUri()); + } + + @Test + public void listReturnsExpectedUri() throws Exception { + EntityListOperation<AccessPolicyInfo> lister = AccessPolicy.list(); + + assertEquals("AccessPolicies", lister.getUri()); + } + + @Test + public void listWithQueryParametersReturnsThem() throws Exception { + EntityListOperation<AccessPolicyInfo> lister = AccessPolicy.list().setTop(10).setSkip(2); + + assertEquals("10", lister.getQueryParameters().getFirst("$top")); + assertEquals("2", lister.getQueryParameters().getFirst("$skip")); + assertEquals(2, lister.getQueryParameters().size()); + } + + @Test + public void deleteReturnsExpectedUri() throws Exception { + assertEquals(expectedUri, AccessPolicy.delete(examplePolicyId).getUri()); + } +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/AccessPolicyInfoTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/AccessPolicyInfoTest.java new file mode 100644 index 000000000000..7e4a488dd9b7 --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/AccessPolicyInfoTest.java @@ -0,0 +1,90 @@ +/** + * 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.models; + +import java.util.Date; +import java.util.EnumSet; + +import org.junit.Assert; +import org.junit.Test; + +import com.microsoft.windowsazure.services.media.implementation.content.AccessPolicyType; + +public class AccessPolicyInfoTest { + + @Test + public void getSetId() { + String expected = "expectedId"; + + AccessPolicyInfo policy = new AccessPolicyInfo(null, new AccessPolicyType().setId(expected)); + + String actual = policy.getId(); + + Assert.assertEquals(expected, actual); + } + + @Test + public void getSetCreated() { + Date expected = new Date(); + AccessPolicyInfo policy = new AccessPolicyInfo(null, new AccessPolicyType().setCreated(expected)); + + Date actual = policy.getCreated(); + + Assert.assertEquals(expected, actual); + } + + @Test + public void getSetLastModified() { + Date expected = new Date(); + AccessPolicyInfo policy = new AccessPolicyInfo(null, new AccessPolicyType().setLastModified(expected)); + + Date actual = policy.getLastModified(); + + Assert.assertEquals(expected, actual); + } + + @Test + public void getSetName() { + String expected = "policy name goes here"; + AccessPolicyInfo policy = new AccessPolicyInfo(null, new AccessPolicyType().setName(expected)); + + String actual = policy.getName(); + + Assert.assertEquals(expected, actual); + } + + @Test + public void getSetDurationInMinutes() { + double expected = 60; // arbitrary value + AccessPolicyInfo policy = new AccessPolicyInfo(null, new AccessPolicyType().setDurationInMinutes(expected)); + + double actual = policy.getDurationInMinutes(); + + Assert.assertEquals(expected, actual, 0.0); + } + + @Test + public void getSetPermissions() { + EnumSet<AccessPolicyPermission> expected = EnumSet + .of(AccessPolicyPermission.LIST, AccessPolicyPermission.WRITE); + AccessPolicyInfo policy = new AccessPolicyInfo(null, + new AccessPolicyType().setPermissions(AccessPolicyPermission.bitsFromPermissions(expected))); + + EnumSet<AccessPolicyPermission> actual = policy.getPermissions(); + + Assert.assertEquals(expected, actual); + } +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/AccessPolicyPermissionTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/AccessPolicyPermissionTest.java new file mode 100644 index 000000000000..90bfb9cf4efe --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/AccessPolicyPermissionTest.java @@ -0,0 +1,94 @@ +/** + * 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.models; + +import static org.junit.Assert.*; + +import java.util.EnumSet; + +import org.junit.Test; + +public class AccessPolicyPermissionTest { + + @Test + public void testGetFlagValue() { + assertEquals(0, AccessPolicyPermission.NONE.getFlagValue()); + assertEquals(1, AccessPolicyPermission.READ.getFlagValue()); + assertEquals(2, AccessPolicyPermission.WRITE.getFlagValue()); + assertEquals(4, AccessPolicyPermission.DELETE.getFlagValue()); + assertEquals(8, AccessPolicyPermission.LIST.getFlagValue()); + } + + @Test + public void testZeroResultsInNonePermission() { + EnumSet<AccessPolicyPermission> perms = AccessPolicyPermission.permissionsFromBits(0); + assertTrue(perms.contains(AccessPolicyPermission.NONE)); + } + + @Test + public void testAllBitsSetResultsInAllPermissions() { + EnumSet<AccessPolicyPermission> perms = AccessPolicyPermission.permissionsFromBits(1 + 2 + 4 + 8); + + assertFalse(perms.contains(AccessPolicyPermission.NONE)); + assertTrue(perms.contains(AccessPolicyPermission.READ)); + assertTrue(perms.contains(AccessPolicyPermission.WRITE)); + assertTrue(perms.contains(AccessPolicyPermission.DELETE)); + assertTrue(perms.contains(AccessPolicyPermission.LIST)); + } + + @Test + public void testWriteBitsResultsInOnlyWritePermissions() { + EnumSet<AccessPolicyPermission> perms = AccessPolicyPermission.permissionsFromBits(2); + + assertFalse(perms.contains(AccessPolicyPermission.NONE)); + assertFalse(perms.contains(AccessPolicyPermission.READ)); + assertTrue(perms.contains(AccessPolicyPermission.WRITE)); + assertFalse(perms.contains(AccessPolicyPermission.DELETE)); + assertFalse(perms.contains(AccessPolicyPermission.LIST)); + } + + @Test + public void testEmptyPermissionsResultsInZeroBits() { + EnumSet<AccessPolicyPermission> perms = EnumSet.noneOf(AccessPolicyPermission.class); + int bits = AccessPolicyPermission.bitsFromPermissions(perms); + + assertEquals(0, bits); + } + + @Test + public void allPermissionsInSetResultsInCorrectValue() { + EnumSet<AccessPolicyPermission> perms = EnumSet.of(AccessPolicyPermission.READ, AccessPolicyPermission.WRITE, + AccessPolicyPermission.DELETE, AccessPolicyPermission.LIST, AccessPolicyPermission.NONE); + int bits = AccessPolicyPermission.bitsFromPermissions(perms); + + assertEquals(1 + 2 + 4 + 8, bits); + } + + @Test + public void writePermissionsInSetResultsInCorrectValue() { + EnumSet<AccessPolicyPermission> perms = EnumSet.of(AccessPolicyPermission.WRITE); + int bits = AccessPolicyPermission.bitsFromPermissions(perms); + + assertEquals(2, bits); + } + + @Test + public void unknownPermissionBitsAreIgnored() { + EnumSet<AccessPolicyPermission> perms = AccessPolicyPermission.permissionsFromBits(16 + 32); + + assertTrue(perms.contains(AccessPolicyPermission.NONE)); + } +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/AssetEntityTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/AssetEntityTest.java new file mode 100644 index 000000000000..a60c58ca06dd --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/AssetEntityTest.java @@ -0,0 +1,191 @@ +/** + * 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.models; + +import static org.junit.Assert.*; + +import java.net.URLEncoder; + +import javax.xml.bind.JAXBElement; +import javax.xml.namespace.QName; + +import org.junit.Test; + +import com.microsoft.windowsazure.services.media.entityoperations.EntityDeleteOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityGetOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityListOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityUpdateOperation; +import com.microsoft.windowsazure.services.media.implementation.atom.ContentType; +import com.microsoft.windowsazure.services.media.implementation.atom.EntryType; +import com.microsoft.windowsazure.services.media.implementation.atom.LinkType; +import com.microsoft.windowsazure.services.media.implementation.content.AssetType; +import com.microsoft.windowsazure.services.media.implementation.content.Constants; +import com.microsoft.windowsazure.services.media.implementation.content.JobType; + +/** + * Tests for the methods and factories of the Asset entity. + */ +public class AssetEntityTest { + static final String sampleAssetId = "nb:cid:UUID:1151b8bd-9ada-4e7f-9787-8dfa49968eab"; + private final String expectedUri = String.format("Assets('%s')", URLEncoder.encode(sampleAssetId, "UTF-8")); + + public AssetEntityTest() throws Exception { + } + + @Test + public void assetCreateReturnsDefaultCreatePayload() { + AssetType payload = (AssetType) Asset.create().getRequestContents(); + + assertNotNull(payload); + assertNull(payload.getId()); + assertNull(payload.getState()); + assertNull(payload.getCreated()); + assertNull(payload.getLastModified()); + assertNull(payload.getAlternateId()); + assertNull(payload.getName()); + assertNull(payload.getOptions()); + } + + @Test + public void assetCreateCanSetAssetName() { + String name = "assetCreateCanSetAssetName"; + + Asset.Creator creator = Asset.create().setName("assetCreateCanSetAssetName"); + + AssetType payload = (AssetType) creator.getRequestContents(); + + assertNotNull(payload); + assertNull(payload.getId()); + assertNull(payload.getState()); + assertNull(payload.getCreated()); + assertNull(payload.getLastModified()); + assertNull(payload.getAlternateId()); + assertEquals(name, payload.getName()); + assertNull(payload.getOptions()); + } + + @Test + public void assetGetReturnsExpectedUri() throws Exception { + String expectedUri = String.format("Assets('%s')", URLEncoder.encode(sampleAssetId, "UTF-8")); + + EntityGetOperation<AssetInfo> getter = Asset.get(sampleAssetId); + + assertEquals(expectedUri, getter.getUri()); + } + + @Test + public void assetListReturnsExpectedUri() { + EntityListOperation<AssetInfo> lister = Asset.list(); + + assertEquals("Assets", lister.getUri()); + assertNotNull(lister.getQueryParameters()); + assertEquals(0, lister.getQueryParameters().size()); + } + + @Test + public void assetListCanTakeQueryParameters() { + EntityListOperation<AssetInfo> lister = Asset.list().setTop(10).setSkip(2); + + assertEquals("10", lister.getQueryParameters().getFirst("$top")); + assertEquals("2", lister.getQueryParameters().getFirst("$skip")); + assertEquals(2, lister.getQueryParameters().size()); + } + + @Test + public void assetListCanTakeQueryParametersChained() { + EntityListOperation<AssetInfo> lister = Asset.list().setTop(10).setSkip(2).set("filter", "something"); + + assertEquals("10", lister.getQueryParameters().getFirst("$top")); + assertEquals("2", lister.getQueryParameters().getFirst("$skip")); + assertEquals("something", lister.getQueryParameters().getFirst("filter")); + assertEquals(3, lister.getQueryParameters().size()); + } + + @Test + public void assetUpdateReturnsExpectedUri() throws Exception { + EntityUpdateOperation updater = Asset.update(sampleAssetId); + assertEquals(expectedUri, updater.getUri()); + } + + @Test + public void assetUpdateCanSetNameAndAltId() throws Exception { + + String expectedName = "newAssetName"; + String expectedAltId = "newAltId"; + + EntityUpdateOperation updater = Asset.update(sampleAssetId).setName(expectedName).setAlternateId(expectedAltId); + + AssetType payload = (AssetType) updater.getRequestContents(); + + assertEquals(expectedName, payload.getName()); + assertEquals(expectedAltId, payload.getAlternateId()); + } + + @Test + public void assetDeleteReturnsExpectedUri() throws Exception { + EntityDeleteOperation deleter = Asset.delete(sampleAssetId); + + assertEquals(expectedUri, deleter.getUri()); + } + + private static final String expectedOutputAsset = "Job(someJobId)/OutputAssets"; + private static final String expectedInputAsset = "Job(someJobId)/InputAssets"; + + @Test + public void listForLinkReturnsExpectedUri() throws Exception { + JobInfo fakeJob = createJob(); + + EntityListOperation<AssetInfo> lister = Asset.list(fakeJob.getInputAssetsLink()); + + assertEquals(lister.getUri(), expectedInputAsset); + } + + private JobInfo createJob() { + EntryType fakeJobEntry = new EntryType(); + addEntryLink(fakeJobEntry, Constants.ODATA_DATA_NS + "/related/OutputMediaAssets", expectedOutputAsset, + "application/atom+xml;type=feed", "OutputAssets"); + addEntryLink(fakeJobEntry, Constants.ODATA_DATA_NS + "/related/InputMediaAssets", expectedInputAsset, + "application/atom+xml;type=feed", "InputAssets"); + + JobType payload = new JobType().setId("SomeId").setName("FakeJob"); + addEntryContent(fakeJobEntry, payload); + + return new JobInfo(fakeJobEntry, payload); + } + + private void addEntryLink(EntryType entry, String rel, String href, String type, String title) { + LinkType link = new LinkType(); + link.setRel(rel); + link.setHref(href); + link.setType(type); + link.setTitle(title); + + JAXBElement<LinkType> linkElement = new JAXBElement<LinkType>(new QName("link", Constants.ATOM_NS), + LinkType.class, link); + entry.getEntryChildren().add(linkElement); + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + private ContentType addEntryContent(EntryType entry, Object content) { + ContentType contentWrapper = new ContentType(); + contentWrapper.getContent().add( + new JAXBElement(Constants.ODATA_PROPERTIES_ELEMENT_NAME, content.getClass(), content)); + + entry.getEntryChildren().add( + new JAXBElement<ContentType>(Constants.ATOM_CONTENT_ELEMENT_NAME, ContentType.class, contentWrapper)); + return contentWrapper; + } +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/AssetFileEntityTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/AssetFileEntityTest.java new file mode 100644 index 000000000000..5e7607ea309b --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/AssetFileEntityTest.java @@ -0,0 +1,142 @@ +/** + * 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.models; + +import static org.junit.Assert.*; + +import org.junit.Test; + +import com.microsoft.windowsazure.services.media.entityoperations.EntityActionOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityCreateOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityDeleteOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityGetOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityListOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityUpdateOperation; +import com.microsoft.windowsazure.services.media.implementation.content.AssetFileType; + +public class AssetFileEntityTest { + private final String exampleAssetId = "nb:cid:UUID:bfe1c840-36c3-4a78-9b63-38e6eebd94c2"; + private final String exampleFileId = "nb:cid:UUID:49a229ad-8cc5-470f-9e0b-11838283aa58"; + private final String encodedAssetId = "'nb%3Acid%3AUUID%3Abfe1c840-36c3-4a78-9b63-38e6eebd94c2'"; + private final String encodedFileId = "'nb%3Acid%3AUUID%3A49a229ad-8cc5-470f-9e0b-11838283aa58'"; + + public AssetFileEntityTest() throws Exception { + + } + + @Test + public void createFileInfosHasExpectedUri() throws Exception { + EntityActionOperation action = AssetFile.createFileInfos(exampleAssetId); + + assertEquals("CreateFileInfos", action.getUri()); + assertEquals(encodedAssetId, action.getQueryParameters().getFirst("assetid")); + } + + @Test + public void createWithOptionsSetsOptionsAsExpected() throws Exception { + String expectedName = "newFile.mp4"; + Long expectedSize = 65432L; + String expectedChecksum = "check"; + String expectedEncryptionKey = "ooh, secret!"; + String expectedEncryptionScheme = "scheme"; + String expectedEncryptionVersion = "some version"; + String expectedInitializationVector = "cross product"; + Boolean expectedIsEncrypted = true; + Boolean expectedIsPrimary = true; + String expectedMimeType = "application/octet-stream"; + + EntityCreateOperation<AssetFileInfo> creator = AssetFile.create(exampleAssetId, expectedName) + .setContentChecksum(expectedChecksum).setContentFileSize(expectedSize) + .setEncryptionKeyId(expectedEncryptionKey).setEncryptionScheme(expectedEncryptionScheme) + .setEncryptionVersion(expectedEncryptionVersion).setInitializationVector(expectedInitializationVector) + .setIsEncrypted(expectedIsEncrypted).setIsPrimary(expectedIsPrimary).setMimeType(expectedMimeType); + + AssetFileType payload = (AssetFileType) creator.getRequestContents(); + + assertEquals(expectedName, payload.getName()); + assertEquals(exampleAssetId, payload.getParentAssetId()); + assertEquals(expectedSize, payload.getContentFileSize()); + assertEquals(expectedChecksum, payload.getContentChecksum()); + assertEquals(expectedEncryptionKey, payload.getEncryptionKeyId()); + assertEquals(expectedEncryptionScheme, payload.getEncryptionScheme()); + assertEquals(expectedEncryptionVersion, payload.getEncryptionVersion()); + assertEquals(expectedInitializationVector, payload.getInitializationVector()); + assertEquals(expectedIsEncrypted, payload.getIsEncrypted()); + assertEquals(expectedIsPrimary, payload.getIsPrimary()); + assertEquals(expectedMimeType, payload.getMimeType()); + assertNull(payload.getCreated()); + assertNull(payload.getLastModified()); + } + + @Test + public void getByIdHasCorrectUri() throws Exception { + String expectedUri = String.format("Files(%s)", encodedFileId); + EntityGetOperation<AssetFileInfo> getter = AssetFile.get(exampleFileId); + + assertEquals(expectedUri, getter.getUri()); + } + + @Test + public void listAllFileInfosHasCorrectUri() throws Exception { + String expectedUri = "Files"; + EntityListOperation<AssetFileInfo> lister = AssetFile.list(); + assertEquals(expectedUri, lister.getUri()); + } + + @Test + public void updateWithAllOptionsHasCorrectPayload() throws Exception { + Long expectedSize = 65432L; + String expectedChecksum = "check"; + String expectedEncryptionKey = "ooh, secret!"; + String expectedEncryptionScheme = "scheme"; + String expectedEncryptionVersion = "some version"; + String expectedInitializationVector = "cross product"; + Boolean expectedIsEncrypted = true; + Boolean expectedIsPrimary = true; + String expectedMimeType = "application/octet-stream"; + + EntityUpdateOperation updater = AssetFile.update(exampleFileId).setContentChecksum(expectedChecksum) + .setContentFileSize(expectedSize).setEncryptionKeyId(expectedEncryptionKey) + .setEncryptionScheme(expectedEncryptionScheme).setEncryptionVersion(expectedEncryptionVersion) + .setInitializationVector(expectedInitializationVector).setIsEncrypted(expectedIsEncrypted) + .setIsPrimary(expectedIsPrimary).setMimeType(expectedMimeType); + + AssetFileType payload = (AssetFileType) updater.getRequestContents(); + + assertNull(payload.getName()); + assertNull(payload.getId()); + assertNull(payload.getParentAssetId()); + assertEquals(expectedSize, payload.getContentFileSize()); + assertEquals(expectedChecksum, payload.getContentChecksum()); + assertEquals(expectedEncryptionKey, payload.getEncryptionKeyId()); + assertEquals(expectedEncryptionScheme, payload.getEncryptionScheme()); + assertEquals(expectedEncryptionVersion, payload.getEncryptionVersion()); + assertEquals(expectedInitializationVector, payload.getInitializationVector()); + assertEquals(expectedIsEncrypted, payload.getIsEncrypted()); + assertEquals(expectedIsPrimary, payload.getIsPrimary()); + assertEquals(expectedMimeType, payload.getMimeType()); + assertNull(payload.getCreated()); + assertNull(payload.getLastModified()); + } + + @Test + public void deleteHasCorrectUri() throws Exception { + String expectedUri = String.format("Files(%s)", encodedFileId); + EntityDeleteOperation deleter = AssetFile.delete(exampleFileId); + + assertEquals(expectedUri, deleter.getUri()); + } +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/AssetFileInfoTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/AssetFileInfoTest.java new file mode 100644 index 000000000000..a3e577fa847c --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/AssetFileInfoTest.java @@ -0,0 +1,188 @@ +/** + * 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.models; + +import static org.junit.Assert.*; + +import java.util.Date; + +import org.junit.Test; + +import com.microsoft.windowsazure.services.media.implementation.content.AssetFileType; + +public class AssetFileInfoTest { + + @Test + public void testGetSetId() { + String expectedId = "testId"; + AssetFileInfo file = new AssetFileInfo(null, new AssetFileType().setId(expectedId)); + + String actualId = file.getId(); + + // Assert + assertEquals(expectedId, actualId); + } + + @Test + public void testGetSetName() { + String expectedName = "testName"; + AssetFileInfo fileInfo = new AssetFileInfo(null, new AssetFileType().setName(expectedName)); + + String actualName = fileInfo.getName(); + + // Assert + assertEquals(expectedName, actualName); + } + + @Test + public void testGetSetContentFileSize() { + // Arrange + Long expectedContentFileSize = 1234l; + AssetFileInfo fileInfo = new AssetFileInfo(null, + new AssetFileType().setContentFileSize(expectedContentFileSize)); + + // Act + long actualContentFileSize = fileInfo.getContentFileSize(); + + // Assert + assertEquals(expectedContentFileSize.longValue(), actualContentFileSize); + + } + + @Test + public void testGetSetParentAssetId() { + String expectedParentAssetId = "testParentAssetId"; + AssetFileInfo fileInfo = new AssetFileInfo(null, new AssetFileType().setParentAssetId(expectedParentAssetId)); + + String actualParentAssetId = fileInfo.getParentAssetId(); + + assertEquals(expectedParentAssetId, actualParentAssetId); + } + + @Test + public void testGetSetEncryptionVersion() { + String expectedEncryptionVersion = "testEncryptionVersion"; + AssetFileInfo fileInfo = new AssetFileInfo(null, + new AssetFileType().setEncryptionVersion(expectedEncryptionVersion)); + + String actualEncryptionVersion = fileInfo.getEncryptionVersion(); + + assertEquals(expectedEncryptionVersion, actualEncryptionVersion); + } + + @Test + public void testGetSetEncryptionScheme() { + // Arrange + String expectedEncryptionScheme = "testEncryptionScheme"; + AssetFileInfo fileInfo = new AssetFileInfo(null, + new AssetFileType().setEncryptionScheme(expectedEncryptionScheme)); + + // Act + String actualEncryptionScheme = fileInfo.getEncryptionScheme(); + + // Assert + assertEquals(expectedEncryptionScheme, actualEncryptionScheme); + } + + @Test + public void testGetSetIsEncrypted() { + // Arrange + Boolean expectedIsEncrypted = true; + AssetFileInfo fileInfo = new AssetFileInfo(null, new AssetFileType().setIsEncrypted(expectedIsEncrypted)); + + // Act + Boolean actualIsEncrypted = fileInfo.getIsEncrypted(); + + // Assert + assertEquals(expectedIsEncrypted, actualIsEncrypted); + } + + @Test + public void testGetSetEncryptionKeyId() { + String expectedEncryptionKeyId = "testEncryptionKeyId"; + AssetFileInfo fileInfo = new AssetFileInfo(null, + new AssetFileType().setEncryptionKeyId(expectedEncryptionKeyId)); + + String actualEncryptionKeyId = fileInfo.getEncryptionKeyId(); + + assertEquals(expectedEncryptionKeyId, actualEncryptionKeyId); + } + + @Test + public void testGetSetInitializationVector() { + String expectedInitializationVector = "testInitializationVector"; + AssetFileInfo fileInfo = new AssetFileInfo(null, + new AssetFileType().setInitializationVector(expectedInitializationVector)); + + String actualInitializationVector = fileInfo.getInitializationVector(); + + assertEquals(expectedInitializationVector, actualInitializationVector); + + } + + @Test + public void testGetSetIsPrimary() { + // Arrange + Boolean expectedIsPrimary = true; + AssetFileInfo fileInfo = new AssetFileInfo(null, new AssetFileType().setIsPrimary(expectedIsPrimary)); + + // Act + Boolean actualIsPrimary = fileInfo.getIsPrimary(); + + // Assert + assertEquals(expectedIsPrimary, actualIsPrimary); + } + + @Test + public void testGetSetLastModified() { + Date expectedLastModified = new Date(); + AssetFileInfo fileInfo = new AssetFileInfo(null, new AssetFileType().setLastModified(expectedLastModified)); + + Date actualLastModified = fileInfo.getLastModified(); + + assertEquals(expectedLastModified, actualLastModified); + } + + @Test + public void testGetSetCreated() { + Date expectedCreated = new Date(); + AssetFileInfo fileInfo = new AssetFileInfo(null, new AssetFileType().setCreated(expectedCreated)); + + Date actualCreated = fileInfo.getCreated(); + + assertEquals(expectedCreated, actualCreated); + } + + @Test + public void testGetSetMimeType() { + String expectedMimeType = "testMimeType"; + AssetFileInfo fileInfo = new AssetFileInfo(null, new AssetFileType().setMimeType(expectedMimeType)); + + String actualMimeType = fileInfo.getMimeType(); + + assertEquals(expectedMimeType, actualMimeType); + } + + @Test + public void testGetSetContentChecksum() { + String expectedContentChecksum = "testContentChecksum"; + AssetFileInfo fileInfo = new AssetFileInfo(null, + new AssetFileType().setContentChecksum(expectedContentChecksum)); + + String actualContentChecksum = fileInfo.getContentChecksum(); + + assertEquals(expectedContentChecksum, actualContentChecksum); + } +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/AssetInfoTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/AssetInfoTest.java new file mode 100644 index 000000000000..66d3b0f7e4ce --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/AssetInfoTest.java @@ -0,0 +1,122 @@ +/** + * 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.models; + +import static org.junit.Assert.*; + +import java.util.Date; + +import org.junit.Test; + +import com.microsoft.windowsazure.services.media.implementation.content.AssetType; + +public class AssetInfoTest { + + @Test + public void testGetSetId() { + // Arrange + String expectedId = "expectedId"; + AssetInfo assetInfo = new AssetInfo(null, new AssetType().setId(expectedId)); + + // Act + String actualId = assetInfo.getId(); + + // Assert + assertEquals(expectedId, actualId); + + } + + @Test + public void testGetSetState() { + // Arrange + AssetState expectedState = AssetState.Published; + AssetInfo assetInfo = new AssetInfo(null, new AssetType().setState(expectedState.getCode())); + + // Act + AssetState actualState = assetInfo.getState(); + + // Assert + assertEquals(expectedState, actualState); + } + + @Test + public void testGetSetCreated() throws Exception { + // Arrange + Date expectedCreated = new Date(); + + AssetInfo assetInfo = new AssetInfo(null, new AssetType().setCreated(expectedCreated)); + + // Act + Date actualCreated = assetInfo.getCreated(); + + // Assert + assertEquals(expectedCreated, actualCreated); + + } + + @Test + public void testGetSetLastModified() throws Exception { + // Arrange + Date expectedLastModified = new Date(); + AssetInfo assetInfo = new AssetInfo(null, new AssetType().setLastModified(expectedLastModified)); + + // Act + Date actualLastModified = assetInfo.getLastModified(); + + // Assert + assertEquals(expectedLastModified, actualLastModified); + } + + @Test + public void testGetSetAlternateId() { + // Arrange + String expectedAlternateId = "testAlternateId"; + AssetInfo assetInfo = new AssetInfo(null, new AssetType().setAlternateId(expectedAlternateId)); + + // Act + String actualAlternateId = assetInfo.getAlternateId(); + + // Assert + assertEquals(expectedAlternateId, actualAlternateId); + } + + @Test + public void testGetSetName() { + // Arrange + String expectedName = "testName"; + AssetInfo assetInfo = new AssetInfo(null, new AssetType().setName(expectedName)); + + // Act + String actualName = assetInfo.getName(); + + // Assert + assertEquals(expectedName, actualName); + } + + @Test + public void testGetSetOptions() { + // Arrange + + AssetOption expectedOptions = AssetOption.None; + AssetInfo assetInfo = new AssetInfo(null, new AssetType().setOptions(expectedOptions.getCode())); + + // Act + AssetOption actualOptions = assetInfo.getOptions(); + + // Assert + assertEquals(expectedOptions, actualOptions); + } + +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/ContentKeyEntityTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/ContentKeyEntityTest.java new file mode 100644 index 000000000000..bd7f4362246a --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/ContentKeyEntityTest.java @@ -0,0 +1,97 @@ +/** + * 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.models; + +import static org.junit.Assert.*; + +import java.net.URLEncoder; + +import org.junit.Test; + +import com.microsoft.windowsazure.services.media.entityoperations.EntityCreateOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityDeleteOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityListOperation; +import com.microsoft.windowsazure.services.media.implementation.content.ContentKeyRestType; + +/** + * Tests for the ContentKey entity + * + */ +public class ContentKeyEntityTest { + private final String testContentKeyId = "nb:kid:UUID:c82307be-1a81-4554-ba7d-cf6dfa735a5a"; + private final ContentKeyType testContentKeyType = ContentKeyType.StorageEncryption; + private final String testEncryptedContentKey = "testEncryptedContentKey"; + private final String testExpectedContentKeyUri = String.format("ContentKeys('%s')", + URLEncoder.encode(testContentKeyId, "UTF-8")); + + public ContentKeyEntityTest() throws Exception { + + } + + @Test + public void createContentKeyHasCorrectUrl() throws Exception { + EntityCreateOperation<ContentKeyInfo> creator = ContentKey.create(testContentKeyId, testContentKeyType, + testEncryptedContentKey); + + assertEquals("ContentKeys", creator.getUri()); + } + + @Test + public void createContentKeyHasCorrectPayload() throws Exception { + ContentKeyRestType contentKeyRestType = (ContentKeyRestType) ContentKey.create(testContentKeyId, + testContentKeyType, testEncryptedContentKey).getRequestContents(); + + assertEquals(testContentKeyId, contentKeyRestType.getId()); + assertEquals(testContentKeyType.getCode(), contentKeyRestType.getContentKeyType().intValue()); + assertEquals(testEncryptedContentKey, contentKeyRestType.getEncryptedContentKey()); + assertNull(contentKeyRestType.getChecksum()); + assertNull(contentKeyRestType.getCreated()); + assertNull(contentKeyRestType.getLastModified()); + assertNull(contentKeyRestType.getName()); + assertNull(contentKeyRestType.getProtectionKeyId()); + assertNull(contentKeyRestType.getProtectionKeyType()); + } + + @Test + public void getContentKeyGivesExpectedUri() throws Exception { + assertEquals(testExpectedContentKeyUri, ContentKey.get(testContentKeyId).getUri()); + } + + @Test + public void listContentKeyReturnsExpectedUri() { + EntityListOperation<ContentKeyInfo> lister = ContentKey.list(); + + assertEquals("ContentKeys", lister.getUri()); + assertNotNull(lister.getQueryParameters()); + assertEquals(0, lister.getQueryParameters().size()); + } + + @Test + public void listContentKeyCanTakeQueryParameters() { + + EntityListOperation<ContentKeyInfo> lister = ContentKey.list().setTop(10).setSkip(2); + + assertEquals("10", lister.getQueryParameters().getFirst("$top")); + assertEquals("2", lister.getQueryParameters().getFirst("$skip")); + assertEquals(2, lister.getQueryParameters().size()); + } + + @Test + public void ContentKeyDeleteReturnsExpectedUri() throws Exception { + EntityDeleteOperation deleter = ContentKey.delete(testContentKeyId); + assertEquals(testExpectedContentKeyUri, deleter.getUri()); + } +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/ContentKeyInfoTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/ContentKeyInfoTest.java new file mode 100644 index 000000000000..1fd2c0cb267d --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/ContentKeyInfoTest.java @@ -0,0 +1,152 @@ +/** + * 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.models; + +import static org.junit.Assert.*; + +import java.util.Date; + +import org.junit.Test; + +import com.microsoft.windowsazure.services.media.implementation.content.ContentKeyRestType; + +public class ContentKeyInfoTest { + + @Test + public void testGetSetId() { + // Arrange + String expectedId = "expectedId"; + ContentKeyInfo contentKeyInfo = new ContentKeyInfo(null, new ContentKeyRestType().setId(expectedId)); + + // Act + String actualId = contentKeyInfo.getId(); + + // Assert + assertEquals(expectedId, actualId); + } + + @Test + public void testGetSetCreated() { + // Arrange + Date expectedCreated = new Date(); + ContentKeyInfo contentKeyInfo = new ContentKeyInfo(null, new ContentKeyRestType().setCreated(expectedCreated)); + + // Act + Date actualCreated = contentKeyInfo.getCreated(); + + // Assert + assertEquals(expectedCreated, actualCreated); + } + + @Test + public void testGetSetLastModified() { + // Arrange + Date expectedLastModified = new Date(); + ContentKeyInfo contentKeyInfo = new ContentKeyInfo(null, + new ContentKeyRestType().setLastModified(expectedLastModified)); + + // Act + Date actualLastModified = contentKeyInfo.getLastModified(); + + // Assert + assertEquals(expectedLastModified, actualLastModified); + } + + @Test + public void testGetSetContentKeyType() { + // Arrange + ContentKeyType expectedContentKeyType = ContentKeyType.ConfigurationEncryption; + ContentKeyInfo contentKeyInfo = new ContentKeyInfo(null, + new ContentKeyRestType().setContentKeyType(expectedContentKeyType.getCode())); + + // Act + ContentKeyType actualContentKeyType = contentKeyInfo.getContentKeyType(); + + // Assert + assertEquals(expectedContentKeyType, actualContentKeyType); + + } + + @Test + public void testGetSetEncryptedContentKey() { + // Arrange + String expectedEncryptedContentKey = "testX509Certificate"; + ContentKeyInfo contentKeyInfo = new ContentKeyInfo(null, + new ContentKeyRestType().setEncryptedContentKey(expectedEncryptedContentKey)); + + // Act + String actualEncryptedContentKey = contentKeyInfo.getEncryptedContentKey(); + + // Assert + assertEquals(expectedEncryptedContentKey, actualEncryptedContentKey); + } + + @Test + public void testGetSetName() { + // Arrange + String expectedName = "expectedName"; + ContentKeyInfo contentKeyInfo = new ContentKeyInfo(null, new ContentKeyRestType().setName(expectedName)); + + // Act + String actualName = contentKeyInfo.getName(); + + // Assert + assertEquals(expectedName, actualName); + } + + @Test + public void testGetSetProtectionKeyId() { + // Arrange + String expectedProtectionKeyId = "expectedProtectionKeyId"; + ContentKeyInfo contentKeyInfo = new ContentKeyInfo(null, + new ContentKeyRestType().setProtectionKeyId(expectedProtectionKeyId)); + + // Act + String actualProtectionKeyId = contentKeyInfo.getProtectionKeyId(); + + // Assert + assertEquals(expectedProtectionKeyId, actualProtectionKeyId); + + } + + @Test + public void testGetSetProtectionKeyType() { + // Arrange + ProtectionKeyType expectedProtectionKeyType = ProtectionKeyType.X509CertificateThumbprint; + ContentKeyInfo contentKeyInfo = new ContentKeyInfo(null, + new ContentKeyRestType().setProtectionKeyType(expectedProtectionKeyType.getCode())); + + // Act + ProtectionKeyType actualProtectionKeyType = contentKeyInfo.getProtectionKeyType(); + + // Assert + assertEquals(expectedProtectionKeyType, actualProtectionKeyType); + } + + @Test + public void testGetSetCheckSum() { + // Arrange + String expectedCheckSum = "testCheckSum"; + ContentKeyInfo contentKeyInfo = new ContentKeyInfo(null, new ContentKeyRestType().setChecksum(expectedCheckSum)); + + // Act + String actualCheckSum = contentKeyInfo.getChecksum(); + + // Assert + assertEquals(expectedCheckSum, actualCheckSum); + + } + +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/GenericListResultTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/GenericListResultTest.java new file mode 100644 index 000000000000..7409542605c1 --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/GenericListResultTest.java @@ -0,0 +1,422 @@ +/** + * 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.models; + +import static org.junit.Assert.*; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.ListIterator; +import java.util.NoSuchElementException; + +import org.junit.Test; + +/** + * Test for the {link ListResult<T>} type. + * + */ +public class GenericListResultTest { + private final String[] expectedStrings = { "One", "Two", "Three" }; + + @Test + public void emptyListResultIsEmpty() throws Exception { + assertTrue(new ListResult<String>(new ArrayList<String>()).isEmpty()); + } + + @Test + public void listWithContentsIsNotEmpty() throws Exception { + ListResult<String> result = createStringListResult(); + + assertFalse(result.isEmpty()); + } + + @Test + public void createWithEmptyCollectionGivesNoResults() throws Exception { + List<AssetInfo> result = new ListResult<AssetInfo>(new ArrayList<AssetInfo>()); + + assertEquals(0, result.size()); + } + + @Test + public void createWithCollectionContentsContainsContents() throws Exception { + List<String> result = createStringListResult(); + + assertEquals(expectedStrings.length, result.size()); + } + + @Test + public void createWithCollectionContentsCanRetrieveContents() throws Exception { + List<String> result = createStringListResult(); + + for (int i = 0; i < expectedStrings.length; ++i) { + assertEquals(expectedStrings[i], result.get(i)); + } + } + + @Test + public void canIterateThroughResults() throws Exception { + List<String> result = createStringListResult(); + + int i = 0; + for (String s : result) { + assertEquals(expectedStrings[i], s); + ++i; + } + } + + @Test + public void canCheckContainsForObjectInList() throws Exception { + ListResult<String> result = createStringListResult(); + + assertTrue(result.contains(expectedStrings[1])); + } + + @Test + public void canCheckContainsForObjectNotInList() throws Exception { + ListResult<String> result = createStringListResult(); + + assertFalse(result.contains("This is not a string in the list")); + } + + @Test + public void canCheckContainsAllForObjectsInList() throws Exception { + ListResult<String> result = createStringListResult(); + List<String> contains = new ArrayList<String>(); + contains.add(expectedStrings[2]); + contains.add(expectedStrings[1]); + + assertTrue(result.containsAll(contains)); + } + + @Test + public void canCheckContainsAllForObjectsNotInList() throws Exception { + ListResult<String> result = createStringListResult(); + List<String> contains = new ArrayList<String>(); + contains.add(expectedStrings[2]); + contains.add("This is not in the list"); + + assertFalse(result.containsAll(contains)); + } + + @Test + public void canGetIndexOfItemInList() throws Exception { + ListResult<String> result = createStringListResult(); + + assertEquals(1, result.indexOf(expectedStrings[1])); + } + + @Test + public void indexOfItemNotInListIsMinusOne() throws Exception { + ListResult<String> result = createStringListResult(); + + assertEquals(-1, result.indexOf("Not in collection")); + } + + @Test + public void lastIndexOfItemInCollectionIsCorrect() throws Exception { + ListResult<String> result = new ListResult<String>(Arrays.asList("c", "b", "c", "a")); + + assertEquals(2, result.lastIndexOf("c")); + } + + @Test + public void lastIndexOfItemNotInCollectionIsMinusOne() throws Exception { + ListResult<String> result = createStringListResult(); + + assertEquals(-1, result.lastIndexOf("Not in collection")); + } + + @Test + public void optionalListMethodsAreUnsupported() throws Exception { + final ListResult<String> result = createStringListResult(); + + assertListIsImmutable(result); + } + + @Test + public void canGetWorkingListIteratorFromResult() throws Exception { + ListResult<String> result = createStringListResult(); + + ListIterator<String> iterator = result.listIterator(); + int i = 0; + for (i = 0; i < expectedStrings.length; ++i) { + assertIteratorAtPositionMovingForward(i, iterator); + } + + for (; i >= 0; --i) { + assertIteratorAtPositionMovingBackward(i, iterator); + } + } + + @Test + public void canGetWorkingListIteratorAtIndexFromResult() throws Exception { + ListResult<String> result = createStringListResult(); + + ListIterator<String> iterator = result.listIterator(1); + int i = 1; + for (; i < expectedStrings.length; ++i) { + assertIteratorAtPositionMovingForward(i, iterator); + } + + for (; i >= 0; --i) { + assertIteratorAtPositionMovingBackward(i, iterator); + } + } + + @Test + public void listIteratorIsImmutable() throws Exception { + ListResult<String> result = createStringListResult(); + final ListIterator<String> iterator = result.listIterator(); + + assertUnsupported(new Action() { + @Override + public void Do() { + iterator.add("new string"); + } + }); + + assertUnsupported(new Action() { + @Override + public void Do() { + iterator.remove(); + } + }); + + assertUnsupported(new Action() { + @Override + public void Do() { + iterator.set("replace string"); + } + }); + } + + @Test + public void listIteratorIsImmutableWhenCreatedWithIndex() throws Exception { + ListResult<String> result = createStringListResult(); + final ListIterator<String> iterator = result.listIterator(1); + + assertUnsupported(new Action() { + @Override + public void Do() { + iterator.add("new string"); + } + }); + + assertUnsupported(new Action() { + @Override + public void Do() { + iterator.remove(); + } + }); + + assertUnsupported(new Action() { + @Override + public void Do() { + iterator.set("replace string"); + } + }); + } + + @Test + public void canGetObjectArrayFromResult() throws Exception { + ListResult<String> result = createStringListResult(); + Object[] array = result.toArray(); + + assertNotNull(array); + assertEquals(result.size(), array.length); + for (int i = 0; i < result.size(); ++i) { + assertEquals(result.get(i), array[i]); + } + } + + @Test + public void canGetTypedArrayFromResult() throws Exception { + ListResult<String> result = createStringListResult(); + String[] array = result.toArray(new String[0]); + + assertNotNull(array); + assertEquals(result.size(), array.length); + for (int i = 0; i < result.size(); ++i) { + assertEquals(result.get(i), array[i]); + } + } + + @Test + public void canGetExpectedSublistFromResult() throws Exception { + ListResult<String> result = createStringListResult(); + List<String> sublist = result.subList(1, 3); + + assertEquals(2, sublist.size()); + assertEquals(result.get(1), sublist.get(0)); + assertEquals(result.get(2), sublist.get(1)); + } + + @Test + public void sublistIsImmutable() throws Exception { + ListResult<String> result = createStringListResult(); + final List<String> sublist = result.subList(1, 3); + + assertListIsImmutable(sublist); + } + + private ListResult<String> createStringListResult() { + ListResult<String> result = new ListResult<String>(Arrays.asList(expectedStrings)); + + return result; + } + + /// Assertion helpers /// + + private void assertIteratorState(int position, ListIterator<String> iterator) { + boolean expectHasNext = position < expectedStrings.length; + boolean expectHasPrevious = position != 0; + + assertNotNull("Iterator is null", iterator); + assertEquals(String.format("HasNext at position %d", position), expectHasNext, iterator.hasNext()); + assertEquals(String.format("HasPrevious at position %d", position), expectHasPrevious, iterator.hasPrevious()); + + if (expectHasNext) { + assertEquals(String.format("NextIndex at position %d", position), position, iterator.nextIndex()); + } + + if (expectHasPrevious) { + assertEquals(String.format("PreviousIndex at position %d", position), position - 1, + iterator.previousIndex()); + } + + } + + private void assertIteratorAtPositionMovingForward(int position, ListIterator<String> iterator) { + assertIteratorState(position, iterator); + + if (iterator.hasNext()) { + assertEquals(expectedStrings[position], iterator.next()); + } + else { + try { + iterator.next(); + fail("Exception should have been thrown"); + } + catch (NoSuchElementException ex) { + // Ok, we expected this + } + } + } + + private void assertIteratorAtPositionMovingBackward(int position, ListIterator<String> iterator) { + assertIteratorState(position, iterator); + + if (iterator.hasPrevious()) { + assertEquals(expectedStrings[position - 1], iterator.previous()); + } + else { + try { + iterator.previous(); + fail("Exception should have been thrown"); + } + catch (NoSuchElementException ex) { + // Ok, we expected this + } + } + } + + private interface Action { + void Do(); + } + + private void assertUnsupported(Action action) { + try { + action.Do(); + fail("Expected UnsupportedOperationException"); + } + catch (UnsupportedOperationException ex) { + // This is ok + } + } + + private void assertListIsImmutable(final List<String> list) { + assertUnsupported(new Action() { + @Override + public void Do() { + list.add("new string"); + } + }); + + assertUnsupported(new Action() { + @Override + public void Do() { + list.add(2, "new string"); + } + }); + + assertUnsupported(new Action() { + @Override + public void Do() { + list.addAll(Arrays.asList("a", "b")); + } + }); + + assertUnsupported(new Action() { + @Override + public void Do() { + list.addAll(2, Arrays.asList("a", "b")); + } + }); + + assertUnsupported(new Action() { + @Override + public void Do() { + list.clear(); + } + }); + + assertUnsupported(new Action() { + @Override + public void Do() { + list.remove(1); + } + }); + + assertUnsupported(new Action() { + @Override + public void Do() { + list.remove(list.get(1)); + } + }); + + assertUnsupported(new Action() { + @Override + public void Do() { + list.removeAll(Arrays.asList(list.get(0), list.get(1))); + } + }); + + assertUnsupported(new Action() { + @Override + public void Do() { + list.retainAll(Arrays.asList(list.get(1))); + } + }); + + assertUnsupported(new Action() { + @Override + public void Do() { + list.set(1, "new string"); + } + }); + } +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/JobEntityTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/JobEntityTest.java new file mode 100644 index 000000000000..361aec9ffa65 --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/JobEntityTest.java @@ -0,0 +1,83 @@ +/** + * 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.models; + +import static org.junit.Assert.*; + +import java.net.URI; + +import javax.mail.internet.MimeMultipart; + +import org.junit.Test; + +import com.microsoft.windowsazure.services.core.ServiceException; +import com.microsoft.windowsazure.services.media.entityoperations.EntityListOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityProxyData; + +/** + * Tests for the methods and factories of the Job entity. + */ +public class JobEntityTest { + + private EntityProxyData createProxyData() { + return new EntityProxyData() { + @Override + public URI getServiceUri() { + return URI.create("http://contoso.com"); + } + }; + } + + public JobEntityTest() throws Exception { + } + + @Test + public void JobCreateReturnsDefaultCreatePayload() throws ServiceException { + Job.Creator jobCreator = Job.create(); + jobCreator.setProxyData(createProxyData()); + MimeMultipart payload = (MimeMultipart) jobCreator.getRequestContents(); + assertNotNull(payload); + } + + @Test + public void JobListReturnsExpectedUri() { + EntityListOperation<JobInfo> lister = Job.list(); + + assertEquals("Jobs", lister.getUri()); + assertNotNull(lister.getQueryParameters()); + assertEquals(0, lister.getQueryParameters().size()); + } + + @Test + public void JobListCanTakeQueryParameters() { + EntityListOperation<JobInfo> lister = Job.list().setTop(10).setSkip(2); + + assertEquals("10", lister.getQueryParameters().getFirst("$top")); + assertEquals("2", lister.getQueryParameters().getFirst("$skip")); + assertEquals(2, lister.getQueryParameters().size()); + } + + @Test + public void JobListCanTakeQueryParametersChained() { + EntityListOperation<JobInfo> lister = Job.list().setTop(10).setSkip(2).set("filter", "something"); + + assertEquals("10", lister.getQueryParameters().getFirst("$top")); + assertEquals("2", lister.getQueryParameters().getFirst("$skip")); + assertEquals("something", lister.getQueryParameters().getFirst("filter")); + assertEquals(3, lister.getQueryParameters().size()); + } + +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/JobInfoTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/JobInfoTest.java new file mode 100644 index 000000000000..6ed12b3649d5 --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/JobInfoTest.java @@ -0,0 +1,134 @@ +/** + * 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.models; + +import static org.junit.Assert.*; + +import java.util.Date; + +import org.junit.Test; + +import com.microsoft.windowsazure.services.media.implementation.content.JobType; + +public class JobInfoTest { + + @Test + public void testGetSetId() { + // Arrange + String expectedId = "expectedId"; + JobInfo JobInfo = new JobInfo(null, new JobType().setId(expectedId)); + + // Act + String actualId = JobInfo.getId(); + + // Assert + assertEquals(expectedId, actualId); + + } + + @Test + public void testGetSetName() { + // Arrange + String expectedName = "testGetSetName"; + JobInfo JobInfo = new JobInfo(null, new JobType().setName(expectedName)); + + // Act + String actualName = JobInfo.getName(); + + // Assert + assertEquals(expectedName, actualName); + } + + @Test + public void testGetSetCreated() throws Exception { + // Arrange + Date expectedCreated = new Date(); + + JobInfo JobInfo = new JobInfo(null, new JobType().setCreated(expectedCreated)); + + // Act + Date actualCreated = JobInfo.getCreated(); + + // Assert + assertEquals(expectedCreated, actualCreated); + + } + + @Test + public void testGetSetLastModified() throws Exception { + // Arrange + Date expectedLastModified = new Date(); + JobInfo JobInfo = new JobInfo(null, new JobType().setLastModified(expectedLastModified)); + + // Act + Date actualLastModified = JobInfo.getLastModified(); + + // Assert + assertEquals(expectedLastModified, actualLastModified); + } + + @Test + public void testGetSetPriority() { + // Arrange + int expectedPriority = 3; + JobInfo JobInfo = new JobInfo(null, new JobType().setPriority(expectedPriority)); + + // Act + int actualPriority = JobInfo.getPriority(); + + // Assert + assertEquals(expectedPriority, actualPriority); + } + + @Test + public void testGetSetRunningDuration() { + // Arrange + Double expectedRunningDuration = 1234.5; + JobInfo JobInfo = new JobInfo(null, new JobType().setRunningDuration(expectedRunningDuration)); + + // Act + Double actualRunningDuration = JobInfo.getRunningDuration(); + + // Assert + assertEquals(expectedRunningDuration, actualRunningDuration); + } + + @Test + public void testGetSetStartTime() { + // Arrange + Date expectedStartTime = new Date(); + JobInfo JobInfo = new JobInfo(null, new JobType().setLastModified(expectedStartTime)); + + // Act + Date actualStartTime = JobInfo.getLastModified(); + + // Assert + assertEquals(expectedStartTime, actualStartTime); + } + + @Test + public void testGetSetState() { + // Arrange + JobState expectedJobState = JobState.Finished; + JobInfo JobInfo = new JobInfo(null, new JobType().setState(expectedJobState.getCode())); + + // Act + JobState actualJobState = JobInfo.getState(); + + // Assert + assertEquals(expectedJobState, actualJobState); + } + +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/LocatorEntityTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/LocatorEntityTest.java new file mode 100644 index 000000000000..80881ea3c784 --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/LocatorEntityTest.java @@ -0,0 +1,172 @@ +/** + * 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.models; + +import static org.junit.Assert.*; + +import java.net.URLEncoder; +import java.util.Date; + +import org.junit.Test; + +import com.microsoft.windowsazure.services.media.entityoperations.EntityCreateOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityDeleteOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityListOperation; +import com.microsoft.windowsazure.services.media.entityoperations.EntityUpdateOperation; +import com.microsoft.windowsazure.services.media.implementation.content.LocatorRestType; + +/** + * Tests for the Locator entity + * + */ +public class LocatorEntityTest { + private final String exampleAssetId = "nb:cid:UUID:61a5ebbe-d5e0-49a5-b28c-e9535321b6cd"; + private final String exampleAccessPolicyId = "nb:pid:UUID:c82307be-1a81-4554-ba7d-cf6dfa735a5a"; + private final String exampleLocatorId = "nb:lid:UUID:f282b0a1-fb21-4b83-87d6-d4c96d77aef9"; + private final String expectedLocatorUri = String.format("Locators('%s')", + URLEncoder.encode(exampleLocatorId, "UTF-8")); + + public LocatorEntityTest() throws Exception { + + } + + @Test + public void createLocatorHasCorrectUrl() throws Exception { + EntityCreateOperation<LocatorInfo> creator = Locator.create(exampleAccessPolicyId, exampleAssetId, + LocatorType.SAS); + + assertEquals("Locators", creator.getUri()); + } + + @Test + public void createLocatorHasCorrectPayload() throws Exception { + LocatorRestType locatorType = (LocatorRestType) Locator.create(exampleAccessPolicyId, exampleAssetId, + LocatorType.SAS).getRequestContents(); + + assertEquals(exampleAssetId, locatorType.getAssetId()); + assertEquals(exampleAccessPolicyId, locatorType.getAccessPolicyId()); + assertEquals(LocatorType.SAS.getCode(), locatorType.getType().intValue()); + assertNull(locatorType.getStartTime()); + assertNull(locatorType.getExpirationDateTime()); + } + + @Test + public void createLocatorCanSetStartTime() throws Exception { + Date now = new Date(); + + EntityCreateOperation<LocatorInfo> creator = Locator.create(exampleAccessPolicyId, exampleAssetId, + LocatorType.SAS).setStartDateTime(now); + + LocatorRestType locatorType = (LocatorRestType) creator.getRequestContents(); + + assertEquals(exampleAssetId, locatorType.getAssetId()); + assertEquals(exampleAccessPolicyId, locatorType.getAccessPolicyId()); + assertEquals(LocatorType.SAS.getCode(), locatorType.getType().intValue()); + assertEquals(now, locatorType.getStartTime()); + } + + @Test + public void createLocatorCanSetPath() throws Exception { + + String expectedPath = "testExpectedPath"; + + EntityCreateOperation<LocatorInfo> creator = Locator.create(exampleAccessPolicyId, exampleAssetId, + LocatorType.SAS).setPath(expectedPath); + + LocatorRestType locatorType = (LocatorRestType) creator.getRequestContents(); + + assertEquals(expectedPath, locatorType.getPath()); + + } + + @Test + public void createLocatorCanSetBaseUri() throws Exception { + + String expectedBaseUri = "testExpectedBaseUri"; + + EntityCreateOperation<LocatorInfo> creator = Locator.create(exampleAccessPolicyId, exampleAssetId, + LocatorType.SAS).setBaseUri(expectedBaseUri); + + LocatorRestType locatorType = (LocatorRestType) creator.getRequestContents(); + + assertEquals(expectedBaseUri, locatorType.getBaseUri()); + + } + + @Test + public void createLocatorCanSetContentAccessComponent() throws Exception { + + String expectedContentAccessComponent = "testExpectedContentAccessComponent"; + + EntityCreateOperation<LocatorInfo> creator = Locator.create(exampleAccessPolicyId, exampleAssetId, + LocatorType.SAS).setContentAccessComponent(expectedContentAccessComponent); + + LocatorRestType locatorType = (LocatorRestType) creator.getRequestContents(); + + assertEquals(expectedContentAccessComponent, locatorType.getContentAccessComponent()); + + } + + @Test + public void getLocatorGivesExpectedUri() throws Exception { + assertEquals(expectedLocatorUri, Locator.get(exampleLocatorId).getUri()); + } + + @Test + public void listLocatorReturnsExpectedUri() { + EntityListOperation<LocatorInfo> lister = Locator.list(); + + assertEquals("Locators", lister.getUri()); + assertNotNull(lister.getQueryParameters()); + assertEquals(0, lister.getQueryParameters().size()); + } + + @Test + public void listLocatorCanTakeQueryParameters() { + + EntityListOperation<LocatorInfo> lister = Locator.list().setTop(10).setSkip(2); + + assertEquals("10", lister.getQueryParameters().getFirst("$top")); + assertEquals("2", lister.getQueryParameters().getFirst("$skip")); + assertEquals(2, lister.getQueryParameters().size()); + } + + @Test + public void locatorUpdateReturnsExpectedUri() throws Exception { + EntityUpdateOperation updater = Locator.update(exampleLocatorId); + assertEquals(expectedLocatorUri, updater.getUri()); + } + + @Test + public void locatorUpdateCanSetStarTime() throws Exception { + Date now = new Date(); + + Date tenMinutesAgo = new Date(now.getTime() - 10 * 60 * 1000); + + EntityUpdateOperation updater = Locator.update(exampleLocatorId).setStartDateTime(tenMinutesAgo); + + LocatorRestType payload = (LocatorRestType) updater.getRequestContents(); + + assertEquals(tenMinutesAgo, payload.getStartTime()); + } + + @Test + public void locatorDeleteReturnsExpectedUri() throws Exception { + EntityDeleteOperation deleter = Locator.delete(exampleLocatorId); + + assertEquals(expectedLocatorUri, deleter.getUri()); + } +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/LocatorInfoTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/LocatorInfoTest.java new file mode 100644 index 000000000000..25f67d48de24 --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/LocatorInfoTest.java @@ -0,0 +1,145 @@ +/** + * 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.models; + +import static org.junit.Assert.*; + +import java.util.Date; + +import org.junit.Test; + +import com.microsoft.windowsazure.services.media.implementation.content.LocatorRestType; + +public class LocatorInfoTest { + + @Test + public void testGetSetId() { + // Arrange + String expectedId = "testId"; + LocatorInfo locator = new LocatorInfo(null, new LocatorRestType().setId(expectedId)); + + // Act + String actualId = locator.getId(); + + // Assert + assertEquals(expectedId, actualId); + } + + @Test + public void testGetSetExpirationDateTime() { + // Arrange + Date expectedExpirationDateTime = new Date(); + LocatorInfo locatorInfo = new LocatorInfo(null, + new LocatorRestType().setExpirationDateTime(expectedExpirationDateTime)); + + // Act + Date actualExpirationDateTime = locatorInfo.getExpirationDateTime(); + + // Assert + assertEquals(expectedExpirationDateTime, actualExpirationDateTime); + } + + @Test + public void testGetSetType() { + // Arrange + LocatorType expectedLocatorType = LocatorType.SAS; + LocatorInfo locatorInfo = new LocatorInfo(null, new LocatorRestType().setType(expectedLocatorType.getCode())); + + // Act + LocatorType actualLocatorType = locatorInfo.getLocatorType(); + + // Assert + assertEquals(expectedLocatorType, actualLocatorType); + } + + @Test + public void testGetSetPath() { + // Arrange + String expectedPath = "testPath"; + LocatorInfo locatorInfo = new LocatorInfo(null, new LocatorRestType().setPath(expectedPath)); + + // Act + String actualPath = locatorInfo.getPath(); + + // Assert + assertEquals(expectedPath, actualPath); + } + + @Test + public void testGetSetAccessPolicyId() { + // Arrange + String expectedAccessPolicyId = "testAccessPolicyId"; + LocatorInfo locatorInfo = new LocatorInfo(null, new LocatorRestType().setAccessPolicyId(expectedAccessPolicyId)); + + // Act + String actualAccessPolicyId = locatorInfo.getAccessPolicyId(); + + // Assert + assertEquals(expectedAccessPolicyId, actualAccessPolicyId); + } + + @Test + public void testGetSetAssetId() { + // Arrange + String expectedAssetId = "testAssetId"; + LocatorInfo locatorInfo = new LocatorInfo(null, new LocatorRestType().setAssetId(expectedAssetId)); + + // Act + String actualAssetId = locatorInfo.getAssetId(); + + // Assert + assertEquals(expectedAssetId, actualAssetId); + } + + @Test + public void testGetSetStartTime() { + // Arrange + Date expectedStartTime = new Date(); + LocatorInfo locatorInfo = new LocatorInfo(null, new LocatorRestType().setStartTime(expectedStartTime)); + + // Act + Date actualStartTime = locatorInfo.getStartTime(); + + // Assert + assertEquals(expectedStartTime, actualStartTime); + } + + @Test + public void testGetSetBaseUri() { + // Arrange + String expectedBaseUri = "testBaseUri"; + LocatorInfo locatorInfo = new LocatorInfo(null, new LocatorRestType().setBaseUri(expectedBaseUri)); + + // Act + String actualBaseUri = locatorInfo.getBaseUri(); + + // Assert + assertEquals(expectedBaseUri, actualBaseUri); + } + + @Test + public void testGetSetContentAccessComponent() { + // Arrange + String expectedContentAccessComponent = "testContentAccessToken"; + LocatorInfo locatorInfo = new LocatorInfo(null, + new LocatorRestType().setContentAccessComponent(expectedContentAccessComponent)); + + // Act + String actualContentAccessComponent = locatorInfo.getContentAccessToken(); + + // Assert + assertEquals(expectedContentAccessComponent, actualContentAccessComponent); + } +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/MediaProcessorEntityTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/MediaProcessorEntityTest.java new file mode 100644 index 000000000000..33de16847679 --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/MediaProcessorEntityTest.java @@ -0,0 +1,45 @@ +/** + * 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.models; + +import static org.junit.Assert.*; + +import org.junit.Test; + +import com.microsoft.windowsazure.services.media.entityoperations.EntityListOperation; + +/** + * Tests for the MediaProcessor entity + * + */ +public class MediaProcessorEntityTest { + + @Test + public void listMediaProcessorsReturnsExpectedUri() { + assertEquals("MediaProcessors", MediaProcessor.list().getUri()); + } + + @Test + public void listMediaProcessorsCanTakeQueryParmeters() { + + EntityListOperation<MediaProcessorInfo> lister = MediaProcessor.list().setTop(10).setSkip(2); + + assertEquals("10", lister.getQueryParameters().getFirst("$top")); + assertEquals("2", lister.getQueryParameters().getFirst("$skip")); + assertEquals(2, lister.getQueryParameters().size()); + } + +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/MediaProcessorInfoTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/MediaProcessorInfoTest.java new file mode 100644 index 000000000000..72d87f2db4c0 --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/MediaProcessorInfoTest.java @@ -0,0 +1,111 @@ +/** + * 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.models; + +import static org.junit.Assert.*; + +import org.junit.Test; + +import com.microsoft.windowsazure.services.media.implementation.content.MediaProcessorType; + +public class MediaProcessorInfoTest { + + @Test + public void testGetSetId() { + // Arrange + String expectedId = "expectedId"; + MediaProcessorInfo mediaProcessorInfo = new MediaProcessorInfo(null, new MediaProcessorType().setId(expectedId)); + + // Act + String actualId = mediaProcessorInfo.getId(); + + // Assert + assertEquals(expectedId, actualId); + + } + + @Test + public void testGetSetName() { + // Arrange + String expectedName = "testName"; + MediaProcessorInfo mediaProcessorInfo = new MediaProcessorInfo(null, + new MediaProcessorType().setName(expectedName)); + + // Act + String actualName = mediaProcessorInfo.getName(); + + // Assert + assertEquals(expectedName, actualName); + } + + @Test + public void testGetSetDescription() throws Exception { + // Arrange + String expectedDescription = "testDescription"; + + MediaProcessorInfo mediaProcessorInfo = new MediaProcessorInfo(null, + new MediaProcessorType().setDescription(expectedDescription)); + + // Act + String actualDescription = mediaProcessorInfo.getDescription(); + + // Assert + assertEquals(expectedDescription, actualDescription); + + } + + @Test + public void testGetSetSku() throws Exception { + // Arrange + String expectedSku = "testSku"; + MediaProcessorInfo mediaProcessorInfo = new MediaProcessorInfo(null, + new MediaProcessorType().setSku(expectedSku)); + + // Act + String actualSku = mediaProcessorInfo.getSku(); + + // Assert + assertEquals(expectedSku, actualSku); + } + + @Test + public void testGetSetVendor() { + // Arrange + String expectedVendor = "testVendor"; + MediaProcessorInfo mediaProcessorInfo = new MediaProcessorInfo(null, + new MediaProcessorType().setVendor(expectedVendor)); + + // Act + String actualVendor = mediaProcessorInfo.getVendor(); + + // Assert + assertEquals(expectedVendor, actualVendor); + } + + @Test + public void testGetSetVersion() { + // Arrange + String expectedVersion = "testVersion"; + MediaProcessorInfo mediaProcessorInfo = new MediaProcessorInfo(null, + new MediaProcessorType().setVersion(expectedVersion)); + + // Act + String actualVersion = mediaProcessorInfo.getVersion(); + + // Assert + assertEquals(expectedVersion, actualVersion); + } + +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/ProtectionKeyEntityTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/ProtectionKeyEntityTest.java new file mode 100644 index 000000000000..79991d82f0d2 --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/ProtectionKeyEntityTest.java @@ -0,0 +1,50 @@ +/** + * 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.models; + +import static org.junit.Assert.*; + +import java.util.List; + +import org.junit.Test; + +/** + * Tests for the methods and factories of the ProtectionKey entity. + */ +public class ProtectionKeyEntityTest { + + public ProtectionKeyEntityTest() throws Exception { + } + + @Test + public void ProtectionKeyIdReturnsPayloadWithTheRightProtectionKeyType() { + List<String> contentKeyTypeArray = ProtectionKey.getProtectionKeyId(ContentKeyType.StorageEncryption) + .getQueryParameters().get("contentKeyType"); + String actualContentKeyType = contentKeyTypeArray.get(0); + + assertEquals(ContentKeyType.StorageEncryption.getCode(), Integer.parseInt(actualContentKeyType)); + } + + @Test + public void ProtectionKeyReturnsPayloadWithTheRightProtectionKeyId() { + String expectedProtectionKeyId = "expectedProtectionKey"; + String actualProtectionKeyId = ProtectionKey.getProtectionKey(expectedProtectionKeyId).getQueryParameters() + .getFirst("ProtectionKeyId"); + expectedProtectionKeyId = String.format("'%s'", expectedProtectionKeyId); + + assertEquals(expectedProtectionKeyId, actualProtectionKeyId); + } +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/TaskEntityTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/TaskEntityTest.java new file mode 100644 index 000000000000..42d312f16d4c --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/TaskEntityTest.java @@ -0,0 +1,182 @@ +/** + * 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.models; + +import static org.junit.Assert.*; + +import javax.xml.bind.JAXBElement; + +import org.junit.Test; + +import com.microsoft.windowsazure.services.media.implementation.atom.ContentType; +import com.microsoft.windowsazure.services.media.implementation.atom.EntryType; +import com.microsoft.windowsazure.services.media.implementation.content.TaskType; + +/** + * Tests for the methods and factories of the Task entity. + */ +public class TaskEntityTest { + static final String sampleTaskId = "nb:cid:UUID:1151b8bd-9ada-4e7f-9787-8dfa49968eab"; + + private TaskType getTaskType(EntryType entryType) { + for (Object child : entryType.getEntryChildren()) { + if (child instanceof JAXBElement) { + @SuppressWarnings("rawtypes") + JAXBElement element = (JAXBElement) child; + if (element.getDeclaredType() == ContentType.class) { + ContentType contentType = (ContentType) element.getValue(); + for (Object grandChild : contentType.getContent()) { + if (grandChild instanceof JAXBElement) { + @SuppressWarnings("rawtypes") + JAXBElement contentElement = (JAXBElement) grandChild; + TaskType taskType = (TaskType) contentElement.getValue(); + return taskType; + } + } + return null; + } + } + } + return null; + } + + public TaskEntityTest() throws Exception { + } + + @Test + public void taskCreateReturnsDefaultCreatePayload() { + String expectedMediaProcessorId = "expectedMediaProcessorId"; + String expectedTaskBody = "expectedTaskBody"; + + TaskType taskType = getTaskType(Task.create(expectedMediaProcessorId, expectedTaskBody).getEntryType()); + + assertNotNull(taskType); + assertEquals(expectedMediaProcessorId, taskType.getMediaProcessorId()); + assertEquals(expectedTaskBody, taskType.getTaskBody()); + } + + @Test + public void taskCreateCanSetTaskName() { + String expectedName = "TaskCreateCanSetTaskName"; + + String expectedMediaProcessorId = "expectedMediaProcessorId"; + String expectedTaskBody = "expectedTaskBody"; + + TaskType taskType = getTaskType(Task.create(expectedMediaProcessorId, expectedTaskBody).setName(expectedName) + .getEntryType()); + + assertNotNull(taskType); + assertEquals(expectedName, taskType.getName()); + } + + @Test + public void taskCreateCanSetConfiguration() { + String expectedConfiguration = "TaskCreateCanSetTaskCofniguration"; + + String expectedMediaProcessorId = "expectedMediaProcessorId"; + String expectedTaskBody = "expectedTaskBody"; + + TaskType taskType = getTaskType(Task.create(expectedMediaProcessorId, expectedTaskBody) + .setConfiguration(expectedConfiguration).getEntryType()); + + assertNotNull(taskType); + assertEquals(expectedConfiguration, taskType.getConfiguration()); + } + + @Test + public void taskCreateCanSetPriority() { + Integer expectedPriority = 3; + + String expectedMediaProcessorId = "expectedMediaProcessorId"; + String expectedTaskBody = "expectedTaskBody"; + + TaskType taskType = getTaskType(Task.create(expectedMediaProcessorId, expectedTaskBody) + .setPriority(expectedPriority).getEntryType()); + + assertNotNull(taskType); + assertEquals(expectedPriority, taskType.getPriority()); + } + + @Test + public void taskCreateCanSetTaskBody() { + String expectedTaskBodyResult = "expectedTaskBodyResult"; + + String expectedMediaProcessorId = "expectedMediaProcessorId"; + String expectedTaskBody = "expectedTaskBody"; + + TaskType taskType = getTaskType(Task.create(expectedMediaProcessorId, expectedTaskBody) + .setTaskBody(expectedTaskBodyResult).getEntryType()); + + assertNotNull(taskType); + assertEquals(expectedTaskBodyResult, taskType.getTaskBody()); + } + + @Test + public void taskCreateCanSetEncryptionKeyId() { + String expectedEncryptionKeyId = "expectedEncryptionKeyId"; + + String expectedMediaProcessorId = "expectedMediaProcessorId"; + String expectedTaskBody = "expectedTaskBody"; + + TaskType taskType = getTaskType(Task.create(expectedMediaProcessorId, expectedTaskBody) + .setEncryptionKeyId(expectedEncryptionKeyId).getEntryType()); + + assertNotNull(taskType); + assertEquals(expectedEncryptionKeyId, taskType.getEncryptionKeyId()); + } + + @Test + public void taskCreateCanSetEncryptionScheme() { + String expectedEncryptionScheme = "expectedEncryptionScheme"; + + String expectedMediaProcessorId = "expectedMediaProcessorId"; + String expectedTaskBody = "expectedTaskBody"; + + TaskType taskType = getTaskType(Task.create(expectedMediaProcessorId, expectedTaskBody) + .setEncryptionScheme(expectedEncryptionScheme).getEntryType()); + + assertNotNull(taskType); + assertEquals(expectedEncryptionScheme, taskType.getEncryptionScheme()); + } + + @Test + public void taskCreateCanSetEncryptionVersion() { + String expectedEncryptionVersion = "expectedEncryptionVersion"; + + String expectedMediaProcessorId = "expectedMediaProcessorId"; + String expectedTaskBody = "expectedTaskBody"; + + TaskType taskType = getTaskType(Task.create(expectedMediaProcessorId, expectedTaskBody) + .setEncryptionVersion(expectedEncryptionVersion).getEntryType()); + + assertNotNull(taskType); + assertEquals(expectedEncryptionVersion, taskType.getEncryptionVersion()); + } + + @Test + public void taskCreateCanSetInitializationVector() { + String expectedInitializationVector = "expectedEncryptionKeyId"; + + String expectedMediaProcessorId = "expectedMediaProcessorId"; + String expectedTaskBody = "expectedTaskBody"; + + TaskType taskType = getTaskType(Task.create(expectedMediaProcessorId, expectedTaskBody) + .setInitializationVector(expectedInitializationVector).getEntryType()); + + assertNotNull(taskType); + assertEquals(expectedInitializationVector, taskType.getInitializationVector()); + } +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/TaskInfoTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/TaskInfoTest.java new file mode 100644 index 000000000000..a0d32233b9e2 --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/media/models/TaskInfoTest.java @@ -0,0 +1,273 @@ +/** + * 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.models; + +import static org.junit.Assert.*; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import org.junit.Test; + +import com.microsoft.windowsazure.services.media.implementation.content.ErrorDetailType; +import com.microsoft.windowsazure.services.media.implementation.content.TaskType; + +public class TaskInfoTest { + + @Test + public void testGetSetId() { + // Arrange + String expectedId = "expectedId"; + TaskInfo taskInfo = new TaskInfo(null, new TaskType().setId(expectedId)); + + // Act + String actualId = taskInfo.getId(); + + // Assert + assertEquals(expectedId, actualId); + + } + + @Test + public void testGetSetConfiguration() { + // Arrange + String expectedConfiguration = "expectedConfiguration"; + TaskInfo taskInfo = new TaskInfo(null, new TaskType().setConfiguration(expectedConfiguration)); + + // Act + String actualConfiguration = taskInfo.getConfiguration(); + + // Assert + assertEquals(expectedConfiguration, actualConfiguration); + } + + @Test + public void testGetSetEndTime() throws Exception { + // Arrange + Date expectedEndTime = new Date(); + + TaskInfo taskInfo = new TaskInfo(null, new TaskType().setEndTime(expectedEndTime)); + + // Act + Date actualEndTime = taskInfo.getEndTime(); + + // Assert + assertEquals(expectedEndTime, actualEndTime); + + } + + @Test + public void testGetSetErrorDetails() throws Exception { + // Arrange + List<ErrorDetail> expectedErrorDetails = new ArrayList<ErrorDetail>(); + List<ErrorDetailType> expectedErrorDetailsType = new ArrayList<ErrorDetailType>(); + for (ErrorDetailType errorDetailType : expectedErrorDetailsType) { + ErrorDetail errorDetail = new ErrorDetail(errorDetailType.getCode(), errorDetailType.getMessage()); + expectedErrorDetails.add(errorDetail); + } + TaskInfo taskInfo = new TaskInfo(null, new TaskType().setErrorDetails(expectedErrorDetailsType)); + + // Act + List<ErrorDetail> actualErrorDetails = taskInfo.getErrorDetails(); + + // Assert + assertEquals(expectedErrorDetails, actualErrorDetails); + } + + @Test + public void testGetSetMediaProcessorId() { + // Arrange + String expectedName = "testName"; + TaskInfo TaskInfo = new TaskInfo(null, new TaskType().setName(expectedName)); + + // Act + String actualName = TaskInfo.getName(); + + // Assert + assertEquals(expectedName, actualName); + } + + @Test + public void testGetSetName() { + // Arrange + + TaskOption expectedOptions = TaskOption.None; + TaskInfo TaskInfo = new TaskInfo(null, new TaskType().setOptions(expectedOptions.getCode())); + + // Act + TaskOption actualOptions = TaskInfo.getOptions(); + + // Assert + assertEquals(expectedOptions, actualOptions); + } + + @Test + public void testGetSetPerfMessage() { + // Arrange + String expectedPerfMessage = "testGetSetPerfMessage"; + TaskInfo TaskInfo = new TaskInfo(null, new TaskType().setPerfMessage(expectedPerfMessage)); + + // Act + String actualPerfMessage = TaskInfo.getPerfMessage(); + + // Assert + assertEquals(expectedPerfMessage, actualPerfMessage); + } + + @Test + public void testGetSetPriority() { + // Arrange + int expectedPriority = 3; + TaskInfo TaskInfo = new TaskInfo(null, new TaskType().setPriority(expectedPriority)); + + // Act + int actualPriority = TaskInfo.getPriority(); + + // Assert + assertEquals(expectedPriority, actualPriority); + } + + @Test + public void testGetSetProgress() { + // Arrange + double expectedProgress = 3; + TaskInfo TaskInfo = new TaskInfo(null, new TaskType().setProgress(expectedProgress)); + + // Act + double actualProgress = TaskInfo.getProgress(); + + // Assert + assertEquals(expectedProgress, actualProgress, 0.00001); + } + + @Test + public void testGetSetRunningDuration() { + // Arrange + double expectedRunningDuration = 3; + TaskInfo TaskInfo = new TaskInfo(null, new TaskType().setRunningDuration(expectedRunningDuration)); + + // Act + double actualRunningDuration = TaskInfo.getRunningDuration(); + + // Assert + assertEquals(expectedRunningDuration, actualRunningDuration, 0.00001); + } + + @Test + public void testGetSetStartTime() { + // Arrange + Date expectedStartTime = new Date(); + TaskInfo TaskInfo = new TaskInfo(null, new TaskType().setStartTime(expectedStartTime)); + + // Act + Date actualStartTime = TaskInfo.getStartTime(); + + // Assert + assertEquals(expectedStartTime, actualStartTime); + } + + @Test + public void testGetSetState() { + // Arrange + TaskState expectedState = TaskState.Completed; + TaskInfo TaskInfo = new TaskInfo(null, new TaskType().setState(expectedState.getCode())); + + // Act + TaskState actualState = TaskInfo.getState(); + + // Assert + assertEquals(expectedState, actualState); + } + + @Test + public void testGetSetTaskBody() { + // Arrange + String expectedTaskBody = "getSetTaskBody"; + TaskInfo TaskInfo = new TaskInfo(null, new TaskType().setTaskBody(expectedTaskBody)); + + // Act + String actualTaskBody = TaskInfo.getTaskBody(); + + // Assert + assertEquals(expectedTaskBody, actualTaskBody); + } + + @Test + public void testGetSetOptions() { + // Arrange + TaskOption expectedTaskOption = TaskOption.ProtectedConfiguration; + TaskInfo TaskInfo = new TaskInfo(null, new TaskType().setOptions(expectedTaskOption.getCode())); + + // Act + TaskOption actualTaskOption = TaskInfo.getOptions(); + + // Assert + assertEquals(expectedTaskOption, actualTaskOption); + } + + @Test + public void testGetSetEncryptionKeyId() { + // Arrange + String expectedEncryptionKeyId = "getSetEncryptionKeyId"; + TaskInfo taskInfo = new TaskInfo(null, new TaskType().setEncryptionKeyId(expectedEncryptionKeyId)); + + // Act + String actualEncryptionKeyId = taskInfo.getEncryptionKeyId(); + + // Assert + assertEquals(expectedEncryptionKeyId, actualEncryptionKeyId); + } + + @Test + public void testGetSetEncryptionScheme() { + // Arrange + String expectedEncryptionScheme = "getSetEncryptionScheme"; + TaskInfo taskInfo = new TaskInfo(null, new TaskType().setEncryptionScheme(expectedEncryptionScheme)); + + // Act + String actualEncryptionScheme = taskInfo.getEncryptionScheme(); + + // Assert + assertEquals(expectedEncryptionScheme, actualEncryptionScheme); + } + + @Test + public void testGetSetEncryptionVersion() { + // Arrange + String expectedEncryptionVersion = "1.5"; + TaskInfo taskInfo = new TaskInfo(null, new TaskType().setEncryptionVersion(expectedEncryptionVersion)); + + // Act + String actualEncryptionVersion = taskInfo.getEncryptionVersion(); + + // Assert + assertEquals(expectedEncryptionVersion, actualEncryptionVersion); + } + + @Test + public void testGetSetInitializationVector() { + // Arrange + String expectedInitializationVector = "testInitializationVector"; + TaskInfo taskInfo = new TaskInfo(null, new TaskType().setEncryptionVersion(expectedInitializationVector)); + + // Act + String actualInitializationVector = taskInfo.getEncryptionVersion(); + + // Assert + assertEquals(expectedInitializationVector, actualInitializationVector); + } + +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/IntegrationTestBase.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/IntegrationTestBase.java index a854804bde36..d682fd2f3fba 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/IntegrationTestBase.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/IntegrationTestBase.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/QueueServiceIntegrationTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/QueueServiceIntegrationTest.java index db8ca0f130c1..0380a7be8942 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/QueueServiceIntegrationTest.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/QueueServiceIntegrationTest.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/client/CloudQueueClientTests.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/client/CloudQueueClientTests.java index 68c238dcc953..b3c266fac5ae 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/client/CloudQueueClientTests.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/client/CloudQueueClientTests.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/client/CloudQueueTests.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/client/CloudQueueTests.java index b107e3052741..d97bb4bdc7b4 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/client/CloudQueueTests.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/client/CloudQueueTests.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/client/QueueTestBase.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/client/QueueTestBase.java index 8144378d8577..ead279ce3dbd 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/client/QueueTestBase.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/queue/client/QueueTestBase.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/scenarios/MediaServiceScenarioTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/scenarios/MediaServiceScenarioTest.java new file mode 100644 index 000000000000..41bc23269dab --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/scenarios/MediaServiceScenarioTest.java @@ -0,0 +1,209 @@ +/** + * 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.scenarios; + +import static org.junit.Assert.*; + +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.List; +import java.util.Random; +import java.util.UUID; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.microsoft.windowsazure.services.core.ServiceException; +import com.microsoft.windowsazure.services.media.MediaContract; +import com.microsoft.windowsazure.services.media.MediaService; +import com.microsoft.windowsazure.services.media.models.AssetInfo; +import com.microsoft.windowsazure.services.media.models.AssetOption; +import com.microsoft.windowsazure.services.media.models.JobInfo; +import com.microsoft.windowsazure.services.media.models.ListResult; +import com.microsoft.windowsazure.services.media.models.Task; +import com.microsoft.windowsazure.services.scenarios.MediaServiceWrapper.EncoderType; + +public class MediaServiceScenarioTest extends ScenarioTestBase { + private static final String rootTestAssetPrefix = "testAssetPrefix-"; + private static String testAssetPrefix; + private static MediaServiceWrapper wrapper; + private static MediaServiceValidation validator; + + @BeforeClass + public static void setup() throws ServiceException { + ScenarioTestBase.initializeConfig(); + MediaContract service = MediaService.create(config); + wrapper = new MediaServiceWrapper(service); + validator = new MediaServiceValidation(service); + testAssetPrefix = rootTestAssetPrefix + UUID.randomUUID() + "-"; + } + + @AfterClass + public static void cleanup() throws ServiceException { + wrapper.removeAllAssetsWithPrefix(rootTestAssetPrefix); + wrapper.removeAllAccessPoliciesWithPrefix(); + } + + @Test + public void newAsset() throws Exception { + AssetInfo asset = wrapper.createAsset(testAssetPrefix + "newAsset", AssetOption.None); + validator.validateAsset(asset, testAssetPrefix + "newAsset", AssetOption.None); + } + + @Test + public void pageOverAssets() throws ServiceException { + signalSetupStarting(); + String rootName = testAssetPrefix + "pageOverAssets"; + List<String> assetNames = createListOfAssetNames(rootName, 4); + for (String assetName : assetNames) { + wrapper.createAsset(assetName, AssetOption.None); + } + signalSetupFinished(); + + List<ListResult<AssetInfo>> pages = wrapper.getAssetSortedPagedResults(rootName, 3); + validator.validateAssetSortedPages(pages, assetNames, 3); + } + + @Test + public void uploadFiles() throws Exception { + signalSetupStarting(); + AssetInfo asset = wrapper.createAsset(testAssetPrefix + "uploadFiles", AssetOption.None); + signalSetupFinished(); + + wrapper.uploadFilesToAsset(asset, 10, getTestAssetFiles()); + validator.validateAssetFiles(asset, getTestAssetFiles()); + } + + @Test + public void uploadEncryptedFiles() throws Exception { + signalSetupStarting(); + byte[] aesKey = getNewAesKey(); + AssetInfo asset = wrapper.createAsset(testAssetPrefix + "uploadEncryptedFiles", AssetOption.StorageEncrypted); + + signalSetupFinished(); + + wrapper.uploadFilesToAsset(asset, 10, getTestAssetFiles(), aesKey); + validator.validateAssetFiles(asset, getTestAssetFiles()); + } + + @Test + public void downloadFiles() throws Exception { + signalSetupStarting(); + AssetInfo asset = wrapper.createAsset(testAssetPrefix + "downloadFiles", AssetOption.None); + wrapper.uploadFilesToAsset(asset, 10, getTestAssetFiles()); + signalSetupFinished(); + + Hashtable<String, InputStream> actualFileStreams = wrapper.downloadFilesFromAsset(asset, 10); + validator.validateAssetFiles(getTestAssetFiles(), actualFileStreams); + } + + @Test + public void createJob() throws Exception { + signalSetupStarting(); + AssetInfo asset = wrapper.createAsset(testAssetPrefix + "createJob", AssetOption.None); + wrapper.uploadFilesToAsset(asset, 10, getTestAssetFiles()); + signalSetupFinished(); + + String jobName = "my job createJob" + UUID.randomUUID().toString(); + JobInfo job = wrapper.createJob(jobName, asset, createTasks()); + validator.validateJob(job, jobName, asset, createTasks()); + } + + @Test + public void transformAsset() throws Exception { + signalSetupStarting(); + AssetInfo asset = wrapper.createAsset(testAssetPrefix + "transformAsset", AssetOption.None); + wrapper.uploadFilesToAsset(asset, 10, getTestAssetFiles()); + String jobName = "my job transformAsset" + UUID.randomUUID().toString(); + + JobInfo job = wrapper.createJob(jobName, asset, + wrapper.createTaskOptions("Transform", 0, 0, EncoderType.WindowsAzureMediaEncoder)); + signalSetupFinished(); + + waitForJobToFinish(job); + List<AssetInfo> outputAssets = wrapper.getJobOutputMediaAssets(job); + + validator.validateOutputAssets(outputAssets, getTestAssetFiles().keys()); + } + + @Test + public void transformEncryptedAsset() throws Exception { + signalSetupStarting(); + byte[] aesKey = getNewAesKey(); + AssetInfo asset = wrapper + .createAsset(testAssetPrefix + "transformEncryptedAsset", AssetOption.StorageEncrypted); + + wrapper.uploadFilesToAsset(asset, 10, getTestAssetFiles(), aesKey); + String jobName = "my job transformEncryptedAsset" + UUID.randomUUID().toString(); + JobInfo job = wrapper.createJob(jobName, asset, + wrapper.createTaskOptions("Decode", 0, 0, EncoderType.StorageDecryption)); + signalSetupFinished(); + + waitForJobToFinish(job); + List<AssetInfo> outputAssets = wrapper.getJobOutputMediaAssets(job); + validator.validateOutputAssets(outputAssets, getTestAssetFiles().keys()); + + // Verify output asset files. + assertEquals("output assets count", 1, outputAssets.size()); + AssetInfo outputAsset = outputAssets.get(0); + validator.validateAssetFiles(outputAsset, getTestAssetFiles()); + + // Verify assets were decoded. + Hashtable<String, InputStream> actualFileStreams = wrapper.downloadFilesFromAsset(outputAsset, 10); + validator.validateAssetFiles(getTestAssetFiles(), actualFileStreams); + } + + private byte[] getNewAesKey() { + // Media Services requires 256-bit (32-byte) keys for AES encryption. + Random random = new Random(); + byte[] aesKey = new byte[32]; + random.nextBytes(aesKey); + return aesKey; + } + + private void waitForJobToFinish(JobInfo job) throws InterruptedException, ServiceException { + for (int counter = 0; !wrapper.isJobFinished(job); counter++) { + if (counter > 30) { + fail("Took took long for the job to finish"); + } + Thread.sleep(10000); + } + } + + private List<Task.CreateBatchOperation> createTasks() throws ServiceException { + List<Task.CreateBatchOperation> tasks = new ArrayList<Task.CreateBatchOperation>(); + + tasks.add(wrapper.createTaskOptions("Decryptor", 0, 0, EncoderType.StorageDecryption)); + tasks.add(wrapper.createTaskOptions("Processor", 0, 1, EncoderType.WindowsAzureMediaEncoder)); + return tasks; + } + + private Hashtable<String, InputStream> getTestAssetFiles() { + Hashtable<String, InputStream> inputFiles = new Hashtable<String, InputStream>(); + inputFiles.put("MPEG4-H264.mp4", getClass().getResourceAsStream("/media/MPEG4-H264.mp4")); + return inputFiles; + } + + private List<String> createListOfAssetNames(String rootName, int count) { + List<String> assetNames = new ArrayList<String>(); + for (int i = 0; i < count; i++) { + assetNames.add(rootName + i); + } + return assetNames; + } +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/scenarios/MediaServiceValidation.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/scenarios/MediaServiceValidation.java new file mode 100644 index 000000000000..45c8611da58c --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/scenarios/MediaServiceValidation.java @@ -0,0 +1,251 @@ +/** + * 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.scenarios; + +import static org.junit.Assert.*; + +import java.io.IOException; +import java.io.InputStream; +import java.security.NoSuchAlgorithmException; +import java.util.ArrayList; +import java.util.Date; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.List; + +import com.microsoft.windowsazure.services.core.ServiceException; +import com.microsoft.windowsazure.services.media.MediaContract; +import com.microsoft.windowsazure.services.media.models.Asset; +import com.microsoft.windowsazure.services.media.models.AssetFile; +import com.microsoft.windowsazure.services.media.models.AssetFileInfo; +import com.microsoft.windowsazure.services.media.models.AssetInfo; +import com.microsoft.windowsazure.services.media.models.AssetOption; +import com.microsoft.windowsazure.services.media.models.AssetState; +import com.microsoft.windowsazure.services.media.models.ContentKey; +import com.microsoft.windowsazure.services.media.models.ContentKeyInfo; +import com.microsoft.windowsazure.services.media.models.JobInfo; +import com.microsoft.windowsazure.services.media.models.ListResult; +import com.microsoft.windowsazure.services.media.models.Task; + +class MediaServiceValidation { + private final MediaContract service; + + public MediaServiceValidation(MediaContract service) { + this.service = service; + } + + public void validateAsset(AssetInfo asset, String name, AssetOption encryption) throws ServiceException { + // Check the asset state. + assertNotNull("asset", asset); + assertNotNull("asset.getId", asset.getId()); + assertFalse("asset.getId != ''", "".equals(asset.getId())); + assertEquals("asset.state", AssetState.Initialized, asset.getState()); + assertEquals("asset.getOptions", encryption, asset.getOptions()); + + // Verify no files by default. + List<AssetFileInfo> initialFiles = service.list(AssetFile.list(asset.getAssetFilesLink())); + assertNotNull("initialFiles", initialFiles); + assertEquals("initialFiles.size", 0, initialFiles.size()); + + // Reload asset from server for ID + AssetInfo reloadedAsset = service.get(Asset.get(asset.getId())); + + // Verify names match + assertNotNull("reloadedAsset", reloadedAsset); + assertNotNull("reloadedAsset.getId", reloadedAsset.getId()); + assertEquals("reloadedAsset.getId, asset.getId", asset.getId(), reloadedAsset.getId()); + assertEquals("reloadedAsset.state", AssetState.Initialized, reloadedAsset.getState()); + assertEquals("reloadedAsset.getOptions", encryption, reloadedAsset.getOptions()); + } + + public void validateAssetSortedPages(List<ListResult<AssetInfo>> pages, List<String> assetNames, int pageSize) { + int sumSizeOfPages = 0; + List<String> actualAssetNames = new ArrayList<String>(); + + for (ListResult<AssetInfo> page : pages) { + sumSizeOfPages += page.size(); + for (AssetInfo asset : page) { + actualAssetNames.add(asset.getName()); + } + } + + assertEquals("sumSizeOfPages", assetNames.size(), sumSizeOfPages); + assertEquals("size of last page", 0, pages.get(pages.size() - 1).size()); + + // Do not worry about comparing the details of the sorted pages, + // because Media Services splits on the internal order, then sorts + // each page individually. + } + + public void validateAssetFiles(AssetInfo asset, Hashtable<String, InputStream> inputFiles) throws ServiceException, + IOException, NoSuchAlgorithmException { + List<AssetFileInfo> assetFiles = service.list(AssetFile.list(asset.getAssetFilesLink())); + + assertNotNull("assetFiles", assetFiles); + assertEquals("assetFiles.size", inputFiles.size(), assetFiles.size()); + + ContentKeyInfo contentKey = null; + if (asset.getOptions() == AssetOption.StorageEncrypted) { + ListResult<ContentKeyInfo> contentKeys = service.list(ContentKey.list(asset.getContentKeysLink())); + assertEquals("contentKeys size", 1, contentKeys.size()); + contentKey = contentKeys.get(0); + } + + // Compare encryption info for asset files + for (AssetFileInfo assetFile : assetFiles) { + if (asset.getOptions() == AssetOption.StorageEncrypted) { + assertEquals("assetFile.getIsEncrypted", true, assetFile.getIsEncrypted()); + assertEquals("assetFile.getEncryptionKeyId", contentKey.getId(), assetFile.getEncryptionKeyId()); + assertNotNullOrEmpty("assetFile.getEncryptionScheme", assetFile.getEncryptionScheme()); + assertNotNullOrEmpty("assetFile.getEncryptionVersion", assetFile.getEncryptionVersion()); + assertNotNullOrEmpty("assetFile.getInitializationVector", assetFile.getInitializationVector()); + } + else { + assertEquals("assetFile.getIsEncrypted", false, assetFile.getIsEncrypted()); + assertNullOrEmpty("assetFile.getEncryptionKeyId", assetFile.getEncryptionKeyId()); + assertNullOrEmpty("assetFile.getEncryptionScheme", assetFile.getEncryptionScheme()); + assertNullOrEmpty("assetFile.getEncryptionVersion", assetFile.getEncryptionVersion()); + assertNullOrEmpty("assetFile.getInitializationVector", assetFile.getInitializationVector()); + } + } + + // Compare the asset files with all files + List<AssetFileInfo> allFiles = service.list(AssetFile.list()); + for (AssetFileInfo assetFile : assetFiles) { + assertEquals("fi.getParentAssetId", asset.getId(), assetFile.getParentAssetId()); + AssetFileInfo match = null; + for (AssetFileInfo aFile : allFiles) { + if (aFile.getId().equals(assetFile.getId())) { + match = aFile; + break; + } + } + + assertFileInfosEqual("match from all files", assetFile, match); + } + } + + public void validateAssetFiles(Hashtable<String, InputStream> inputFiles, + Hashtable<String, InputStream> actualFileStreams) throws IOException, InterruptedException { + assertEquals("fileUrls count", inputFiles.size(), actualFileStreams.size()); + for (String fileName : actualFileStreams.keySet()) { + InputStream expected = inputFiles.get(fileName); + InputStream actual = actualFileStreams.get(fileName); + assertStreamsEqual(expected, actual); + } + } + + public void validateJob(JobInfo job, String name, AssetInfo asset, List<Task.CreateBatchOperation> createTasks) + throws ServiceException { + assertDateApproxEquals("getEndTime", new Date(), job.getCreated()); + assertEquals("job.getName", name, job.getName()); + + List<AssetInfo> inputAssets = service.list(Asset.list(job.getInputAssetsLink())); + assertNotNull("inputAssets", inputAssets); + assertEquals("inputAssets.size()", 1, inputAssets.size()); + assertEquals("inputAssets.get(0)", asset.getId(), inputAssets.get(0).getId()); + + List<AssetInfo> outputAssets = service.list(Asset.list(job.getOutputAssetsLink())); + assertNotNull("outputAssets", outputAssets); + assertEquals("outputAssets.size()", createTasks.size(), outputAssets.size()); + } + + public void validateOutputAssets(List<AssetInfo> outputAssets, Enumeration<String> enumeration) { + assertNotNull("outputAssets", outputAssets); + for (AssetInfo asset : outputAssets) { + assertNotNull("asset", asset); + assertNotNull("asset.getId", asset.getId()); + assertFalse("asset.getId != ''", "".equals(asset.getId())); + assertEquals("asset.state", AssetState.Initialized, asset.getState()); + assertEquals("asset.getOptions", AssetOption.None, asset.getOptions()); + } + } + + public void assertFileInfosEqual(String message, AssetFileInfo fi, AssetFileInfo match) { + assertNotNull(message + ":fi", fi); + assertNotNull(message + ":match", match); + assertEquals(message + ":getContentChecksum", fi.getContentChecksum(), match.getContentChecksum()); + assertEquals(message + ":getContentFileSize", fi.getContentFileSize(), match.getContentFileSize()); + assertEquals(message + ":getCreated", fi.getCreated(), match.getCreated()); + assertEquals(message + ":getEncryptionKeyId", fi.getEncryptionKeyId(), match.getEncryptionKeyId()); + assertEquals(message + ":getEncryptionScheme", fi.getEncryptionScheme(), match.getEncryptionScheme()); + assertEquals(message + ":getEncryptionVersion", fi.getEncryptionVersion(), match.getEncryptionVersion()); + assertEquals(message + ":getId", fi.getId(), match.getId()); + assertEquals(message + ":getIsEncrypted", fi.getIsEncrypted(), match.getIsEncrypted()); + assertEquals(message + ":getIsPrimary", fi.getIsPrimary(), match.getIsPrimary()); + assertEquals(message + ":getLastModified", fi.getLastModified(), match.getLastModified()); + assertEquals(message + ":getMimeType", fi.getMimeType(), match.getMimeType()); + assertEquals(message + ":getName", fi.getName(), match.getName()); + assertEquals(message + ":getParentAssetId", fi.getParentAssetId(), match.getParentAssetId()); + } + + protected void assertDateApproxEquals(String message, Date expected, Date actual) { + // Default allows for a 30 seconds difference in dates, for clock skew, network delays, etc. + long deltaInMilliseconds = 30000; + + if (expected == null || actual == null) { + assertEquals(message, expected, actual); + } + else { + long diffInMilliseconds = Math.abs(expected.getTime() - actual.getTime()); + + if (diffInMilliseconds > deltaInMilliseconds) { + assertEquals(message, expected, actual); + } + } + } + + private void assertStreamsEqual(InputStream inputStream1, InputStream inputStream2) throws IOException { + byte[] buffer1 = new byte[1024]; + byte[] buffer2 = new byte[1024]; + try { + while (true) { + int n1 = inputStream1.read(buffer1); + int n2 = inputStream2.read(buffer2); + assertEquals("number of bytes read from streams", n1, n2); + if (n1 == -1) { + break; + } + for (int i = 0; i < n1; i++) { + assertEquals("byte " + i + " read from streams", buffer1[i], buffer2[i]); + } + } + } + finally { + inputStream1.close(); + inputStream2.close(); + } + } + + private void assertNullOrEmpty(String message, String actual) { + if (actual == null) { + assertNull(message, actual); + } + else { + assertEquals(message, "", actual); + } + } + + private void assertNotNullOrEmpty(String message, String actual) { + if (actual == null) { + assertNotNull(message, actual); + } + else { + assertTrue(message + ": expect " + actual + " to be null or empty", actual.length() > 0); + } + } + +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/scenarios/MediaServiceWrapper.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/scenarios/MediaServiceWrapper.java new file mode 100644 index 000000000000..16ba0ddcdf92 --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/scenarios/MediaServiceWrapper.java @@ -0,0 +1,482 @@ +/** + * 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.scenarios; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.math.BigInteger; +import java.net.MalformedURLException; +import java.net.URL; +import java.security.DigestInputStream; +import java.security.Key; +import java.security.MessageDigest; +import java.security.SecureRandom; +import java.security.cert.Certificate; +import java.security.cert.CertificateFactory; +import java.util.ArrayList; +import java.util.EnumSet; +import java.util.Hashtable; +import java.util.List; +import java.util.Random; +import java.util.UUID; + +import javax.crypto.Cipher; +import javax.crypto.CipherInputStream; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; + +import junit.framework.Assert; + +import com.microsoft.windowsazure.services.core.ServiceException; +import com.microsoft.windowsazure.services.core.storage.utils.Base64; +import com.microsoft.windowsazure.services.media.MediaContract; +import com.microsoft.windowsazure.services.media.WritableBlobContainerContract; +import com.microsoft.windowsazure.services.media.entityoperations.EntityListOperation; +import com.microsoft.windowsazure.services.media.implementation.content.AssetFileType; +import com.microsoft.windowsazure.services.media.models.AccessPolicy; +import com.microsoft.windowsazure.services.media.models.AccessPolicyInfo; +import com.microsoft.windowsazure.services.media.models.AccessPolicyPermission; +import com.microsoft.windowsazure.services.media.models.Asset; +import com.microsoft.windowsazure.services.media.models.AssetFile; +import com.microsoft.windowsazure.services.media.models.AssetFile.Updater; +import com.microsoft.windowsazure.services.media.models.AssetFileInfo; +import com.microsoft.windowsazure.services.media.models.AssetInfo; +import com.microsoft.windowsazure.services.media.models.AssetOption; +import com.microsoft.windowsazure.services.media.models.ContentKey; +import com.microsoft.windowsazure.services.media.models.ContentKeyType; +import com.microsoft.windowsazure.services.media.models.Job; +import com.microsoft.windowsazure.services.media.models.Job.Creator; +import com.microsoft.windowsazure.services.media.models.JobInfo; +import com.microsoft.windowsazure.services.media.models.ListResult; +import com.microsoft.windowsazure.services.media.models.Locator; +import com.microsoft.windowsazure.services.media.models.LocatorInfo; +import com.microsoft.windowsazure.services.media.models.LocatorType; +import com.microsoft.windowsazure.services.media.models.MediaProcessor; +import com.microsoft.windowsazure.services.media.models.MediaProcessorInfo; +import com.microsoft.windowsazure.services.media.models.ProtectionKey; +import com.microsoft.windowsazure.services.media.models.Task; + +class MediaServiceWrapper { + private final MediaContract service; + + private static final String accessPolicyPrefix = "scenarioTestPrefix"; + + private final String MEDIA_PROCESSOR_STORAGE_DECRYPTION = "Storage Decryption"; + private final String MEDIA_PROCESSOR_WINDOWS_AZURE_MEDIA_ENCODER = "Windows Azure Media Encoder"; + + public static enum EncoderType { + WindowsAzureMediaEncoder, StorageDecryption + } + + public MediaServiceWrapper(MediaContract service) { + this.service = service; + } + + // Manage + public AssetInfo createAsset(String name, AssetOption encryption) throws ServiceException { + if (encryption == AssetOption.StorageEncrypted && !EncryptionHelper.canUseStrongCrypto()) { + Assert.fail("JVM does not support the required encryption"); + } + + // Create asset. The SDK's top-level method is the simplest way to do that. + return service.create(Asset.create().setName(name).setAlternateId("altId").setOptions(encryption)); + } + + public List<ListResult<AssetInfo>> getAssetSortedPagedResults(String rootName, int pageSize) + throws ServiceException { + List<ListResult<AssetInfo>> pages = new ArrayList<ListResult<AssetInfo>>(); + for (int skip = 0; true; skip += pageSize) { + EntityListOperation<AssetInfo> listOperation = Asset.list().setTop(pageSize).setSkip(skip) + .set("$filter", "startswith(Name,'" + rootName + "')").set("$orderby", "Name"); + + ListResult<AssetInfo> listAssetResult = service.list(listOperation); + pages.add(listAssetResult); + if (listAssetResult.size() == 0) { + break; + } + } + + return pages; + } + + // Ingest + public void uploadFilesToAsset(AssetInfo asset, int uploadWindowInMinutes, Hashtable<String, InputStream> inputFiles) + throws Exception { + uploadFilesToAsset(asset, uploadWindowInMinutes, inputFiles, null); + } + + public void uploadFilesToAsset(AssetInfo asset, int uploadWindowInMinutes, + Hashtable<String, InputStream> inputFiles, byte[] aesKey) throws Exception { + AccessPolicyInfo accessPolicy = service.create(AccessPolicy.create(accessPolicyPrefix + "tempAccessPolicy", + uploadWindowInMinutes, EnumSet.of(AccessPolicyPermission.WRITE))); + LocatorInfo locator = service.create(Locator.create(accessPolicy.getId(), asset.getId(), LocatorType.SAS)); + + String contentKeyId = createAssetContentKey(asset, aesKey); + + WritableBlobContainerContract uploader = service.createBlobWriter(locator); + + Hashtable<String, AssetFileInfo> infoToUpload = new Hashtable<String, AssetFileInfo>(); + + boolean isFirst = true; + for (String fileName : inputFiles.keySet()) { + MessageDigest digest = MessageDigest.getInstance("MD5"); + + InputStream inputStream = inputFiles.get(fileName); + + byte[] iv = null; + if (aesKey != null) { + iv = createIV(); + inputStream = EncryptionHelper.encryptFile(inputStream, aesKey, iv); + } + + InputStream digestStream = new DigestInputStream(inputStream, digest); + CountingStream countingStream = new CountingStream(digestStream); + uploader.createBlockBlob(fileName, countingStream); + + inputStream.close(); + byte[] md5hash = digest.digest(); + String md5 = Base64.encode(md5hash); + + AssetFileInfo fi = new AssetFileInfo(null, new AssetFileType().setContentChecksum(md5) + .setContentFileSize(countingStream.getCount()).setIsPrimary(isFirst).setName(fileName) + .setInitializationVector(getIVString(iv))); + infoToUpload.put(fileName, fi); + + isFirst = false; + } + + service.action(AssetFile.createFileInfos(asset.getId())); + for (AssetFileInfo assetFile : service.list(AssetFile.list(asset.getAssetFilesLink()))) { + AssetFileInfo fileInfo = infoToUpload.get(assetFile.getName()); + Updater updateOp = AssetFile.update(assetFile.getId()).setContentChecksum(fileInfo.getContentChecksum()) + .setContentFileSize(fileInfo.getContentFileSize()).setIsPrimary(fileInfo.getIsPrimary()); + + if (aesKey != null) { + updateOp.setIsEncrypted(true).setEncryptionKeyId(contentKeyId).setEncryptionScheme("StorageEncryption") + .setEncryptionVersion("1.0").setInitializationVector(fileInfo.getInitializationVector()); + } + + service.update(updateOp); + } + + service.list(AssetFile.list(asset.getAssetFilesLink())); + + service.delete(Locator.delete(locator.getId())); + service.delete(AccessPolicy.delete(accessPolicy.getId())); + } + + private String getIVString(byte[] iv) { + if (iv == null) { + return null; + } + + // Offset the bytes to ensure that the sign-bit is not set. + // Media Services expects unsigned Int64 values. + byte[] sub = new byte[9]; + System.arraycopy(iv, 0, sub, 1, 8); + BigInteger longIv = new BigInteger(sub); + return longIv.toString(); + } + + private byte[] createIV() { + // Media Services requires 128-bit (16-byte) initialization vectors (IV) + // for AES encryption, but also that only the first 8 bytes are filled. + Random random = new Random(); + byte[] effectiveIv = new byte[8]; + random.nextBytes(effectiveIv); + byte[] iv = new byte[16]; + System.arraycopy(effectiveIv, 0, iv, 0, effectiveIv.length); + return iv; + } + + private String createAssetContentKey(AssetInfo asset, byte[] aesKey) throws Exception { + if (aesKey == null) { + return null; + } + + String protectionKeyId = service.action(ProtectionKey.getProtectionKeyId(ContentKeyType.StorageEncryption)); + String protectionKey = service.action(ProtectionKey.getProtectionKey(protectionKeyId)); + + String contentKeyIdUuid = UUID.randomUUID().toString(); + String contentKeyId = "nb:kid:UUID:" + contentKeyIdUuid; + + byte[] encryptedContentKey = EncryptionHelper.encryptSymmetricKey(protectionKey, aesKey); + String encryptedContentKeyString = Base64.encode(encryptedContentKey); + String checksum = EncryptionHelper.calculateContentKeyChecksum(contentKeyIdUuid, aesKey); + + service.create(ContentKey.create(contentKeyId, ContentKeyType.StorageEncryption, encryptedContentKeyString) + .setChecksum(checksum).setProtectionKeyId(protectionKeyId)); + service.action(Asset.linkContentKey(asset.getId(), contentKeyId)); + return contentKeyId; + } + + private static class CountingStream extends InputStream { + private final InputStream wrappedStream; + private long count; + + public CountingStream(InputStream wrapped) { + wrappedStream = wrapped; + count = 0; + } + + @Override + public int read() throws IOException { + count++; + return wrappedStream.read(); + } + + public long getCount() { + return count; + } + } + + // Process + public JobInfo createJob(String jobName, AssetInfo inputAsset, Task.CreateBatchOperation task) + throws ServiceException { + List<Task.CreateBatchOperation> tasks = new ArrayList<Task.CreateBatchOperation>(); + tasks.add(task); + return createJob(jobName, inputAsset, tasks); + } + + public JobInfo createJob(String jobName, AssetInfo inputAsset, List<Task.CreateBatchOperation> tasks) + throws ServiceException { + Creator jobCreator = Job.create().setName(jobName).addInputMediaAsset(inputAsset.getId()).setPriority(2); + + for (Task.CreateBatchOperation task : tasks) { + jobCreator.addTaskCreator(task); + } + + return service.create(jobCreator); + } + + // Process + public Task.CreateBatchOperation createTaskOptions(String taskName, int inputAssetId, int outputAssetId, + EncoderType encoderType) throws ServiceException { + String taskBody = getTaskBody(inputAssetId, outputAssetId); + + String processor = null; + String configuration = null; + switch (encoderType) { + case WindowsAzureMediaEncoder: + processor = getMediaProcessorIdByName(MEDIA_PROCESSOR_WINDOWS_AZURE_MEDIA_ENCODER, "2.2.0.0"); + // Full list of configurations strings for version 2.1 is at: + // http://msdn.microsoft.com/en-us/library/jj129582.aspx + configuration = "VC1 Broadband SD 4x3"; + break; + case StorageDecryption: + processor = getMediaProcessorIdByName(MEDIA_PROCESSOR_STORAGE_DECRYPTION, "1.5.3"); + configuration = null; + break; + default: + break; + } + + Task.CreateBatchOperation taskCreate = Task.create(processor, taskBody).setName(taskName) + .setConfiguration(configuration); + + return taskCreate; + } + + private String getTaskBody(int inputAssetId, int outputAssetId) { + return "<taskBody><inputAsset>JobInputAsset(" + inputAssetId + ")</inputAsset>" + + "<outputAsset>JobOutputAsset(" + outputAssetId + ")</outputAsset></taskBody>"; + } + + private String getMediaProcessorIdByName(String processorName, String version) throws ServiceException { + EntityListOperation<MediaProcessorInfo> operation = MediaProcessor.list(); + operation.getQueryParameters().putSingle("$filter", + "(Name eq '" + processorName + "') and (Version eq '" + version + "')"); + MediaProcessorInfo processor = service.list(operation).get(0); + return processor.getId(); + } + + // Process + public boolean isJobFinished(JobInfo initialJobInfo) throws ServiceException { + JobInfo currentJob = service.get(Job.get(initialJobInfo.getId())); + System.out.println(currentJob.getState()); + switch (currentJob.getState()) { + case Finished: + case Canceled: + case Error: + return true; + default: + return false; + } + } + + public List<AssetInfo> getJobOutputMediaAssets(JobInfo job) throws ServiceException { + return service.list(Asset.list(job.getOutputAssetsLink())); + } + + // Process + public void cancelJob(JobInfo job) throws ServiceException { + // Use the service function + service.action(Job.cancel(job.getId())); + } + + // Deliver + private Hashtable<String, URL> createFileURLsFromAsset(AssetInfo asset, int availabilityWindowInMinutes) + throws ServiceException, MalformedURLException { + Hashtable<String, URL> ret = new Hashtable<String, URL>(); + + AccessPolicyInfo readAP = service.create(AccessPolicy.create(accessPolicyPrefix + "tempAccessPolicy", + availabilityWindowInMinutes, EnumSet.of(AccessPolicyPermission.READ))); + LocatorInfo readLocator = service.create(Locator.create(readAP.getId(), asset.getId(), LocatorType.SAS)); + + List<AssetFileInfo> publishedFiles = service.list(AssetFile.list(asset.getAssetFilesLink())); + for (AssetFileInfo fi : publishedFiles) { + ret.put(fi.getName(), + new URL(readLocator.getBaseUri() + "/" + fi.getName() + readLocator.getContentAccessToken())); + } + + return ret; + } + + // Deliver + public Hashtable<String, InputStream> downloadFilesFromAsset(AssetInfo asset, int downloadWindowInMinutes) + throws Exception { + Hashtable<String, URL> urls = createFileURLsFromAsset(asset, downloadWindowInMinutes); + Hashtable<String, InputStream> ret = new Hashtable<String, InputStream>(); + + for (String fileName : urls.keySet()) { + URL url = urls.get(fileName); + InputStream stream = getInputStreamWithRetry(url); + ret.put(fileName, stream); + } + + return ret; + } + + // This method is needed because there can be a delay before a new read locator + // is applied for the asset files. + private InputStream getInputStreamWithRetry(URL file) throws IOException, InterruptedException { + InputStream reader = null; + for (int counter = 0; true; counter++) { + try { + reader = file.openConnection().getInputStream(); + break; + } + catch (IOException e) { + System.out.println("Got error, wait a bit and try again"); + if (counter < 6) { + Thread.sleep(10000); + } + else { + // No more retries. + throw e; + } + } + } + + return reader; + } + + public void removeAllAssetsWithPrefix(String assetPrefix) throws ServiceException { + ListResult<LocatorInfo> locators = service.list(Locator.list()); + EntityListOperation<AssetInfo> operation = Asset.list(); + operation.getQueryParameters().add("$filter", "startswith(Name,'" + assetPrefix + "')"); + List<AssetInfo> assets = service.list(operation); + for (AssetInfo asset : assets) { + if (asset.getName().length() > assetPrefix.length() + && asset.getName().substring(0, assetPrefix.length()).equals(assetPrefix)) { + for (LocatorInfo locator : locators) { + if (locator.getAssetId().equals(asset.getId())) { + try { + service.delete(Locator.delete(locator.getId())); + } + catch (ServiceException e) { + // Don't worry if cannot delete now. + // Might be held on to by a running job + } + } + } + + try { + service.delete(Asset.delete(asset.getId())); + } + catch (ServiceException e) { + // Don't worry if cannot delete now. + // Might be held on to by a running job + } + } + } + } + + public void removeAllAccessPoliciesWithPrefix() throws ServiceException { + List<AccessPolicyInfo> accessPolicies = service.list(AccessPolicy.list()); + for (AccessPolicyInfo accessPolicy : accessPolicies) { + if (accessPolicy.getName().length() > accessPolicyPrefix.length() + && accessPolicy.getName().substring(0, accessPolicyPrefix.length()).equals(accessPolicyPrefix)) { + try { + service.delete(AccessPolicy.delete(accessPolicy.getId())); + } + catch (ServiceException e) { + // Don't worry if cannot delete now. + // Might be held on to by a running job + } + } + } + } + + private static class EncryptionHelper { + public static boolean canUseStrongCrypto() { + try { + Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding"); + SecretKeySpec secretKeySpec = new SecretKeySpec(new byte[32], "AES"); + cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec); + } + catch (Exception e) { + return false; + } + return true; + } + + public static byte[] encryptSymmetricKey(String protectionKey, byte[] inputData) throws Exception { + Cipher cipher = Cipher.getInstance("RSA/ECB/OAEPWithSHA-1AndMGF1Padding"); + CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); + byte[] protectionKeyBytes = Base64.decode(protectionKey); + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(protectionKeyBytes); + Certificate certificate = certificateFactory.generateCertificate(byteArrayInputStream); + Key publicKey = certificate.getPublicKey(); + SecureRandom secureRandom = new SecureRandom(); + cipher.init(Cipher.ENCRYPT_MODE, publicKey, secureRandom); + byte[] cipherText = cipher.doFinal(inputData); + return cipherText; + } + + public static String calculateContentKeyChecksum(String uuid, byte[] aesKey) throws Exception { + Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding"); + SecretKeySpec secretKeySpec = new SecretKeySpec(aesKey, "AES"); + cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec); + byte[] encryptionResult = cipher.doFinal(uuid.getBytes("UTF8")); + byte[] checksumByteArray = new byte[8]; + System.arraycopy(encryptionResult, 0, checksumByteArray, 0, 8); + String checksum = Base64.encode(checksumByteArray); + return checksum; + } + + public static InputStream encryptFile(InputStream inputStream, byte[] key, byte[] iv) throws Exception { + Cipher cipher = Cipher.getInstance("AES/CTR/NoPadding"); + SecretKeySpec keySpec = new SecretKeySpec(key, "AES"); + IvParameterSpec ivParameterSpec = new IvParameterSpec(iv); + cipher.init(Cipher.ENCRYPT_MODE, keySpec, ivParameterSpec); + CipherInputStream cipherInputStream = new CipherInputStream(inputStream, cipher); + return cipherInputStream; + } + } + +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/scenarios/ScenarioTestBase.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/scenarios/ScenarioTestBase.java new file mode 100644 index 000000000000..ee4c89e66270 --- /dev/null +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/scenarios/ScenarioTestBase.java @@ -0,0 +1,122 @@ +/** + * 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.scenarios; + +import static org.junit.Assert.*; + +import org.junit.Rule; +import org.junit.rules.MethodRule; +import org.junit.runners.model.FrameworkMethod; +import org.junit.runners.model.Statement; + +import com.microsoft.windowsazure.services.blob.BlobConfiguration; +import com.microsoft.windowsazure.services.core.Configuration; +import com.microsoft.windowsazure.services.media.MediaConfiguration; +import com.microsoft.windowsazure.services.queue.QueueConfiguration; +import com.microsoft.windowsazure.services.serviceBus.ServiceBusConfiguration; +import com.microsoft.windowsazure.services.table.TableConfiguration; + +@SuppressWarnings("deprecation") +public abstract class ScenarioTestBase { + protected static Configuration config; + + @Rule + public SetupManager setupManager = new SetupManager(); + + protected static void initializeConfig() { + config = new Configuration(); + + overrideWithEnv(config, BlobConfiguration.ACCOUNT_NAME); + overrideWithEnv(config, BlobConfiguration.ACCOUNT_KEY); + overrideWithEnv(config, BlobConfiguration.URI); + + overrideWithEnv(config, QueueConfiguration.ACCOUNT_NAME); + overrideWithEnv(config, QueueConfiguration.ACCOUNT_KEY); + overrideWithEnv(config, QueueConfiguration.URI); + + overrideWithEnv(config, TableConfiguration.ACCOUNT_NAME); + overrideWithEnv(config, TableConfiguration.ACCOUNT_KEY); + overrideWithEnv(config, TableConfiguration.URI); + + overrideWithEnv(config, ServiceBusConfiguration.URI); + overrideWithEnv(config, ServiceBusConfiguration.WRAP_URI); + overrideWithEnv(config, ServiceBusConfiguration.WRAP_NAME); + overrideWithEnv(config, ServiceBusConfiguration.WRAP_PASSWORD); + + overrideWithEnv(config, MediaConfiguration.URI); + overrideWithEnv(config, MediaConfiguration.OAUTH_URI); + overrideWithEnv(config, MediaConfiguration.OAUTH_CLIENT_ID); + overrideWithEnv(config, MediaConfiguration.OAUTH_CLIENT_SECRET); + overrideWithEnv(config, MediaConfiguration.OAUTH_SCOPE); + } + + private static void overrideWithEnv(Configuration config, String key) { + String value = System.getenv(key); + if (value == null) + return; + + config.setProperty(key, value); + } + + protected void signalSetupStarting() { + setupManager.startSetup(); + } + + protected void signalSetupFinished() { + setupManager.endSetup(); + } + + protected class SetupManager implements MethodRule { + private boolean shouldCapture; + + @Override + public Statement apply(Statement base, FrameworkMethod method, Object target) { + return new SetupManagerStatement(base); + } + + public void startSetup() { + this.shouldCapture = true; + } + + public void endSetup() { + this.shouldCapture = false; + } + + private class SetupManagerStatement extends Statement { + private final Statement next; + + public SetupManagerStatement(Statement base) { + next = base; + } + + @Override + public void evaluate() throws Throwable { + try { + next.evaluate(); + } + catch (Throwable e) { + if (shouldCapture) { + e.printStackTrace(); + fail("Error occured during setup: " + e.getMessage()); + } + else { + throw e; + } + } + } + } + } +} diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/BrokerPropertiesMapperTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/BrokerPropertiesMapperTest.java index 0efb1b72e03d..cef5f5f3b42b 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/BrokerPropertiesMapperTest.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/BrokerPropertiesMapperTest.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/IntegrationTestBase.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/IntegrationTestBase.java index 13956e3de931..1d57ed6fbb81 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/IntegrationTestBase.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/IntegrationTestBase.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusConfigurationTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusConfigurationTest.java index 70c3f97963a0..2bffd260cf64 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusConfigurationTest.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusConfigurationTest.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusCreationTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusCreationTest.java index ca6c0ebed64e..9cc4d707c900 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusCreationTest.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusCreationTest.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusIntegrationTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusIntegrationTest.java index 9a53628503e4..bd86d9b7abf9 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusIntegrationTest.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/ServiceBusIntegrationTest.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/implementation/CustomPropertiesMapperTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/implementation/CustomPropertiesMapperTest.java index 6366937c63bf..2ab3572c34db 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/implementation/CustomPropertiesMapperTest.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/implementation/CustomPropertiesMapperTest.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/implementation/WrapRestProxyIntegrationTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/implementation/WrapRestProxyIntegrationTest.java index 154ab259ff2c..016de94febc6 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/implementation/WrapRestProxyIntegrationTest.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/implementation/WrapRestProxyIntegrationTest.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/implementation/WrapTokenManagerIntegrationTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/implementation/WrapTokenManagerIntegrationTest.java index 1b49d7af4765..3eb2fd952a7a 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/implementation/WrapTokenManagerIntegrationTest.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/implementation/WrapTokenManagerIntegrationTest.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/implementation/WrapTokenManagerTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/implementation/WrapTokenManagerTest.java index 58536f5a41a7..11d2abfbd9bd 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/implementation/WrapTokenManagerTest.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/serviceBus/implementation/WrapTokenManagerTest.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/IntegrationTestBase.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/IntegrationTestBase.java index 8b7b18382d59..94030b5188cf 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/IntegrationTestBase.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/IntegrationTestBase.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/TableServiceIntegrationTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/TableServiceIntegrationTest.java index 74fdd4d91149..485c239890a3 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/TableServiceIntegrationTest.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/TableServiceIntegrationTest.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/client/TableBatchOperationTests.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/client/TableBatchOperationTests.java index cab99fc44c30..55c230921a3f 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/client/TableBatchOperationTests.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/client/TableBatchOperationTests.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/client/TableClientTests.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/client/TableClientTests.java index bbb63de1d514..3f9bf6fa9a75 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/client/TableClientTests.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/client/TableClientTests.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/client/TableEscapingTests.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/client/TableEscapingTests.java index 3926fd49aea6..c09011a90825 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/client/TableEscapingTests.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/client/TableEscapingTests.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/client/TableOperationTests.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/client/TableOperationTests.java index 10a6b4734e3a..3421fcbe2b6f 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/client/TableOperationTests.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/client/TableOperationTests.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/client/TableQueryTests.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/client/TableQueryTests.java index 75740c9fff23..7bec262714c0 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/client/TableQueryTests.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/client/TableQueryTests.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/client/TableSerializerTests.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/client/TableSerializerTests.java index e3d19000d748..9370879504af 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/client/TableSerializerTests.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/client/TableSerializerTests.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/client/TableTestBase.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/client/TableTestBase.java index 7ba57b75322c..b5c68c6df876 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/client/TableTestBase.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/client/TableTestBase.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/implementation/AtomReaderWriterTests.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/implementation/AtomReaderWriterTests.java index aa14a71f8597..17578984f68c 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/implementation/AtomReaderWriterTests.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/implementation/AtomReaderWriterTests.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/implementation/MimeMultipartTests.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/implementation/MimeMultipartTests.java index c01fdeaebc3c..13f20b528b5b 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/implementation/MimeMultipartTests.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/services/table/implementation/MimeMultipartTests.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/utils/ServiceExceptionFactoryTest.java b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/utils/ServiceExceptionFactoryTest.java index 54c5b84aab75..6245cedfce67 100644 --- a/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/utils/ServiceExceptionFactoryTest.java +++ b/microsoft-azure-api/src/test/java/com/microsoft/windowsazure/utils/ServiceExceptionFactoryTest.java @@ -1,5 +1,5 @@ /** - * Copyright 2011 Microsoft Corporation + * 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. diff --git a/microsoft-azure-api/src/test/resources/META-INF/com.microsoft.windowsazure.properties b/microsoft-azure-api/src/test/resources/META-INF/com.microsoft.windowsazure.properties index 5685b680eab6..1abb40b2238c 100644 --- a/microsoft-azure-api/src/test/resources/META-INF/com.microsoft.windowsazure.properties +++ b/microsoft-azure-api/src/test/resources/META-INF/com.microsoft.windowsazure.properties @@ -11,5 +11,11 @@ queue.uri=http://%QUEUE_ACCOUNTNAME%.queue.core.windows.net table.accountName=%TABLE_ACCOUNTNAME% table.accountKey=%TABLE_ACCOUNTKEY% table.uri=http://%TABLE_ACCOUNTNAME%.table.core.windows.net +media.uri=%MEDIA.URI% +media.oauth.uri=%MEDIA.OAUTH.URI% +media.oauth.client.id=%OMEDIA.AUTH.CLIENT.ID% +media.oauth.client.secret=%MEDIA.OAUTH.CLIENT.SECRET% +media.oauth.scope=urn:WindowsAzureMediaServices testprefix.com.microsoft.windowsazure.services.core.Configuration.connectTimeout=3 testprefix.com.microsoft.windowsazure.services.core.Configuration.readTimeout=7 + diff --git a/microsoft-azure-api/src/test/resources/media/MPEG4-H264.mp4 b/microsoft-azure-api/src/test/resources/media/MPEG4-H264.mp4 new file mode 100644 index 000000000000..54c15e4ec753 Binary files /dev/null and b/microsoft-azure-api/src/test/resources/media/MPEG4-H264.mp4 differ