[teiid-commits] teiid SVN: r1172 - in trunk: build/kit-runtime/deploy and 1 other directories.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Wed Jul 22 13:08:38 EDT 2009


Author: rareddy
Date: 2009-07-22 13:08:37 -0400 (Wed, 22 Jul 2009)
New Revision: 1172

Modified:
   trunk/build/kit-runtime/deploy.properties
   trunk/build/kit-runtime/deploy/membership-file.properties
   trunk/build/kit-runtime/deploy/membership-ldap.properties
   trunk/runtime/src/main/java/com/metamatrix/platform/security/membership/service/MembershipServiceImpl.java
Log:
TEIID-664: modified code such that the membership specific properties does not need to be present in the "deploy.properties". The code will look for "memebership-xxx.properties" file in the classpath, where xxx is the domain name. The xxx name is determined from the "domain order" property.

Modified: trunk/build/kit-runtime/deploy/membership-file.properties
===================================================================
--- trunk/build/kit-runtime/deploy/membership-file.properties	2009-07-22 15:54:17 UTC (rev 1171)
+++ trunk/build/kit-runtime/deploy/membership-file.properties	2009-07-22 17:08:37 UTC (rev 1172)
@@ -1,5 +1,11 @@
 #File based membership domain configuration properties
 
+# File Membership Domain Settings (activate, Membership Domain Class Name, Property file for configuration) 
+activate=false
+
+# The class that implements the File membership 
+AuthDomainClass=com.metamatrix.platform.security.membership.spi.file.FileMembershipDomain
+
 #Location of the properties file containing user name and password entries.
 usersFile=users.properties
 

Modified: trunk/build/kit-runtime/deploy/membership-ldap.properties
===================================================================
--- trunk/build/kit-runtime/deploy/membership-ldap.properties	2009-07-22 15:54:17 UTC (rev 1171)
+++ trunk/build/kit-runtime/deploy/membership-ldap.properties	2009-07-22 17:08:37 UTC (rev 1172)
@@ -1,7 +1,10 @@
 # Configuration file for LDAP membership domain
 
-activate=true
+activate=false
 
+# The class that implements the LDAP membership 
+ldap.AuthDomainClass=com.metamatrix.platform.security.membership.spi.ldap.LDAPMembershipDomain
+
 #Full LDAP URL (mandatory)
 ldapURL=
 

Modified: trunk/build/kit-runtime/deploy.properties
===================================================================
--- trunk/build/kit-runtime/deploy.properties	2009-07-22 15:54:17 UTC (rev 1171)
+++ trunk/build/kit-runtime/deploy.properties	2009-07-22 17:08:37 UTC (rev 1172)
@@ -99,20 +99,11 @@
 membership.superUser=admin
 membership.superUserPassword=teiid
 #Membership Domain Order (comma separated list of domains to authenticate user. ex: file, ldap)
-membership.DomainOrder=file
+membership.DomainOrder=file,ldap
 #Allow connections only from specified hosts
 #membership.allowedHosts=
 
-# File Membership Domain Settings (activate, Membership Domain Class Name, Property file for configuration) 
-file.activate=false
-file.AuthDomainClass=com.metamatrix.platform.security.membership.spi.file.FileMembershipDomain
-file.propertiesFile=./deploy/membership-file.properties
 
-# LDAP Membership Domain Settings (activate, Membership Domain Class Name, Property file for configuration)
-#ldap.activate=false
-#ldap.AuthDomainClass=com.metamatrix.platform.security.membership.spi.ldap.LDAPMembershipDomain
-#ldap.propertiesFile=./deploy/membership-ldap.properties
-
 #
 # Authorization Service Settings
 #
@@ -121,7 +112,6 @@
 entitlements.enabled=false
 entitlements.adminRolesFile=./deploy/admin-roles.properties
 
-
 #
 # Server Settings (Socket transport)
 #

