Skip to content

Commit

Permalink
Merge pull request #4 from jcookems/fix359
Browse files Browse the repository at this point in the history
Use <typeName>[Id|Name] for parameter names in MediaContract
Fixes Azure#359
  • Loading branch information
jcookems committed Oct 17, 2012
2 parents d714960 + ff35aaa commit 08487af
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,20 +113,20 @@ public interface MediaContract extends FilterableService<MediaContract> {
/**
* Create the access policy.
*
* @param name
* @param accessPolicyName
* name of access policy
* @param durationInMinutes
* Duration in minutes that blob access will be granted when using this access policy
* @return Created access policy
* @throws ServiceException
* the service exception
*/
AccessPolicyInfo createAccessPolicy(String name, double durationInMinutes) throws ServiceException;
AccessPolicyInfo createAccessPolicy(String accessPolicyName, double durationInMinutes) throws ServiceException;

/**
* Create the access policy with the given options.
*
* @param name
* @param accessPolicyName
* name of access policy
* @param durationInMinutes
* Duration in minutes that blob access will be granted when using this access policy
Expand All @@ -136,29 +136,29 @@ public interface MediaContract extends FilterableService<MediaContract> {
* @throws ServiceException
* the service exception
*/
AccessPolicyInfo createAccessPolicy(String name, double durationInMinutes, CreateAccessPolicyOptions options)
throws ServiceException;
AccessPolicyInfo createAccessPolicy(String accessPolicyName, double durationInMinutes,
CreateAccessPolicyOptions options) throws ServiceException;

/**
* Delete the access policy with the given id.
*
* @param id
* @param accessPolicyId
* of access policy to delete
* @throws ServiceException
* the service exception
*/
void deleteAccessPolicy(String id) throws ServiceException;
void deleteAccessPolicy(String accessPolicyId) throws ServiceException;

/**
* Get a single access policy.
*
* @param id
* @param accessPolicyId
* the id of the asset to retrieve
* @return the asset
* @throws ServiceException
* the service exception
*/
AccessPolicyInfo getAccessPolicy(String id) throws ServiceException;
AccessPolicyInfo getAccessPolicy(String accessPolicyId) throws ServiceException;

/**
* List access policies.
Expand Down Expand Up @@ -236,14 +236,14 @@ public LocatorInfo createLocator(String accessPolicyId, String assetId, LocatorT
/**
* Delete locator.
*
* @param id
* @param locatorId
* the id
* @throws UniformInterfaceException
* the uniform interface exception
* @throws ServiceException
* the service exception
*/
public void deleteLocator(String id) throws UniformInterfaceException, ServiceException;
public void deleteLocator(String locatorId) throws UniformInterfaceException, ServiceException;

/**
* List locators.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,10 @@ public void updateAsset(String assetId, UpdateAssetOptions updateAssetOptions) t
* @see com.microsoft.windowsazure.services.media.MediaContract#createAccessPolicy(double)
*/
@Override
public AccessPolicyInfo createAccessPolicy(String name, double durationInMinutes) throws ServiceException {
public AccessPolicyInfo createAccessPolicy(String accessPolicyName, double durationInMinutes)
throws ServiceException {
try {
return service.createAccessPolicy(name, durationInMinutes);
return service.createAccessPolicy(accessPolicyName, durationInMinutes);
}
catch (UniformInterfaceException e) {
throw processCatch(new ServiceException(e));
Expand All @@ -228,10 +229,10 @@ public AccessPolicyInfo createAccessPolicy(String name, double durationInMinutes
* @see com.microsoft.windowsazure.services.media.MediaContract#createAccessPolicy(double, com.microsoft.windowsazure.services.media.models.CreateAccessPolicyOptions)
*/
@Override
public AccessPolicyInfo createAccessPolicy(String name, double durationInMinutes, CreateAccessPolicyOptions options)
throws ServiceException {
public AccessPolicyInfo createAccessPolicy(String accessPolicyName, double durationInMinutes,
CreateAccessPolicyOptions options) throws ServiceException {
try {
return service.createAccessPolicy(name, durationInMinutes, options);
return service.createAccessPolicy(accessPolicyName, durationInMinutes, options);
}
catch (UniformInterfaceException e) {
throw processCatch(new ServiceException(e));
Expand Down Expand Up @@ -261,9 +262,9 @@ public List<AccessPolicyInfo> listAccessPolicies() throws ServiceException {
* @see com.microsoft.windowsazure.services.media.MediaContract#deleteAccessPolicy(java.lang.String)
*/
@Override
public void deleteAccessPolicy(String id) throws ServiceException {
public void deleteAccessPolicy(String accessPolicyId) throws ServiceException {
try {
service.deleteAccessPolicy(id);
service.deleteAccessPolicy(accessPolicyId);
}
catch (UniformInterfaceException e) {
throw processCatch(new ServiceException(e));
Expand All @@ -277,9 +278,9 @@ public void deleteAccessPolicy(String id) throws ServiceException {
* @see com.microsoft.windowsazure.services.media.MediaContract#getAccessPolicy(java.lang.String)
*/
@Override
public AccessPolicyInfo getAccessPolicy(String id) throws ServiceException {
public AccessPolicyInfo getAccessPolicy(String accessPolicyId) throws ServiceException {
try {
return service.getAccessPolicy(id);
return service.getAccessPolicy(accessPolicyId);
}
catch (UniformInterfaceException e) {
throw processCatch(new ServiceException(e));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,22 +291,24 @@ public void deleteAsset(String assetId) throws ServiceException {
* @see com.microsoft.windowsazure.services.media.MediaContract#createAccessPolicy(double)
*/
@Override
public AccessPolicyInfo createAccessPolicy(String name, double durationInMinutes) throws ServiceException {
return createAccessPolicy(name, durationInMinutes, null);
public AccessPolicyInfo createAccessPolicy(String accessPolicyName, double durationInMinutes)
throws ServiceException {
return createAccessPolicy(accessPolicyName, durationInMinutes, null);
}

/* (non-Javadoc)
* @see com.microsoft.windowsazure.services.media.MediaContract#createAccessPolicy(double, com.microsoft.windowsazure.services.media.models.CreateAccessPolicyOptions)
*/
@Override
public AccessPolicyInfo createAccessPolicy(String name, double durationInMinutes, CreateAccessPolicyOptions options)
throws ServiceException {
public AccessPolicyInfo createAccessPolicy(String accessPolicyName, double durationInMinutes,
CreateAccessPolicyOptions options) throws ServiceException {

if (options == null) {
options = new CreateAccessPolicyOptions().addPermissions(EnumSet.of(AccessPolicyPermission.WRITE));
}

AccessPolicyType requestData = new AccessPolicyType().setDurationInMinutes(durationInMinutes).setName(name)
AccessPolicyType requestData = new AccessPolicyType().setDurationInMinutes(durationInMinutes)
.setName(accessPolicyName)
.setPermissions(AccessPolicyPermission.bitsFromPermissions(options.getPermissions()));

WebResource resource = getResource("AccessPolicies");
Expand All @@ -319,8 +321,8 @@ public AccessPolicyInfo createAccessPolicy(String name, double durationInMinutes
* @see com.microsoft.windowsazure.services.media.MediaContract#getAccessPolicy(java.lang.String)
*/
@Override
public AccessPolicyInfo getAccessPolicy(String id) throws ServiceException {
WebResource resource = getResource("AccessPolicies", id);
public AccessPolicyInfo getAccessPolicy(String accessPolicyId) throws ServiceException {
WebResource resource = getResource("AccessPolicies", accessPolicyId);
return resource.type(MediaType.APPLICATION_ATOM_XML).accept(MediaType.APPLICATION_ATOM_XML)
.get(AccessPolicyInfo.class);
}
Expand All @@ -329,8 +331,8 @@ public AccessPolicyInfo getAccessPolicy(String id) throws ServiceException {
* @see com.microsoft.windowsazure.services.media.MediaContract#deleteAccessPolicy(java.lang.String)
*/
@Override
public void deleteAccessPolicy(String id) throws ServiceException {
getResource("AccessPolicies", id).delete();
public void deleteAccessPolicy(String accessPolicyId) throws ServiceException {
getResource("AccessPolicies", accessPolicyId).delete();
}

/* (non-Javadoc)
Expand Down

0 comments on commit 08487af

Please sign in to comment.