Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…or-java-pr into release
  • Loading branch information
Albert Cheng committed May 17, 2013
2 parents 2a3347e + d618563 commit f4ae1b8
Show file tree
Hide file tree
Showing 13 changed files with 2,444 additions and 173 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,19 @@ public ListQueuesResult listQueues() throws ServiceException {
}
}

@Override
public QueueInfo updateQueue(QueueInfo queueInfo) throws ServiceException {
try {
return next.updateQueue(queueInfo);
}
catch (UniformInterfaceException e) {
throw processCatch(new ServiceException(e));
}
catch (ClientHandlerException e) {
throw processCatch(new ServiceException(e));
}
}

@Override
public CreateTopicResult createTopic(TopicInfo topic) throws ServiceException {
try {
Expand Down Expand Up @@ -290,6 +303,19 @@ public ListTopicsResult listTopics() throws ServiceException {
}
}

@Override
public TopicInfo updateTopic(TopicInfo topicInfo) throws ServiceException {
try {
return next.updateTopic(topicInfo);
}
catch (UniformInterfaceException e) {
throw processCatch(new ServiceException(e));
}
catch (ClientHandlerException e) {
throw processCatch(new ServiceException(e));
}
}

@Override
public CreateSubscriptionResult createSubscription(String topicPath, SubscriptionInfo subscription)
throws ServiceException {
Expand Down Expand Up @@ -343,6 +369,20 @@ public ListSubscriptionsResult listSubscriptions(String topicPath) throws Servic
}
}

@Override
public SubscriptionInfo updateSubscription(String topicName, SubscriptionInfo subscriptionInfo)
throws ServiceException {
try {
return next.updateSubscription(topicName, subscriptionInfo);
}
catch (UniformInterfaceException e) {
throw processCatch(new ServiceException(e));
}
catch (ClientHandlerException e) {
throw processCatch(new ServiceException(e));
}
}

@Override
public CreateRuleResult createRule(String topicPath, String subscriptionName, RuleInfo rule)
throws ServiceException {
Expand Down Expand Up @@ -489,4 +529,31 @@ public ReceiveMessageResult receiveMessage(String path, ReceiveMessageOptions op
}
}

@Override
public void renewQueueLock(String queueName, String messageId, String lockToken) throws ServiceException {
try {
next.renewQueueLock(queueName, messageId, lockToken);
}
catch (UniformInterfaceException e) {
throw processCatch(new ServiceException(e));
}
catch (ClientHandlerException e) {
throw processCatch(new ServiceException(e));
}
}

@Override
public void renewSubscriptionLock(String topicName, String subscriptionName, String messageId, String lockToken)
throws ServiceException {
try {
next.renewSubscriptionLock(topicName, subscriptionName, messageId, lockToken);
}
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 @@ -30,6 +30,7 @@
import com.microsoft.windowsazure.services.core.ServiceFilter;
import com.microsoft.windowsazure.services.core.UserAgentFilter;
import com.microsoft.windowsazure.services.core.utils.pipeline.ClientFilterAdapter;
import com.microsoft.windowsazure.services.core.utils.pipeline.PipelineHelpers;
import com.microsoft.windowsazure.services.serviceBus.ServiceBusContract;
import com.microsoft.windowsazure.services.serviceBus.models.AbstractListOptions;
import com.microsoft.windowsazure.services.serviceBus.models.BrokeredMessage;
Expand Down Expand Up @@ -109,7 +110,7 @@ public void setChannel(Client channel) {
}

private WebResource getResource() {
WebResource resource = getChannel().resource(uri);
WebResource resource = getChannel().resource(uri).queryParam("api-version", "2012-08");
for (ServiceFilter filter : filters) {
resource.addFilter(new ClientFilterAdapter(filter));
}
Expand Down Expand Up @@ -293,6 +294,12 @@ public ListQueuesResult listQueues(ListQueuesOptions options) throws ServiceExce
return result;
}

@Override
public QueueInfo updateQueue(QueueInfo queueInfo) throws ServiceException {
return getResource().path(queueInfo.getPath()).type("application/atom+xml;type=entry;charset=utf-8")
.header("If-Match", "*").put(QueueInfo.class, queueInfo);
}

private WebResource listOptions(AbstractListOptions<?> options, WebResource path) {
if (options.getTop() != null) {
path = path.queryParam("$top", options.getTop().toString());
Expand Down Expand Up @@ -331,6 +338,12 @@ public ListTopicsResult listTopics(ListTopicsOptions options) throws ServiceExce
return result;
}

@Override
public TopicInfo updateTopic(TopicInfo topicInfo) throws ServiceException {
return getResource().path(topicInfo.getPath()).type("application/atom+xml;type=entry;charset=utf-8")
.header("If-Match", "*").put(TopicInfo.class, topicInfo);
}

@Override
public CreateSubscriptionResult createSubscription(String topicPath, SubscriptionInfo subscription) {
return new CreateSubscriptionResult(getResource().path(topicPath).path("subscriptions")
Expand Down Expand Up @@ -361,6 +374,14 @@ public ListSubscriptionsResult listSubscriptions(String topicPath, ListSubscript
return result;
}

@Override
public SubscriptionInfo updateSubscription(String topicName, SubscriptionInfo subscriptionInfo)
throws ServiceException {
return getResource().path(topicName).path("subscriptions").path(subscriptionInfo.getName())
.type("application/atom+xml;type=entry;charset=utf-8").header("If-Match", "*")
.put(SubscriptionInfo.class, subscriptionInfo);
}

@Override
public CreateRuleResult createRule(String topicPath, String subscriptionName, RuleInfo rule) {
return new CreateRuleResult(getResource().path(topicPath).path("subscriptions").path(subscriptionName)
Expand Down Expand Up @@ -414,4 +435,19 @@ public ListRulesResult listRules(String topicName, String subscriptionName) thro
return listRules(topicName, subscriptionName, ListRulesOptions.DEFAULT);
}

@Override
public void renewQueueLock(String queueName, String messageId, String lockToken) throws ServiceException {
ClientResponse clientResponse = getResource().path(queueName).path("messages").path(messageId).path(lockToken)
.post(ClientResponse.class, "");
PipelineHelpers.ThrowIfNotSuccess(clientResponse);
}

@Override
public void renewSubscriptionLock(String topicName, String subscriptionName, String messageId, String lockToken)
throws ServiceException {
ClientResponse clientResponse = getResource().path(topicName).path("Subscriptions").path(subscriptionName)
.path("messages").path(messageId).path(lockToken).post(ClientResponse.class, "");
PipelineHelpers.ThrowIfNotSuccess(clientResponse);
}

}
Loading

0 comments on commit f4ae1b8

Please sign in to comment.