Modified: trunk/runtime/src/main/java/com/metamatrix/platform/security/membership/service/MembershipServiceImpl.java
===================================================================
--- trunk/runtime/src/main/java/com/metamatrix/platform/security/membership/service/MembershipServiceImpl.java	2009-07-22 15:54:17 UTC (rev 1171)
+++ trunk/runtime/src/main/java/com/metamatrix/platform/security/membership/service/MembershipServiceImpl.java	2009-07-22 17:08:37 UTC (rev 1172)
@@ -183,13 +183,13 @@
             String domainName = ((String) domainNameItr.next()).trim();
             try {
                 Properties domainProps = PropertiesUtils.getProperties(domainName + ".*", env); //$NON-NLS-1$
-                if (!Boolean.valueOf(domainProps.getProperty(DOMAIN_ACTIVE)).booleanValue()) {
+                if (!Boolean.valueOf(domainProps.getProperty(DOMAIN_ACTIVE, "true")).booleanValue()) { //$NON-NLS-1$
                     LogManager.logDetail(LogConstants.CTX_MEMBERSHIP, "Skipping initilization of inactive domain " + domainName); //$NON-NLS-1$
                     continue;
                 }
                 MembershipDomain newDomain = createDomain(domainName, domainProps);
-                LogManager.logInfo(LogConstants.CTX_MEMBERSHIP, DQPEmbeddedPlugin.Util.getString("MembershipServiceImpl.loaded", domainName)); //$NON-NLS-1$
                 if(newDomain!=null) {
+                	LogManager.logInfo(LogConstants.CTX_MEMBERSHIP, DQPEmbeddedPlugin.Util.getString("MembershipServiceImpl.loaded", domainName)); //$NON-NLS-1$
                     this.domains.add(new MembershipDomainHolder(newDomain, domainName));
                 }
             } catch (Exception e){
@@ -213,36 +213,48 @@
     private MembershipDomain createDomain(String domainName, Properties properties) throws ApplicationInitializationException, MalformedURLException, IOException, MembershipSourceException {
 
         MembershipDomain domain = null;
-        String className = properties.getProperty(AuthenticationProviderType.Attributes.AUTHDOMAIN_CLASS); 
-        
-        if (className != null && className.length() > 0) {
-            try {
-                domain = (MembershipDomain) Thread.currentThread().getContextClassLoader().loadClass(className).newInstance();
-            } catch (Throwable e) {
-                throw new ApplicationInitializationException(e, DQPEmbeddedPlugin.Util.getString("MembershipServiceImpl.failed_to_create", className)); //$NON-NLS-1$
-            }
-        } else {
-            throw new ApplicationInitializationException(DQPEmbeddedPlugin.Util.getString("MembershipServiceImpl.unable_to_create", domainName)); //$NON-NLS-1$
-        }
-        
         properties.setProperty(DOMAIN_NAME, domainName);
         
-        String propsString = properties.getProperty(DOMAIN_PROPERTIES); 
-        
+        // load properties file that defines the custom properties
+        URL url = null;
+        String propsString = properties.getProperty(DOMAIN_PROPERTIES);
         if (propsString != null) {
-        	URL url = URLHelper.buildURL(this.dqpURL, propsString);
-            Properties customProps = PropertiesUtils.loadFromURL(url);
-            properties.putAll(customProps);
-            
-            // Using this URL the Membership providers can further define and files that are in relative context to this file
-            properties.put(DOMAIN_PROPERTIES, url);
+        	url = URLHelper.buildURL(this.dqpURL, propsString);        	
         }
-                
-        domain.initialize(properties);
-
-        return domain;
+        else {
+        	url = this.getClass().getClassLoader().getResource("membership-"+domainName+".properties"); //$NON-NLS-1$ //$NON-NLS-2$
+        }
+        
+        if (url != null) {
+	        Properties customProps = PropertiesUtils.loadFromURL(url);
+	        properties.putAll(customProps);
+	        
+	        // Using this URL the Membership providers can further define and files that are in relative context to this file
+	        properties.put(DOMAIN_PROPERTIES, url);        
+	        
+	        boolean activate = PropertiesUtils.getBooleanProperty(properties, DOMAIN_ACTIVE, false);
+	        if (activate) {
+		        String className = properties.getProperty(AuthenticationProviderType.Attributes.AUTHDOMAIN_CLASS); 
+		        
+		        if (className != null && className.length() > 0) {
+		            try {
+		                domain = (MembershipDomain) Thread.currentThread().getContextClassLoader().loadClass(className).newInstance();
+		            } catch (Throwable e) {
+		                throw new ApplicationInitializationException(e, DQPEmbeddedPlugin.Util.getString("MembershipServiceImpl.failed_to_create", className)); //$NON-NLS-1$
+		            }
+		        } else {
+		            throw new ApplicationInitializationException(DQPEmbeddedPlugin.Util.getString("MembershipServiceImpl.unable_to_create", domainName)); //$NON-NLS-1$
+		        }
+		                
+		        domain.initialize(properties);
+		        return domain;
+	        }
+        }
+        return null;
     }
 
+
+
     private void shutdownDomains() {
         // Shut down the domain(s) ...
         Iterator iter = this.domains.iterator();



More information about the teiid-commits mailing list