Skip to content
This repository has been archived by the owner on Apr 5, 2022. It is now read-only.

Commit

Permalink
Merge pull request #92 from habuma/master
Browse files Browse the repository at this point in the history
SOCIAL-328: Initial cut of ReconnectFilter
  • Loading branch information
habuma committed Feb 20, 2013
2 parents 3815934 + 0b79edf commit 5999f22
Show file tree
Hide file tree
Showing 20 changed files with 497 additions and 39 deletions.
Expand Up @@ -22,12 +22,22 @@
@SuppressWarnings("serial")
public class ApiException extends SocialException {

public ApiException(String message) {
private String providerId;

public ApiException(String providerId, String message) {
super(message);
this.providerId = providerId;
}

public ApiException(String message, Throwable cause) {
public ApiException(String providerId, String message, Throwable cause) {
super(message, cause);
}

/**
* The ID of the provider for which the API exception occurred.
*/
public String getProviderId() {
return providerId;
}

}
Expand Up @@ -24,8 +24,8 @@
public class DuplicateStatusException extends OperationNotPermittedException {
private static final long serialVersionUID = 1L;

public DuplicateStatusException(String message) {
super(message);
public DuplicateStatusException(String providerId, String message) {
super(providerId, message);
}

}
Expand Up @@ -22,8 +22,8 @@
@SuppressWarnings("serial")
public class ExpiredAuthorizationException extends RejectedAuthorizationException {

public ExpiredAuthorizationException() {
super("The authorization has expired.");
public ExpiredAuthorizationException(String providerId) {
super(providerId, "The authorization has expired.");
}

}
Expand Up @@ -25,13 +25,13 @@ public class InsufficientPermissionException extends OperationNotPermittedExcept

private final String requiredPermission;

public InsufficientPermissionException() {
super("Insufficient permission for this operation.");
public InsufficientPermissionException(String providerId) {
super(providerId, "Insufficient permission for this operation.");
this.requiredPermission = null;
}

public InsufficientPermissionException(String requiredPermission) {
super("The operation requires '" + requiredPermission + "' permission.");
public InsufficientPermissionException(String providerId, String requiredPermission) {
super(providerId, "The operation requires '" + requiredPermission + "' permission.");
this.requiredPermission = requiredPermission;
}

Expand Down
Expand Up @@ -22,8 +22,8 @@
@SuppressWarnings("serial")
public class InternalServerErrorException extends ServerException {

public InternalServerErrorException(String message) {
super(message);
public InternalServerErrorException(String providerId, String message) {
super(providerId, message);
}

}
Expand Up @@ -23,8 +23,8 @@
@SuppressWarnings("serial")
public class InvalidAuthorizationException extends RejectedAuthorizationException {

public InvalidAuthorizationException(String message) {
super(message);
public InvalidAuthorizationException(String providerId, String message) {
super(providerId, message);
}

}
Expand Up @@ -22,8 +22,8 @@
@SuppressWarnings("serial")
public class MissingAuthorizationException extends NotAuthorizedException {

public MissingAuthorizationException() {
super("Authorization is required for the operation, but the API binding was created without authorization.");
public MissingAuthorizationException(String providerId) {
super(providerId, "Authorization is required for the operation, but the API binding was created without authorization.");
}

}
Expand Up @@ -25,8 +25,8 @@
@SuppressWarnings("serial")
public class NotAuthorizedException extends ApiException {

public NotAuthorizedException(String message) {
super(message);
public NotAuthorizedException(String providerId, String message) {
super(providerId, message);
}

}
Expand Up @@ -22,8 +22,8 @@
@SuppressWarnings("serial")
public class OperationNotPermittedException extends ApiException {

public OperationNotPermittedException(String message) {
super(message);
public OperationNotPermittedException(String providerId, String message) {
super(providerId, message);
}

}
Expand Up @@ -22,8 +22,8 @@
@SuppressWarnings("serial")
public class RateLimitExceededException extends ApiException {

public RateLimitExceededException() {
super("The rate limit has been exceeded.");
public RateLimitExceededException(String providerId) {
super(providerId, "The rate limit has been exceeded.");
}

}
Expand Up @@ -26,8 +26,8 @@
@SuppressWarnings("serial")
public class RejectedAuthorizationException extends NotAuthorizedException {

public RejectedAuthorizationException(String message) {
super(message);
public RejectedAuthorizationException(String providerId, String message) {
super(providerId, message);
}

}
Expand Up @@ -22,8 +22,8 @@
@SuppressWarnings("serial")
public class ResourceNotFoundException extends ApiException {

public ResourceNotFoundException(String message) {
super(message);
public ResourceNotFoundException(String providerId, String message) {
super(providerId, message);
}

}
Expand Up @@ -23,12 +23,12 @@
@SuppressWarnings("serial")
public class RevokedAuthorizationException extends RejectedAuthorizationException {

public RevokedAuthorizationException() {
this("Unknown");
public RevokedAuthorizationException(String providerId) {
this(providerId, "Unknown");
}

public RevokedAuthorizationException(String reason) {
super("The authorization has been revoked. Reason: " + reason);
public RevokedAuthorizationException(String providerId, String reason) {
super(providerId, "The authorization has been revoked. Reason: " + reason);
}

}
Expand Up @@ -22,8 +22,8 @@
@SuppressWarnings("serial")
public class ServerDownException extends ServerException {

public ServerDownException(String message) {
super(message);
public ServerDownException(String providerId, String message) {
super(providerId, message);
}

}
Expand Up @@ -22,8 +22,8 @@
@SuppressWarnings("serial")
public class ServerException extends ApiException {

public ServerException(String message) {
super(message);
public ServerException(String providerId, String message) {
super(providerId, message);
}

}
Expand Up @@ -22,8 +22,8 @@
@SuppressWarnings("serial")
public class ServerOverloadedException extends ServerException {

public ServerOverloadedException(String message) {
super(message);
public ServerOverloadedException(String providerId, String message) {
super(providerId, message);
}

}
Expand Up @@ -22,8 +22,8 @@
@SuppressWarnings("serial")
public class UncategorizedApiException extends ApiException {

public UncategorizedApiException(String message, Throwable cause) {
super(message, cause);
public UncategorizedApiException(String providerId, String message, Throwable cause) {
super(providerId, message, cause);
}

}
Expand Up @@ -145,7 +145,7 @@ private class ApiInvocationHandler implements InvocationHandler {
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
synchronized (getMonitor()) {
if (hasExpired()) {
throw new ExpiredAuthorizationException();
throw new ExpiredAuthorizationException(null); // TODO: Revisit this null as providerId
}
try {
return method.invoke(OAuth2Connection.this.api, args);
Expand Down

0 comments on commit 5999f22

Please sign in to comment.