1 23 24 package com.sun.enterprise.connectors.util; 25 26 import com.sun.enterprise.connectors.*; 27 import com.sun.enterprise.deployment.runtime.connector.*; 28 import com.sun.enterprise.deployment.*; 29 import com.sun.enterprise.connectors.util.SecurityMapUtils; 30 import com.sun.logging.*; 31 import java.util.logging.Logger ; 32 import java.util.logging.Level ; 33 import java.util.Set ; 34 import com.sun.enterprise.connectors.authentication.RuntimeSecurityMap; 35 import com.sun.enterprise.connectors.authentication.ConnectorSecurityMap; 36 38 39 public class ConnectionPoolReconfigHelper { 40 41 private static Logger _logger = LogDomains.getLogger( LogDomains.RSR_LOGGER ); 42 43 44 public enum ReconfigAction { RECREATE_POOL, UPDATE_MCF_AND_ATTRIBUTES, NO_OP }; 45 46 public static ReconfigAction compare( ConnectorConnectionPool oldPool, 47 ConnectorConnectionPool newPool, Set excludedProps ) 48 throws ConnectorRuntimeException 49 { 50 51 if ( isEqualConnectorConnectionPool( oldPool, newPool , excludedProps ) 52 == ReconfigAction.NO_OP ) { 53 54 return ReconfigAction.UPDATE_MCF_AND_ATTRIBUTES; 55 } 56 57 return ReconfigAction.RECREATE_POOL; 58 59 } 60 61 71 private static ReconfigAction isEqualConnectorConnectionPool( ConnectorConnectionPool 72 oldCcp, ConnectorConnectionPool newCcp, Set excludedProps ) 73 { 74 boolean poolsEqual = true; 75 76 if (newCcp.getTransactionSupport() != oldCcp.getTransactionSupport() ) { 79 return ReconfigAction.RECREATE_POOL; 80 } 81 82 if (newCcp.isAssociateWithThread() != oldCcp.isAssociateWithThread() ) { 83 return ReconfigAction.RECREATE_POOL; 84 } 85 86 if (newCcp.isLazyConnectionAssoc() != oldCcp.isLazyConnectionAssoc() ) { 87 return ReconfigAction.RECREATE_POOL; 88 } 89 90 91 ConnectorDescriptorInfo oldCdi = oldCcp.getConnectorDescriptorInfo(); 92 ConnectorDescriptorInfo newCdi = newCcp.getConnectorDescriptorInfo(); 93 94 if (! oldCdi.getResourceAdapterClassName().equals( 95 newCdi.getResourceAdapterClassName()) ) { 96 97 logFine( 98 "isEqualConnectorConnectionPool: getResourceAdapterClassName:: " + 99 oldCdi.getResourceAdapterClassName() + " -- " + 100 newCdi.getResourceAdapterClassName()); 101 return ReconfigAction.RECREATE_POOL; 102 } 103 104 if (! oldCdi.getConnectionDefinitionName().equals( 105 newCdi.getConnectionDefinitionName()) ) { 106 107 logFine( 108 "isEqualConnectorConnectionPool: getConnectionDefinitionName:: "+ 109 oldCdi.getConnectionDefinitionName() + " -- " + 110 newCdi.getConnectionDefinitionName()); 111 112 return ReconfigAction.RECREATE_POOL; 113 } 114 115 ConnectorSecurityMap[] newSecurityMaps = newCcp.getSecurityMaps(); 116 RuntimeSecurityMap newRuntimeSecurityMap = 117 SecurityMapUtils.processSecurityMaps(newSecurityMaps); 118 ConnectorSecurityMap[] oldSecurityMaps = oldCcp.getSecurityMaps(); 119 RuntimeSecurityMap oldRuntimeSecurityMap = 120 SecurityMapUtils.processSecurityMaps(oldSecurityMaps); 121 if (!( oldRuntimeSecurityMap.equals(newRuntimeSecurityMap) )){ 122 logFine("isEqualConnectorConnectionPool: CCP.getSecurityMaps:: " + 123 "New set of Security Maps is not equal to the existing" + 124 " set of security Maps."); 125 return ReconfigAction.RECREATE_POOL; 126 } 127 128 Set newMCFConfigProps = newCdi.getMCFConfigProperties(); 129 Set oldMCFConfigProps = oldCdi.getMCFConfigProperties(); 130 return oldCdi.compareMCFConfigProperties( newCdi, excludedProps ); 131 } 132 133 private static void logFine( String msg ) { 134 if (msg != null && _logger.isLoggable(Level.FINE)) { 135 _logger.fine( msg ); 136 } 137 } 138 } 139 | Popular Tags |