Skip to content

Commit

Permalink
List media processor
Browse files Browse the repository at this point in the history
  • Loading branch information
Albert Cheng committed Oct 16, 2012
1 parent 52b13cc commit 0862d5f
Show file tree
Hide file tree
Showing 12 changed files with 602 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import com.microsoft.windowsazure.services.media.models.ListAssetsOptions;
import com.microsoft.windowsazure.services.media.models.ListLocatorsOptions;
import com.microsoft.windowsazure.services.media.models.ListLocatorsResult;
import com.microsoft.windowsazure.services.media.models.ListMediaProcessorsOptions;
import com.microsoft.windowsazure.services.media.models.ListMediaProcessorsResult;
import com.microsoft.windowsazure.services.media.models.LocatorInfo;
import com.microsoft.windowsazure.services.media.models.LocatorType;
import com.microsoft.windowsazure.services.media.models.UpdateAssetOptions;
Expand All @@ -43,6 +45,7 @@ public interface MediaContract extends FilterableService<MediaContract> {
*
* @return the asset info
* @throws ServiceException
* the service exception
*/
public AssetInfo createAsset() throws ServiceException;

Expand Down Expand Up @@ -191,6 +194,7 @@ AccessPolicyInfo createAccessPolicy(String name, double durationInMinutes, Creat
* the locator type
* @return the locator info
* @throws ServiceException
* the service exception
*/
public LocatorInfo createLocator(String accessPolicyId, String assetId, LocatorType locatorType)
throws ServiceException;
Expand Down Expand Up @@ -268,4 +272,25 @@ public LocatorInfo createLocator(String accessPolicyId, String assetId, LocatorT
*/
public void updateLocator(String locatorId, UpdateLocatorOptions updateLocatorOptions) throws ServiceException;

/**
* List media processors.
*
* @return the list media processors result
* @throws ServiceException
* the service exception
*/
public ListMediaProcessorsResult listMediaProcessors() throws ServiceException;

/**
* List media processors.
*
* @param listMediaProcessorsOptions
* the list media processors options
* @return the list media processors result
* @throws ServiceException
* the service exception
*/
public ListMediaProcessorsResult listMediaProcessors(ListMediaProcessorsOptions listMediaProcessorsOptions)
throws ServiceException;

}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
import com.microsoft.windowsazure.services.media.models.ListAssetsOptions;
import com.microsoft.windowsazure.services.media.models.ListLocatorsOptions;
import com.microsoft.windowsazure.services.media.models.ListLocatorsResult;
import com.microsoft.windowsazure.services.media.models.ListMediaProcessorsOptions;
import com.microsoft.windowsazure.services.media.models.ListMediaProcessorsResult;
import com.microsoft.windowsazure.services.media.models.LocatorInfo;
import com.microsoft.windowsazure.services.media.models.LocatorType;
import com.microsoft.windowsazure.services.media.models.UpdateAssetOptions;
Expand Down Expand Up @@ -418,4 +420,32 @@ public LocatorInfo createLocator(String accessPolicyId, String assetId, LocatorT
throw processCatch(new ServiceException(e));
}
}

@Override
public ListMediaProcessorsResult listMediaProcessors() throws ServiceException {
try {
return service.listMediaProcessors();
}
catch (UniformInterfaceException e) {
throw processCatch(new ServiceException(e));
}
catch (ClientHandlerException e) {
throw processCatch(new ServiceException(e));
}
}

@Override
public ListMediaProcessorsResult listMediaProcessors(ListMediaProcessorsOptions listMediaProcessorsOptions)
throws ServiceException {
try {
return service.listMediaProcessors(listMediaProcessorsOptions);
}
catch (UniformInterfaceException e) {
throw processCatch(new ServiceException(e));
}
catch (ClientHandlerException e) {
throw processCatch(new ServiceException(e));
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,11 @@
import com.microsoft.windowsazure.services.media.models.ListAssetsOptions;
import com.microsoft.windowsazure.services.media.models.ListLocatorsOptions;
import com.microsoft.windowsazure.services.media.models.ListLocatorsResult;
import com.microsoft.windowsazure.services.media.models.ListMediaProcessorsOptions;
import com.microsoft.windowsazure.services.media.models.ListMediaProcessorsResult;
import com.microsoft.windowsazure.services.media.models.LocatorInfo;
import com.microsoft.windowsazure.services.media.models.LocatorType;
import com.microsoft.windowsazure.services.media.models.MediaProcessorInfo;
import com.microsoft.windowsazure.services.media.models.UpdateAssetOptions;
import com.microsoft.windowsazure.services.media.models.UpdateLocatorOptions;
import com.sun.jersey.api.client.Client;
Expand Down Expand Up @@ -448,4 +451,21 @@ public void updateLocator(String locatorId, UpdateLocatorOptions updateLocatorOp
PipelineHelpers.ThrowIfNotSuccess(clientResponse);
}

@Override
public ListMediaProcessorsResult listMediaProcessors() {
return this.listMediaProcessors(null);
}

@Override
public ListMediaProcessorsResult listMediaProcessors(ListMediaProcessorsOptions listMediaProcessorsOptions) {
WebResource resource = getResource("MediaProcessors");

List<MediaProcessorInfo> mediaProcessorInfoList = resource.type(MediaType.APPLICATION_ATOM_XML)
.accept(MediaType.APPLICATION_ATOM_XML).get(new GenericType<List<MediaProcessorInfo>>() {
});
ListMediaProcessorsResult listMediaProcessorsResult = new ListMediaProcessorsResult();
listMediaProcessorsResult.setMediaProcessorInfos(mediaProcessorInfoList);
return listMediaProcessorsResult;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
/**
* Copyright 2012 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 void setId(String id) {
this.id = id;
}

/**
* @return the name
*/
public String getName() {
return name;
}

/**
* @param name
* the name to set
*/
public void setName(String name) {
this.name = name;
}

public String getDescription() {
return this.description;
}

public void setDescription(String description) {
this.description = description;
}

public String getSku() {
return this.sku;
}

public void setSku(String sku) {
this.sku = sku;
}

public String getVendor() {
return vendor;
}

public void setVendor(String vendor) {
this.vendor = vendor;
}

public String getVersion() {
return null;
}

public void setVersion(String version) {
this.version = version;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,13 @@ public AccessPolicyType createAccessPolicyType() {
public LocatorRestType createLocatorRestType() {
return new LocatorRestType();
}

/**
* Create an instance of {@link MediaProcessorType }
*
* @return a new MediaProcessorType instance.
*/
public MediaProcessorType createMediaProcessorType() {
return new MediaProcessorType();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@

public class ListAssetsOptions {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* Copyright 2012 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 ListLocatorsOptions.
*/
public class ListMediaProcessorsOptions {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* 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.
*/
package com.microsoft.windowsazure.services.media.models;

import java.util.List;

/**
* The Class ListMediaProcessorsResult.
*/
public class ListMediaProcessorsResult {

/** The media processor infos. */
private List<MediaProcessorInfo> mediaProcessorInfos;

/**
* Gets the media processor infos.
*
* @return the media processor infos
*/
public List<MediaProcessorInfo> getMediaProcessorInfos() {
return mediaProcessorInfos;
}

/**
* Sets the media processor infos.
*
* @param mediaProcessorInfos
* the media processor infos
* @return the list media processor result
*/
public ListMediaProcessorsResult setMediaProcessorInfos(List<MediaProcessorInfo> mediaProcessorInfos) {
this.mediaProcessorInfos = mediaProcessorInfos;
return this;
}

}
Loading

0 comments on commit 0862d5f

Please sign in to comment.