restructured middleware into hpcloud

This commit is contained in:
Derrick Johnson 2014-06-25 21:40:03 -07:00
parent 3da964eeb9
commit 3f0cd69257
20 changed files with 55 additions and 51 deletions

View File

@ -120,11 +120,6 @@
<artifactId>jsr305</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.hp.csbu.cc</groupId>
<artifactId>CsMiddleware</artifactId>
<version>3.34.0</version>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-recipes</artifactId>

View File

@ -1,4 +1,4 @@
package com.hp.csbu.cc.middleware;
package com.hpcloud.middleware;
import java.util.Map;

View File

@ -1,9 +1,7 @@
package com.hp.csbu.cc.middleware;
package com.hpcloud.middleware;
import org.apache.commons.pool.impl.GenericObjectPool;
//import com.hp.csbu.cc.security.cs.thrift.service.CsThriftService.Client;
/**
* A factory for building {@link AuthClient}s.
*

View File

@ -1,4 +1,4 @@
package com.hp.csbu.cc.middleware;
package com.hpcloud.middleware;
/**
* An exception to indicate any connection issue.

View File

@ -1,4 +1,4 @@
package com.hp.csbu.cc.middleware;
package com.hpcloud.middleware;
public interface AuthConstants {
/** 'Confirmed' or 'Invalid' */

View File

