ws-scout-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tcunn...@apache.org
Subject svn commit: r934975 - in /webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry: AuthTokenSingleton.java AuthTokenV3Singleton.java BusinessLifeCycleManagerImpl.java BusinessLifeCycleManagerV3Impl.java
Date Fri, 16 Apr 2010 16:10:42 GMT
Author: tcunning
Date: Fri Apr 16 16:10:41 2010
New Revision: 934975

URL: http://svn.apache.org/viewvc?rev=934975&view=rev
Log:
SCOUT-95 
Add use of singletons so that BLM cached authtokens can also be used in the
BusinessQueryManager and vice versa.

Modified:
    webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/AuthTokenSingleton.java
    webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/AuthTokenV3Singleton.java
    webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/BusinessLifeCycleManagerImpl.java
    webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/BusinessLifeCycleManagerV3Impl.java

Modified: webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/AuthTokenSingleton.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/AuthTokenSingleton.java?rev=934975&r1=934974&r2=934975&view=diff
==============================================================================
--- webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/AuthTokenSingleton.java
(original)
+++ webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/AuthTokenSingleton.java
Fri Apr 16 16:10:41 2010
@@ -8,7 +8,6 @@ public class AuthTokenSingleton {
 	private static Hashtable cachedAuthTokenHash = new Hashtable();
 	
 	private AuthTokenSingleton() {
-		cachedAuthTokenHash = new Hashtable();
 	}
 
 	public static AuthToken getToken(String username) {

Modified: webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/AuthTokenV3Singleton.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/AuthTokenV3Singleton.java?rev=934975&r1=934974&r2=934975&view=diff
==============================================================================
--- webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/AuthTokenV3Singleton.java
(original)
+++ webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/AuthTokenV3Singleton.java
Fri Apr 16 16:10:41 2010
@@ -8,10 +8,9 @@ public class AuthTokenV3Singleton {
 	private static Hashtable cachedAuthTokenHash = new Hashtable();
 	
 	private AuthTokenV3Singleton() {
-		cachedAuthTokenHash = new Hashtable();
 	}
 
-	public static AuthToken getInstance(String username) {
+	public static AuthToken getToken(String username) {
 		if (instance == null) {
 			instance = new AuthTokenV3Singleton();
 		}

Modified: webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/BusinessLifeCycleManagerImpl.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/BusinessLifeCycleManagerImpl.java?rev=934975&r1=934974&r2=934975&view=diff
==============================================================================
--- webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/BusinessLifeCycleManagerImpl.java
(original)
+++ webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/BusinessLifeCycleManagerImpl.java
Fri Apr 16 16:10:41 2010
@@ -94,18 +94,13 @@ public class BusinessLifeCycleManagerImp
 
 	private Log log = LogFactory.getLog(this.getClass());
     
-    private static Hashtable cachedAuthTokenHash = null;
-	
     private transient ObjectFactory objectFactory = new ObjectFactory();
 	
     public BusinessLifeCycleManagerImpl(RegistryService registry) {
     	super(registry);
         
         if(objectFactory == null)
-        	objectFactory = new ObjectFactory();
-        
-        if (cachedAuthTokenHash == null) 
-        	cachedAuthTokenHash = new Hashtable();
+        	objectFactory = new ObjectFactory();        
     }
 
     /**
@@ -581,8 +576,8 @@ public class BusinessLifeCycleManagerImp
         		regobj = ireg.setPublisherAssertions(token.getAuthInfo(), (PublisherAssertion[])
dataarray);
         	} catch (RegistryException rve) {
         		String username = getUsernameFromCredentials(connection.getCredentials());
-        		if (cachedAuthTokenHash.containsKey(username)) {
-        			cachedAuthTokenHash.remove(username);
+        		if (AuthTokenSingleton.getToken(username) != null) {
+        			AuthTokenSingleton.deleteAuthToken(username);
         		}
         		token = getAuthToken(connection, ireg);
         		regobj = ireg.setPublisherAssertions(token.getAuthInfo(), (PublisherAssertion[])
dataarray);
@@ -593,8 +588,8 @@ public class BusinessLifeCycleManagerImp
         		regobj = ireg.saveService(token.getAuthInfo(), (BusinessService[])dataarray);
         	} catch (RegistryException rve) {
         		String username = getUsernameFromCredentials(connection.getCredentials());
-        		if (cachedAuthTokenHash.containsKey(username)) {
-        			cachedAuthTokenHash.remove(username);
+        		if (AuthTokenSingleton.getToken(username) != null) {
+        			AuthTokenSingleton.deleteAuthToken(username);
         		}
         		token = getAuthToken(connection, ireg);
         		regobj = ireg.saveService(token.getAuthInfo(), (BusinessService[])dataarray);
@@ -605,8 +600,8 @@ public class BusinessLifeCycleManagerImp
         		regobj = ireg.saveBinding(token.getAuthInfo(), (BindingTemplate[]) dataarray);
         	} catch (RegistryException rve) {
         		String username = getUsernameFromCredentials(connection.getCredentials());
-        		if (cachedAuthTokenHash.containsKey(username)) {
-        			cachedAuthTokenHash.remove(username);
+        		if (AuthTokenSingleton.getToken(username) != null) {
+        			AuthTokenSingleton.deleteAuthToken(username);
         		}
         		token = getAuthToken(connection, ireg);
         		regobj = ireg.saveBinding(token.getAuthInfo(), (BindingTemplate[]) dataarray);
       		
@@ -617,8 +612,8 @@ public class BusinessLifeCycleManagerImp
         		regobj = ireg.saveBusiness(token.getAuthInfo(), (BusinessEntity[]) dataarray);
         	} catch (RegistryException rve) {
         		String username = getUsernameFromCredentials(connection.getCredentials());
-        		if (cachedAuthTokenHash.containsKey(username)) {
-        			cachedAuthTokenHash.remove(username);
+        		if (AuthTokenSingleton.getToken(username) != null) {
+        			AuthTokenSingleton.deleteAuthToken(username);
         		}
         		token = getAuthToken(connection, ireg);
         		regobj = ireg.saveBusiness(token.getAuthInfo(), (BusinessEntity[]) dataarray);
@@ -629,8 +624,8 @@ public class BusinessLifeCycleManagerImp
         		regobj = ireg.saveTModel(token.getAuthInfo(), (TModel[]) dataarray);
         	} catch (RegistryException rve) {
         		String username = getUsernameFromCredentials(connection.getCredentials());
-        		if (cachedAuthTokenHash.containsKey(username)) {
-        			cachedAuthTokenHash.remove(username);
+        		if (AuthTokenSingleton.getToken(username) != null) {
+        			AuthTokenSingleton.deleteAuthToken(username);
         		}
         		token = getAuthToken(connection, ireg);
         		regobj = ireg.saveTModel(token.getAuthInfo(), (TModel[]) dataarray);
@@ -642,8 +637,8 @@ public class BusinessLifeCycleManagerImp
             	regobj = ireg.deleteBusiness(token.getAuthInfo(), (String[]) dataarray);
         	} catch (RegistryException rve) {
         		String username = getUsernameFromCredentials(connection.getCredentials());
-        		if (cachedAuthTokenHash.containsKey(username)) {
-        			cachedAuthTokenHash.remove(username);
+        		if (AuthTokenSingleton.getToken(username) != null) {
+        			AuthTokenSingleton.deleteAuthToken(username);
         		}
         		token = getAuthToken(connection, ireg);
                 clearPublisherAssertions(token.getAuthInfo(), ireg);
@@ -655,8 +650,8 @@ public class BusinessLifeCycleManagerImp
         		regobj = ireg.deleteService(token.getAuthInfo(), (String[]) dataarray);
 	    	} catch (RegistryException rve) {
 	    		String username = getUsernameFromCredentials(connection.getCredentials());
-	    		if (cachedAuthTokenHash.containsKey(username)) {
-	    			cachedAuthTokenHash.remove(username);
+        		if (AuthTokenSingleton.getToken(username) != null) {
+        			AuthTokenSingleton.deleteAuthToken(username);
 	    		}
 	    		token = getAuthToken(connection, ireg);
 	            clearPublisherAssertions(token.getAuthInfo(), ireg);
@@ -668,8 +663,8 @@ public class BusinessLifeCycleManagerImp
         		regobj = ireg.deleteBinding(token.getAuthInfo(), (String[]) dataarray);
 	    	} catch (RegistryException rve) {
 	    		String username = getUsernameFromCredentials(connection.getCredentials());
-	    		if (cachedAuthTokenHash.containsKey(username)) {
-	    			cachedAuthTokenHash.remove(username);
+        		if (AuthTokenSingleton.getToken(username) != null) {
+        			AuthTokenSingleton.deleteAuthToken(username);
 	    		}
 	    		token = getAuthToken(connection, ireg);
 	            clearPublisherAssertions(token.getAuthInfo(), ireg);
@@ -681,8 +676,8 @@ public class BusinessLifeCycleManagerImp
             	regobj = ireg.deleteTModel(token.getAuthInfo(), (String[]) dataarray);
 	    	} catch (RegistryException rve) {
 	    		String username = getUsernameFromCredentials(connection.getCredentials());
-	    		if (cachedAuthTokenHash.containsKey(username)) {
-	    			cachedAuthTokenHash.remove(username);
+        		if (AuthTokenSingleton.getToken(username) != null) {
+        			AuthTokenSingleton.deleteAuthToken(username);
 	    		}
 	    		token = getAuthToken(connection, ireg);
 	            clearPublisherAssertions(token.getAuthInfo(), ireg);
@@ -701,8 +696,8 @@ public class BusinessLifeCycleManagerImp
                 regobj = ireg.deletePublisherAssertions(token.getAuthInfo(), paarr);
             } catch (RegistryException rve) {
 	    		String username = getUsernameFromCredentials(connection.getCredentials());
-	    		if (cachedAuthTokenHash.containsKey(username)) {
-	    			cachedAuthTokenHash.remove(username);
+        		if (AuthTokenSingleton.getToken(username) != null) {
+        			AuthTokenSingleton.deleteAuthToken(username);
 	    		}
 	    		token = getAuthToken(connection, ireg);
 	            clearPublisherAssertions(token.getAuthInfo(), ireg);
@@ -860,8 +855,8 @@ public class BusinessLifeCycleManagerImp
         	}
         }
 
-        if ((cachedAuthTokenHash != null) && (cachedAuthTokenHash.containsKey(username)))
{
-        	return (AuthToken) cachedAuthTokenHash.get(username);
+        if (AuthTokenSingleton.getToken(username) != null) {
+        	return (AuthToken) AuthTokenSingleton.getToken(username);
         }
         
         AuthToken token = null;
@@ -872,7 +867,7 @@ public class BusinessLifeCycleManagerImp
         { 
             throw new JAXRException(e);
         }
-        cachedAuthTokenHash.put(username, token);
+        AuthTokenSingleton.addAuthToken(username, token);
         return token;
     }
 

Modified: webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/BusinessLifeCycleManagerV3Impl.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/BusinessLifeCycleManagerV3Impl.java?rev=934975&r1=934974&r2=934975&view=diff
==============================================================================
--- webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/BusinessLifeCycleManagerV3Impl.java
(original)
+++ webservices/scout/trunk/src/main/java/org/apache/ws/scout/registry/BusinessLifeCycleManagerV3Impl.java
Fri Apr 16 16:10:41 2010
@@ -96,14 +96,10 @@ public class BusinessLifeCycleManagerV3I
     
     private transient ObjectFactory objectFactory = new ObjectFactory();
 	
-    private static Hashtable cachedAuthTokenHash = null;
-    
     public BusinessLifeCycleManagerV3Impl(RegistryService registry) {
         super(registry);
         if(objectFactory == null)
         	objectFactory = new ObjectFactory();
-        if (cachedAuthTokenHash == null) 
-        	cachedAuthTokenHash = new Hashtable();
     }
 
     /**
@@ -579,8 +575,8 @@ public class BusinessLifeCycleManagerV3I
         		regobj = ireg.setPublisherAssertions(token.getAuthInfo(), (PublisherAssertion[])
dataarray);
         	} catch (RegistryV3Exception rve) {
         		String username = getUsernameFromCredentials(connection.getCredentials());
-        		if (cachedAuthTokenHash.containsKey(username)) {
-        			cachedAuthTokenHash.remove(username);
+        		if (AuthTokenV3Singleton.getToken(username) != null) {
+        			AuthTokenV3Singleton.deleteAuthToken(username);
         		}
         		token = getAuthToken(connection, ireg);
         		regobj = ireg.setPublisherAssertions(token.getAuthInfo(), (PublisherAssertion[])
dataarray);
@@ -590,8 +586,8 @@ public class BusinessLifeCycleManagerV3I
         		regobj = ireg.saveService(token.getAuthInfo(), (BusinessService[])dataarray);
         	} catch (RegistryV3Exception rve) {
         		String username = getUsernameFromCredentials(connection.getCredentials());
-        		if (cachedAuthTokenHash.containsKey(username)) {
-        			cachedAuthTokenHash.remove(username);
+        		if (AuthTokenV3Singleton.getToken(username) != null) {
+        			AuthTokenV3Singleton.deleteAuthToken(username);
         		}
         		token = getAuthToken(connection, ireg);
         		regobj = ireg.saveService(token.getAuthInfo(), (BusinessService[])dataarray);
@@ -602,8 +598,8 @@ public class BusinessLifeCycleManagerV3I
         		regobj = ireg.saveBinding(token.getAuthInfo(), (BindingTemplate[]) dataarray);
         	} catch (RegistryV3Exception rve) {
         		String username = getUsernameFromCredentials(connection.getCredentials());
-        		if (cachedAuthTokenHash.containsKey(username)) {
-        			cachedAuthTokenHash.remove(username);
+        		if (AuthTokenV3Singleton.getToken(username) != null) {
+        			AuthTokenV3Singleton.deleteAuthToken(username);
         		}
         		token = getAuthToken(connection, ireg);
         		regobj = ireg.saveBinding(token.getAuthInfo(), (BindingTemplate[]) dataarray);
       		
@@ -614,8 +610,8 @@ public class BusinessLifeCycleManagerV3I
         		regobj = ireg.saveBusiness(token.getAuthInfo(), (BusinessEntity[]) dataarray);
         	} catch (RegistryV3Exception rve) {
         		String username = getUsernameFromCredentials(connection.getCredentials());
-        		if (cachedAuthTokenHash.containsKey(username)) {
-        			cachedAuthTokenHash.remove(username);
+        		if (AuthTokenV3Singleton.getToken(username) != null) {
+        			AuthTokenV3Singleton.deleteAuthToken(username);
         		}
         		token = getAuthToken(connection, ireg);
         		regobj = ireg.saveBusiness(token.getAuthInfo(), (BusinessEntity[]) dataarray);
@@ -626,8 +622,8 @@ public class BusinessLifeCycleManagerV3I
         		regobj = ireg.saveTModel(token.getAuthInfo(), (TModel[]) dataarray);
         	} catch (RegistryV3Exception rve) {
         		String username = getUsernameFromCredentials(connection.getCredentials());
-        		if (cachedAuthTokenHash.containsKey(username)) {
-        			cachedAuthTokenHash.remove(username);
+        		if (AuthTokenV3Singleton.getToken(username) != null) {
+        			AuthTokenV3Singleton.deleteAuthToken(username);
         		}
         		token = getAuthToken(connection, ireg);
         		regobj = ireg.saveTModel(token.getAuthInfo(), (TModel[]) dataarray);
@@ -639,8 +635,8 @@ public class BusinessLifeCycleManagerV3I
             	regobj = ireg.deleteBusiness(token.getAuthInfo(), (String[]) dataarray);
         	} catch (RegistryV3Exception rve) {
         		String username = getUsernameFromCredentials(connection.getCredentials());
-        		if (cachedAuthTokenHash.containsKey(username)) {
-        			cachedAuthTokenHash.remove(username);
+        		if (AuthTokenV3Singleton.getToken(username) != null) {
+        			AuthTokenV3Singleton.deleteAuthToken(username);
         		}
         		token = getAuthToken(connection, ireg);
                 clearPublisherAssertions(token.getAuthInfo(), ireg);
@@ -652,8 +648,8 @@ public class BusinessLifeCycleManagerV3I
         		regobj = ireg.deleteService(token.getAuthInfo(), (String[]) dataarray);
 	    	} catch (RegistryV3Exception rve) {
 	    		String username = getUsernameFromCredentials(connection.getCredentials());
-	    		if (cachedAuthTokenHash.containsKey(username)) {
-	    			cachedAuthTokenHash.remove(username);
+        		if (AuthTokenV3Singleton.getToken(username) != null) {
+        			AuthTokenV3Singleton.deleteAuthToken(username);
 	    		}
 	    		token = getAuthToken(connection, ireg);
 	            clearPublisherAssertions(token.getAuthInfo(), ireg);
@@ -665,8 +661,8 @@ public class BusinessLifeCycleManagerV3I
         		regobj = ireg.deleteBinding(token.getAuthInfo(), (String[]) dataarray);
 	    	} catch (RegistryV3Exception rve) {
 	    		String username = getUsernameFromCredentials(connection.getCredentials());
-	    		if (cachedAuthTokenHash.containsKey(username)) {
-	    			cachedAuthTokenHash.remove(username);
+        		if (AuthTokenV3Singleton.getToken(username) != null) {
+        			AuthTokenV3Singleton.deleteAuthToken(username);
 	    		}
 	    		token = getAuthToken(connection, ireg);
 	            clearPublisherAssertions(token.getAuthInfo(), ireg);
@@ -678,8 +674,8 @@ public class BusinessLifeCycleManagerV3I
             	regobj = ireg.deleteTModel(token.getAuthInfo(), (String[]) dataarray);
 	    	} catch (RegistryV3Exception rve) {
 	    		String username = getUsernameFromCredentials(connection.getCredentials());
-	    		if (cachedAuthTokenHash.containsKey(username)) {
-	    			cachedAuthTokenHash.remove(username);
+        		if (AuthTokenV3Singleton.getToken(username) != null) {
+        			AuthTokenV3Singleton.deleteAuthToken(username);
 	    		}
 	    		token = getAuthToken(connection, ireg);
 	            clearPublisherAssertions(token.getAuthInfo(), ireg);
@@ -698,8 +694,8 @@ public class BusinessLifeCycleManagerV3I
             	regobj = ireg.deletePublisherAssertions(token.getAuthInfo(), paarr);
             } catch (RegistryV3Exception rve) {
 	    		String username = getUsernameFromCredentials(connection.getCredentials());
-	    		if (cachedAuthTokenHash.containsKey(username)) {
-	    			cachedAuthTokenHash.remove(username);
+        		if (AuthTokenV3Singleton.getToken(username) != null) {
+        			AuthTokenV3Singleton.deleteAuthToken(username);
 	    		}
 	    		token = getAuthToken(connection, ireg);
 	            clearPublisherAssertions(token.getAuthInfo(), ireg);
@@ -711,8 +707,8 @@ public class BusinessLifeCycleManagerV3I
         		regobj = ireg.deleteTModel(token.getAuthInfo(), (String[]) dataarray);
 	    	} catch (RegistryV3Exception rve) {
 	    		String username = getUsernameFromCredentials(connection.getCredentials());
-	    		if (cachedAuthTokenHash.containsKey(username)) {
-	    			cachedAuthTokenHash.remove(username);
+        		if (AuthTokenV3Singleton.getToken(username) != null) {
+        			AuthTokenV3Singleton.deleteAuthToken(username);
 	    		}
 	    		token = getAuthToken(connection, ireg);
 	            clearPublisherAssertions(token.getAuthInfo(), ireg);
@@ -908,8 +904,8 @@ public class BusinessLifeCycleManagerV3I
         	}
         }
 
-        if ((cachedAuthTokenHash != null) && (cachedAuthTokenHash.containsKey(username)))
{
-        	return (AuthToken) cachedAuthTokenHash.get(username);
+        if (AuthTokenV3Singleton.getToken(username) != null) {
+        	return (AuthToken) AuthTokenV3Singleton.getToken(username);
         }
         
         
@@ -921,7 +917,7 @@ public class BusinessLifeCycleManagerV3I
         { 
             throw new JAXRException(e);
         }
-        cachedAuthTokenHash.put(username, token);
+        AuthTokenV3Singleton.addAuthToken(username, token);
         return token;	
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: scout-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: scout-dev-help@ws.apache.org


Mime
View raw message