@ -1,4 +1,4 @@
package com.hp.csbu.cc.middleware;
package com.hpcloud.middleware;
/**
* An exception to indicate any authentication error.

View File

@ -1,4 +1,4 @@
package com.hp.csbu.cc.middleware;
package com.hpcloud.middleware;
import java.util.List;

View File

@ -1,4 +1,4 @@
package com.hp.csbu.cc.middleware;
package com.hpcloud.middleware;
import javax.servlet.FilterConfig;
import javax.servlet.ServletContext;

View File

@ -1,4 +1,4 @@
package com.hp.csbu.cc.middleware;
package com.hpcloud.middleware;
public class ExceptionHandlerUtil {

View File

@ -1,22 +1,25 @@
package com.hp.csbu.cc.middleware;
package com.hpcloud.middleware;
import static com.hp.csbu.cc.middleware.AuthConstants.AUTH_DOMAIN_ID;
import static com.hp.csbu.cc.middleware.AuthConstants.AUTH_DOMAIN_NAME;
import static com.hp.csbu.cc.middleware.AuthConstants.AUTH_HP_IDM_ROLES;
import static com.hp.csbu.cc.middleware.AuthConstants.AUTH_IDENTITY_STATUS;
import static com.hp.csbu.cc.middleware.AuthConstants.AUTH_PROJECT_DOMAIN_ID;
import static com.hp.csbu.cc.middleware.AuthConstants.AUTH_PROJECT_DOMAIN_NAME;
import static com.hp.csbu.cc.middleware.AuthConstants.AUTH_PROJECT_ID;
import static com.hp.csbu.cc.middleware.AuthConstants.AUTH_PROJECT_NAME;
import static com.hp.csbu.cc.middleware.AuthConstants.AUTH_ROLES;
import static com.hp.csbu.cc.middleware.AuthConstants.AUTH_SERVICE_CATALOG;
import static com.hp.csbu.cc.middleware.AuthConstants.AUTH_TENANT_NAME;
import static com.hp.csbu.cc.middleware.AuthConstants.AUTH_USER_DOMAIN_ID;
import static com.hp.csbu.cc.middleware.AuthConstants.AUTH_USER_DOMAIN_NAME;
import static com.hp.csbu.cc.middleware.AuthConstants.AUTH_USER_ID;
import static com.hp.csbu.cc.middleware.AuthConstants.AUTH_TENANT_ID;
import static com.hp.csbu.cc.middleware.AuthConstants.AUTH_USER_NAME;
import static com.hp.csbu.cc.middleware.AuthConstants.IdentityStatus;
import static com.hpcloud.middleware.AuthConstants.AUTH_IDENTITY_STATUS;
import static com.hpcloud.middleware.AuthConstants.AUTH_ROLES;
import static com.hpcloud.middleware.AuthConstants.AUTH_TENANT_NAME;
import static com.hpcloud.middleware.AuthConstants.AUTH_USER_ID;
import static com.hpcloud.middleware.AuthConstants.AUTH_DOMAIN_ID;
import static com.hpcloud.middleware.AuthConstants.AUTH_DOMAIN_NAME;
import static com.hpcloud.middleware.AuthConstants.AUTH_PROJECT_ID;
import static com.hpcloud.middleware.AuthConstants.AUTH_PROJECT_NAME;
import static com.hpcloud.middleware.AuthConstants.AUTH_TENANT_ID;
import static com.hpcloud.middleware.AuthConstants.AUTH_USER_NAME;
import static com.hpcloud.middleware.AuthConstants.IdentityStatus;
import static com.hpcloud.middleware.AuthConstants.AUTH_PROJECT_DOMAIN_ID;
import static com.hpcloud.middleware.AuthConstants.AUTH_PROJECT_DOMAIN_NAME;
import static com.hpcloud.middleware.AuthConstants.AUTH_USER_DOMAIN_ID;
import static com.hpcloud.middleware.AuthConstants.AUTH_USER_DOMAIN_NAME;
import static com.hpcloud.middleware.AuthConstants.AUTH_HP_IDM_ROLES;
import static com.hpcloud.middleware.AuthConstants.AUTH_SERVICE_CATALOG;
import java.io.IOException;
import java.lang.reflect.Modifier;

View File

@ -1,7 +1,7 @@
package com.hp.csbu.cc.middleware;
package com.hpcloud.middleware;
import static com.hp.csbu.cc.middleware.AuthConstants.AUTH_SUBJECT_TOKEN;
import static com.hp.csbu.cc.middleware.AuthConstants.TOKEN;
import static com.hpcloud.middleware.AuthConstants.TOKEN;
import static com.hpcloud.middleware.AuthConstants.AUTH_SUBJECT_TOKEN;
import java.io.BufferedReader;
import java.io.IOException;

View File

@ -1,4 +1,4 @@
package com.hp.csbu.cc.middleware;
package com.hpcloud.middleware;
import org.apache.commons.pool.impl.GenericObjectPool;

View File

@ -1,4 +1,4 @@
package com.hp.csbu.cc.middleware;
package com.hpcloud.middleware;
import java.io.File;
import java.io.FileInputStream;

View File

@ -1,4 +1,4 @@
package com.hp.csbu.cc.middleware;
package com.hpcloud.middleware;
import java.util.concurrent.TimeUnit;

View File

@ -1,4 +1,4 @@
package com.hp.csbu.cc.middleware;
package com.hpcloud.middleware;
public class SignatureBuilderException extends RuntimeException {

View File

@ -1,4 +1,4 @@
package com.hp.csbu.cc.middleware;
package com.hpcloud.middleware;
import java.io.IOException;

View File

@ -1,4 +1,4 @@
package com.hp.csbu.cc.middleware;
package com.hpcloud.middleware;
import java.io.IOException;
import org.apache.http.client.ClientProtocolException;

View File

@ -1,4 +1,4 @@
package com.hp.csbu.cc.middleware;
package com.hpcloud.middleware;
import com.google.common.cache.*;
import org.apache.http.client.ClientProtocolException;
@ -8,7 +8,8 @@ package com.hp.csbu.cc.middleware;
import java.io.IOException;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
public class TokenCache<K,V> {
@ -25,10 +26,10 @@ public class TokenCache<K,V> {
factory = appConfig.getFactory();
cache = CacheBuilder.newBuilder().maximumSize(10000)
cache = CacheBuilder.newBuilder().maximumSize(maxSize)
.expireAfterWrite(timeToExpire, TimeUnit.SECONDS)
.build(new CacheLoader<K, V>() {
public V load(K key) throws TException,ClientProtocolException, UnavailableException {
public V load(K key) throws TException,ClientProtocolException {
V value = null;
AuthClient client = null;
@ -45,14 +46,21 @@ public class TokenCache<K,V> {
if(client!=null)
factory.recycle(client);
}
return value;
}
});
}
public V getToken(K key) throws IOException {
return cache.getUnchecked(key);
public V getToken(K key) throws ClientProtocolException {
V value = null;
try {
value = cache.get(key);
throw new ClientProtocolException("Testing");
} catch (ExecutionException e) {
logger.debug("had problem caching token");
}
return value;
}
public void put(K key, V value) {

View File

@ -1,4 +1,4 @@
package com.hp.csbu.cc.middleware;
package com.hpcloud.middleware;
import java.io.IOException;
import org.apache.http.client.ClientProtocolException;

View File

@ -1,4 +1,4 @@
package com.hp.csbu.cc.middleware;
package com.hpcloud.middleware;
/**
* Created by johnderr on 6/25/14.