Author: bdaw
Date: 2006-11-29 08:29:37 -0500 (Wed, 29 Nov 2006)
New Revision: 5743
Added:
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ConfigMetaData.java
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ConfigOptionMetaData.java
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/DatasourceMetaData.java
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/DatasourcesMetaData.java
trunk/identity/src/main/org/jboss/portal/test/identity/ConfigurationTestCase.java
Removed:
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModuleConfigMetaData.java
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModuleConfigOptionMetaData.java
Modified:
trunk/build/ide/intellij/idea50/modules/identity/identity.iml
trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageNavigationInterceptor.java
trunk/identity/build.xml
trunk/identity/src/main/org/jboss/portal/identity2/IdentityContext.java
trunk/identity/src/main/org/jboss/portal/identity2/IdentityServiceControllerImpl.java
trunk/identity/src/main/org/jboss/portal/identity2/config/IdentityConfigurationMetaDataFactory.java
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/IdentityConfigurationMetaData.java
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModuleMetaData.java
trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPConnectionContext.java
trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPMembershipModule.java
trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPRoleModule.java
trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPUserModule.java
trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPUserProfileModule.java
trunk/identity/src/main/org/jboss/portal/identity2/service/IdentityModuleService.java
trunk/identity/src/main/org/jboss/portal/identity2/service/UserProfileModuleService.java
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPStaticRoleMembershipModuleTestCase.java
trunk/identity/src/resources/draft/standardidentity-config.xml
trunk/identity/src/resources/test/config/standardidentity-config.xml
trunk/test/src/etc/identityconfig/opends-config.xml
trunk/test/src/etc/identityconfig/rhds-config.xml
trunk/test/src/etc/identityconfig/standardidentity-config.xml
Log:
- use microcontainer to instantiate identity modules
- introduce datasource into config
- update testsuite
Modified: trunk/build/ide/intellij/idea50/modules/identity/identity.iml
===================================================================
--- trunk/build/ide/intellij/idea50/modules/identity/identity.iml 2006-11-29 00:55:35 UTC
(rev 5742)
+++ trunk/build/ide/intellij/idea50/modules/identity/identity.iml 2006-11-29 13:29:37 UTC
(rev 5743)
@@ -103,6 +103,33 @@
<SOURCES />
</library>
</orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root
url="jar://$MODULE_DIR$/../../../../../../thirdparty/jboss/microcontainer/lib/jboss-dependency.jar!/"
/>
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root
url="jar://$MODULE_DIR$/../../../../../../thirdparty/jboss/microcontainer/lib/jboss-microcontainer.jar!/"
/>
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root
url="jar://$MODULE_DIR$/../../../../../../thirdparty/jboss/microcontainer/lib/jboss-container.jar!/"
/>
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
<orderEntryProperties />
</component>
<component name="VcsManagerConfiguration">
Modified:
trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageNavigationInterceptor.java
===================================================================
Modified: trunk/identity/build.xml
===================================================================
Modified: trunk/identity/src/main/org/jboss/portal/identity2/IdentityContext.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/IdentityContext.java 2006-11-29
00:55:35 UTC (rev 5742)
+++ trunk/identity/src/main/org/jboss/portal/identity2/IdentityContext.java 2006-11-29
13:29:37 UTC (rev 5743)
@@ -31,13 +31,13 @@
{
//TODO: move to safe type enum
- public static final String TYPE_USER_MODULE = "UserModule";
+ public static final String TYPE_USER_MODULE = "User";
- public static final String TYPE_ROLE_MODULE = "RoleModule";
+ public static final String TYPE_ROLE_MODULE = "Role";
- public static final String TYPE_MEMBERSHIP_MODULE = "MembershipModule";
+ public static final String TYPE_MEMBERSHIP_MODULE = "Membership";
- public static final String TYPE_USER_PROFILE_MODULE = "UserProfileModule";
+ public static final String TYPE_USER_PROFILE_MODULE = "UserProfile";
public static final String TYPE_CONNECTION_CONTEXT = "ConnectionContext";
Modified:
trunk/identity/src/main/org/jboss/portal/identity2/IdentityServiceControllerImpl.java
===================================================================
---
trunk/identity/src/main/org/jboss/portal/identity2/IdentityServiceControllerImpl.java 2006-11-29
00:55:35 UTC (rev 5742)
+++
trunk/identity/src/main/org/jboss/portal/identity2/IdentityServiceControllerImpl.java 2006-11-29
13:29:37 UTC (rev 5743)
@@ -27,15 +27,22 @@
import org.jboss.portal.identity2.config.IdentityConfigurationMetaDataFactory;
import org.jboss.portal.identity2.config.metadata.IdentityConfigurationMetaData;
import org.jboss.portal.identity2.config.metadata.ModuleMetaData;
-import org.jboss.portal.identity2.config.metadata.ModuleConfigOptionMetaData;
+import org.jboss.portal.identity2.config.metadata.ConfigOptionMetaData;
import org.jboss.portal.identity2.config.metadata.OptionsMetaData;
import org.jboss.portal.identity2.config.metadata.OptionsGroupMetaData;
import org.jboss.portal.identity2.config.metadata.OptionsGroupOptionMetaData;
+import org.jboss.portal.identity2.config.metadata.DatasourceMetaData;
import org.jboss.portal.identity2.service.IdentityModuleService;
import org.jboss.portal.identity2.service.IdentityConfigurationService;
import org.jboss.xb.binding.Unmarshaller;
import org.jboss.xb.binding.UnmarshallerFactory;
import org.jboss.xb.binding.ObjectModelFactory;
+import org.jboss.kernel.Kernel;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.kernel.plugins.bootstrap.basic.BasicBootstrap;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.plugins.AbstractParameterMetaData;
+import org.jboss.beans.metadata.plugins.AbstractPropertyMetaData;
import javax.management.ObjectName;
import java.net.URL;
@@ -44,8 +51,7 @@
import java.util.Iterator;
import java.util.HashMap;
import java.util.List;
-import java.util.HashSet;
-import java.util.Set;
+import java.util.ArrayList;
/**
* @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw
Dawidowicz</a>
@@ -67,6 +73,16 @@
private String defaultConfigFile;
+ /**
+ * .
+ */
+ protected Kernel kernel;
+
+ /**
+ * .
+ */
+ protected List beans;
+
protected void startService() throws Exception
{
if (jndiName != null)
@@ -75,6 +91,19 @@
jndiBinding.bind();
}
+ //initialize microcontainer stuff
+ try
+ {
+ BasicBootstrap bootstrap = new BasicBootstrap();
+ bootstrap.run();
+ kernel = bootstrap.getKernel();
+ beans = new ArrayList();
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException(e);
+ }
+
ClassLoader tcl = Thread.currentThread().getContextClassLoader();
//TODO: make a dtd for config files.
@@ -83,10 +112,22 @@
IdentityConfigurationMetaData meta = parseConfiguration(configFile);
IdentityConfigurationMetaData defaultMeta = parseConfiguration(defaultConfigFile);
- IdentityContextImpl context = new IdentityContextImpl();
- identityContext = context;
- context.start();
+ KernelControllerContext identityKernelContext;
+ try
+ {
+ AbstractBeanMetaData contextBMD = new AbstractBeanMetaData(
+ "portal:identity=IdentityContext",
+ IdentityContextImpl.class.getName());
+ beans.add(contextBMD);
+ identityKernelContext = kernel.getController().install(contextBMD);
+ identityContext = (IdentityContext)identityKernelContext.getTarget();
+ }
+ catch (Throwable throwable)
+ {
+ throw new IdentityException(throwable);
+ }
+
//TODO:update meta options using defaultMeta options
//create detault modules set
@@ -94,7 +135,7 @@
//Map[implementation] --> Map[Type] --> ModuleMetaData
Map defaultImplementations = new HashMap();
-
+ //update modules data with defaults
try
{
List defaultModules = defaultMeta.getModules().getModules();
@@ -104,10 +145,10 @@
//check if defaults contains all information
if (module.getType() == null ||
- module.getImplementation() == null ||
- module.getJndiName() == null ||
- module.getServiceName() == null ||
- module.getConfig() == null)
+ module.getImplementation() == null ||
+ //module.getJndiName() == null ||
+ module.getServiceName() == null ||
+ module.getConfig() == null)
{
throw new IdentityException("Default module configuration must be
complete");
}
@@ -124,6 +165,7 @@
implementation = new HashMap();
}
+ //store per implementation
implementation.put(module.getType(), module);
defaultImplementations.put(implType, implementation);
}
@@ -133,15 +175,21 @@
throw new IdentityException("Error during processing default configuration
file", e);
}
+ //map default datasources by name
+ Map defaultDatasources = new HashMap();
+ for (Iterator iterator = defaultMeta.getDatasources().getDatasources().iterator();
iterator.hasNext();)
+ {
+ DatasourceMetaData ds = (DatasourceMetaData)iterator.next();
+ defaultDatasources.put(ds.getName(), ds);
+ }
+
//process the list of modules, instantiate them, configure them, tide them
try
{
+ List datasources = meta.getDatasources().getDatasources();
List modules = meta.getModules().getModules();
- //TODO: update configuration options from defaultMeta
- //OptionsMetaData options = meta.getOptions();
-
//inject configuration service
IdentityConfigurationService configuration = new
IdentityConfigurationService(meta.getOptions());
configuration.setIdentityContext(identityContext);
@@ -149,63 +197,143 @@
//TODO:set proper jndiName and serviceName
configuration.start();
- updateOptionsWithDefaults(configuration,defaultMeta.getOptions());
+ //update options with defaults
+ updateOptionsWithDefaults(configuration, defaultMeta.getOptions());
-
- for (Iterator iterator = modules.iterator(); iterator.hasNext();)
+ //process datasources
+ for (Iterator iterator = datasources.iterator(); iterator.hasNext();)
{
+ DatasourceMetaData ds = (DatasourceMetaData)iterator.next();
+ if (log.isDebugEnabled()) log.debug("processing datasource: " +
ds.getName() + "/" + ds.getClassName());
+ updateDatasourceWithDefaults(ds, defaultDatasources);
- ModuleMetaData module = (ModuleMetaData)iterator.next();
- log.debug("Processing module: " + module.getType() + "/"
+ module.getImplementation());
- updateModuleWithDefaults(module, defaultImplementations);
+ //generate initial options
+ //TODO:presence of config tag should be forced in dtd
+ Map configOptions = ds.getConfig().getOptions();
+ Map optionMap = new HashMap();
+ for (Iterator iterator1 = configOptions.keySet().iterator();
iterator1.hasNext();)
+ {
+ String optionName = (String)iterator1.next();
+ ConfigOptionMetaData option =
(ConfigOptionMetaData)configOptions.get(optionName);
+ optionMap.put(optionName, option.getValue());
+ }
//instantiate the module
+ //IdentityModuleService moduleService = null;
- IdentityModuleService moduleService = null;
- if (module.getClassName() == null)
+ if (ds.getClassName() == null)
{
- throw new IdentityException("Class name not found for module type:
" + module.getType() + " wrong configuration");
+ throw new IdentityException("Class name not found for datasource
type: " + ds.getName() + " wrong configuration");
}
- try
+ /*try
{
moduleService =
(IdentityModuleService)tcl.loadClass(module.getClassName()).newInstance();
}
- catch (InstantiationException e)
+ catch (Exception e)
{
throw new IdentityException("Unable to instantiate the class: "
+ module.getClassName() );
+ }*/
+
+ //instantiate datasource using MC
+ String entryName = "portal:identity=Datasource,type=" +
ds.getName();
+ AbstractBeanMetaData dsBMD = new AbstractBeanMetaData(entryName,
+ ds.getClassName());
+ //AbstractPropertyMetaData propertyBMD = new
AbstractPropertyMetaData("identityContext", identityContext);
+ //moduleBMD.addProperty(propertyBMD);
+
+ //initiate parameters from <config>
+ for (Iterator iterator1 = optionMap.keySet().iterator();
iterator1.hasNext();)
+ {
+ String propertyKey = (String)iterator1.next();
+ String propertyValue = (String)optionMap.get(propertyKey);
+ AbstractPropertyMetaData propertyBMD = new
AbstractPropertyMetaData(propertyKey, propertyValue);
+ dsBMD.addProperty(propertyBMD);
}
- catch (IllegalAccessException e)
+
+ // Installation
+ beans.add(dsBMD);
+ KernelControllerContext controllerContext =
kernel.getController().install(dsBMD);
+ Object datasource = controllerContext.getTarget();
+
+ //make a part of identityContext
+ //moduleService.setIdentityContext(identityContext);
+
+ //register as an mbean
+ if (isRegisterMBeans())
{
- e.printStackTrace(); //To change body of catch statement use File |
Settings | File Templates.
+ getServer().registerMBean(datasource, new
ObjectName(ds.getServiceName()));
}
- catch (ClassNotFoundException e)
+
+
+ }
+
+
+
+ //process modules for instantiation
+ for (Iterator iterator = modules.iterator(); iterator.hasNext();)
+ {
+
+ ModuleMetaData module = (ModuleMetaData)iterator.next();
+ if (log.isDebugEnabled())
{
- e.printStackTrace(); //To change body of catch statement use File |
Settings | File Templates.
+ log.debug("Processing module: " + module.getType() +
"/" + module.getImplementation());
}
+ updateModuleWithDefaults(module, defaultImplementations);
- //make a part of identityContext
- moduleService.setIdentityContext(identityContext);
-
//generate initial options
Map configOptions = module.getConfig().getOptions();
Map optionMap = new HashMap();
for (Iterator iterator1 = configOptions.keySet().iterator();
iterator1.hasNext();)
{
String optionName = (String)iterator1.next();
- ModuleConfigOptionMetaData option =
(ModuleConfigOptionMetaData)configOptions.get(optionName);
- optionMap.put(optionName,option.getValue());
+ ConfigOptionMetaData option =
(ConfigOptionMetaData)configOptions.get(optionName);
+ optionMap.put(optionName, option.getValue());
}
- //set options
- moduleService.setInitOptions(optionMap);
+ //instantiate the module
+ //IdentityModuleService moduleService = null;
- moduleService.setJndiName(module.getJndiName());
- //start
- moduleService.start();
+ if (module.getClassName() == null)
+ {
+ throw new IdentityException("Class name not found for module type:
" + module.getType() + " wrong configuration");
+ }
+ /*try
+ {
+ moduleService =
(IdentityModuleService)tcl.loadClass(module.getClassName()).newInstance();
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException("Unable to instantiate the class: "
+ module.getClassName() );
+ }*/
+
+ //instantiate module using MC
+ String entryName = "portal:identity=Module,type=" +
module.getType();
+ AbstractBeanMetaData moduleBMD = new AbstractBeanMetaData(entryName,
+ module.getClassName());
+ AbstractPropertyMetaData propertyBMD = new
AbstractPropertyMetaData("identityContext", identityContext);
+ moduleBMD.addProperty(propertyBMD);
+
+ //initiate parameters from <config>
+ for (Iterator iterator1 = optionMap.keySet().iterator();
iterator1.hasNext();)
+ {
+ String propertyKey = (String)iterator1.next();
+ String propertyValue = (String)optionMap.get(propertyKey);
+ propertyBMD = new AbstractPropertyMetaData(propertyKey, propertyValue);
+ moduleBMD.addProperty(propertyBMD);
+ }
+
+ // Installation
+ beans.add(moduleBMD);
+ KernelControllerContext controllerContext =
kernel.getController().install(moduleBMD);
+ Object moduleService = (IdentityModuleService)controllerContext.getTarget();
+
+ //make a part of identityContext
+ //moduleService.setIdentityContext(identityContext);
+
//register as an mbean
if (isRegisterMBeans())
{
@@ -215,7 +343,7 @@
}
- catch (Exception e)
+ catch (Throwable e)
{
throw new IdentityException("Cannot initiate identity modules: ", e);
}
@@ -264,6 +392,7 @@
/**
* updates module with proper defaults
+ *
* @param module
* @param defaultModules
*/
@@ -288,10 +417,6 @@
{
module.setClassName(def.getClassName());
}
- if (module.getJndiName() == null)
- {
- module.setJndiName(def.getJndiName());
- }
if (module.getServiceName() == null)
{
module.setServiceName(def.getServiceName());
@@ -316,7 +441,7 @@
String key = (String)iterator.next();
if (!moduleOptions.containsKey(key))
{
- ModuleConfigOptionMetaData o =
(ModuleConfigOptionMetaData)defOptions.get(key);
+ ConfigOptionMetaData o = (ConfigOptionMetaData)defOptions.get(key);
module.getConfig().addOption(o);
}
}
@@ -324,7 +449,57 @@
}
/**
+ * updates module with proper defaults
+ */
+ private void updateDatasourceWithDefaults(DatasourceMetaData ds, Map defaultDS)
+ {
+ if (ds.getName() == null)
+ {
+ return;
+ }
+ if (!defaultDS.containsKey(ds.getName()))
+ {
+ return;
+ }
+ DatasourceMetaData def = (DatasourceMetaData)defaultDS.get(ds.getName());
+ if (ds.getClassName() == null)
+ {
+ ds.setClassName(def.getClassName());
+ }
+ if (ds.getServiceName() == null)
+ {
+ ds.setServiceName(def.getServiceName());
+ }
+
+ //now check if config options are overwritten
+ if (ds.getConfig() == null)
+ {
+ ds.setConfig(def.getConfig());
+ }
+ else
+ {
+ Map dsOptions = ds.getConfig().getOptions();
+ if (dsOptions == null)
+ {
+ return;
+ }
+ Map defOptions = def.getConfig().getOptions();
+
+ for (Iterator iterator = defOptions.keySet().iterator(); iterator.hasNext();)
+ {
+ String key = (String)iterator.next();
+ if (!dsOptions.containsKey(key))
+ {
+ ConfigOptionMetaData o = (ConfigOptionMetaData)defOptions.get(key);
+ ds.getConfig().addOption(o);
+ }
+ }
+ }
+ }
+
+ /**
* Check current options and update them with defaults if not exists;
+ *
* @param config
* @param defaults
*/
@@ -353,9 +528,9 @@
if (config.getValues(groupKey, optionKey) == null)
{
-
+
//config.setValues(groupKey, optionKey, new HashSet());
- config.setValues(groupKey,optionKey,option.getValues());
+ config.setValues(groupKey, optionKey, option.getValues());
}
Modified:
trunk/identity/src/main/org/jboss/portal/identity2/config/IdentityConfigurationMetaDataFactory.java
===================================================================
---
trunk/identity/src/main/org/jboss/portal/identity2/config/IdentityConfigurationMetaDataFactory.java 2006-11-29
00:55:35 UTC (rev 5742)
+++
trunk/identity/src/main/org/jboss/portal/identity2/config/IdentityConfigurationMetaDataFactory.java 2006-11-29
13:29:37 UTC (rev 5743)
@@ -27,10 +27,12 @@
import org.jboss.portal.identity2.config.metadata.ModulesMetaData;
import org.jboss.portal.identity2.config.metadata.OptionsMetaData;
import org.jboss.portal.identity2.config.metadata.ModuleMetaData;
-import org.jboss.portal.identity2.config.metadata.ModuleConfigMetaData;
-import org.jboss.portal.identity2.config.metadata.ModuleConfigOptionMetaData;
+import org.jboss.portal.identity2.config.metadata.ConfigMetaData;
+import org.jboss.portal.identity2.config.metadata.ConfigOptionMetaData;
import org.jboss.portal.identity2.config.metadata.OptionsGroupMetaData;
import org.jboss.portal.identity2.config.metadata.OptionsGroupOptionMetaData;
+import org.jboss.portal.identity2.config.metadata.DatasourcesMetaData;
+import org.jboss.portal.identity2.config.metadata.DatasourceMetaData;
import org.xml.sax.Attributes;
/**
@@ -59,11 +61,29 @@
{
return new ModulesMetaData();
}
+ else if ("datasources".equals(localName))
+ {
+ return new DatasourcesMetaData();
+ }
else if("options".equals(localName))
{
return new OptionsMetaData();
}
}
+ if (root instanceof DatasourcesMetaData)
+ {
+ if ("datasource".equals(localName))
+ {
+ return new DatasourceMetaData();
+ }
+ }
+ if (root instanceof DatasourceMetaData)
+ {
+ if ("config".equals(localName))
+ {
+ return new ConfigMetaData();
+ }
+ }
else if (root instanceof ModulesMetaData)
{
if ("module".equals(localName))
@@ -75,14 +95,14 @@
{
if ("config".equals(localName))
{
- return new ModuleConfigMetaData();
+ return new ConfigMetaData();
}
}
- else if (root instanceof ModuleConfigMetaData)
+ else if (root instanceof ConfigMetaData)
{
if ("option".equals(localName))
{
- return new ModuleConfigOptionMetaData();
+ return new ConfigOptionMetaData();
}
}
else if (root instanceof OptionsMetaData)
@@ -111,12 +131,32 @@
{
identity.setModules((ModulesMetaData)child);
}
+ else if (child instanceof DatasourcesMetaData)
+ {
+ identity.setDatasources((DatasourcesMetaData)child);
+ }
else if (child instanceof OptionsMetaData)
{
identity.setOptions((OptionsMetaData)child);
}
-
}
+ else if (parent instanceof DatasourcesMetaData)
+ {
+ DatasourcesMetaData datasources = (DatasourcesMetaData)parent;
+ if (child instanceof DatasourceMetaData)
+ {
+ datasources.addDatasource((DatasourceMetaData)child);
+ }
+ }
+ else if (parent instanceof DatasourceMetaData)
+ {
+ DatasourceMetaData datasource = (DatasourceMetaData)parent;
+ if (child instanceof ConfigMetaData)
+ {
+ datasource.setConfig((ConfigMetaData)child);
+ }
+ }
+
else if (parent instanceof ModulesMetaData)
{
ModulesMetaData modules = (ModulesMetaData)parent;
@@ -128,17 +168,17 @@
else if (parent instanceof ModuleMetaData)
{
ModuleMetaData module = (ModuleMetaData)parent;
- if (child instanceof ModuleConfigMetaData)
+ if (child instanceof ConfigMetaData)
{
- module.setConfig((ModuleConfigMetaData)child);
+ module.setConfig((ConfigMetaData)child);
}
}
- else if (parent instanceof ModuleConfigMetaData)
+ else if (parent instanceof ConfigMetaData)
{
- ModuleConfigMetaData config = (ModuleConfigMetaData)parent;
- if (child instanceof ModuleConfigOptionMetaData)
+ ConfigMetaData config = (ConfigMetaData)parent;
+ if (child instanceof ConfigOptionMetaData)
{
- config.addOption((ModuleConfigOptionMetaData)child);
+ config.addOption((ConfigOptionMetaData)child);
}
}
else if (parent instanceof OptionsMetaData)
@@ -180,14 +220,29 @@
{
module.setClassName(value);
}
- else if ("jndi-name".equals(localName))
+ }
+ if (object instanceof DatasourceMetaData)
+ {
+ DatasourceMetaData ds = (DatasourceMetaData)object;
+ if ("name".equals(localName))
{
- module.setJndiName(value);
+ log.info("@@@@ adding name: " + value);
+ ds.setName(value);
}
+ else if ("service-name".equals(localName))
+ {
+ log.info("@@@@ adding service name: " + value);
+ ds.setServiceName(value);
+ }
+ else if ("class".equals(localName))
+ {
+ log.info("@@@@ class name: " + value);
+ ds.setClassName(value);
+ }
}
- else if (object instanceof ModuleConfigOptionMetaData)
+ else if (object instanceof ConfigOptionMetaData)
{
- ModuleConfigOptionMetaData option = (ModuleConfigOptionMetaData)object;
+ ConfigOptionMetaData option = (ConfigOptionMetaData)object;
if ("name".equals(localName))
{
option.setName(value);
Copied:
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ConfigMetaData.java
(from rev 5721,
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModuleConfigMetaData.java)
===================================================================
---
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModuleConfigMetaData.java 2006-11-26
02:55:41 UTC (rev 5721)
+++
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ConfigMetaData.java 2006-11-29
13:29:37 UTC (rev 5743)
@@ -0,0 +1,61 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.portal.identity2.config.metadata;
+
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw
Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class ConfigMetaData
+{
+ private Map options;
+
+
+ public ConfigMetaData()
+ {
+ options = new HashMap();
+ }
+
+
+ public Map getOptions()
+ {
+ return options;
+ }
+
+ public void setOptions(Map options)
+ {
+ this.options = options;
+ }
+
+ public void addOption(ConfigOptionMetaData option)
+ {
+ options.put(option.getName(), option);
+ }
+
+ public ConfigOptionMetaData getOption(String name)
+ {
+ return (ConfigOptionMetaData)options.get(name);
+ }
+}
Copied:
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ConfigOptionMetaData.java
(from rev 5733,
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModuleConfigOptionMetaData.java)
===================================================================
---
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModuleConfigOptionMetaData.java 2006-11-28
07:53:40 UTC (rev 5733)
+++
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ConfigOptionMetaData.java 2006-11-29
13:29:37 UTC (rev 5743)
@@ -0,0 +1,58 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.portal.identity2.config.metadata;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw
Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class ConfigOptionMetaData
+{
+ private String name;
+ private String value;
+
+
+ public ConfigOptionMetaData()
+ {
+ }
+
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+
+ public void setValue(String value)
+ {
+ this.value = value;
+ }
+}
Added:
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/DatasourceMetaData.java
===================================================================
---
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/DatasourceMetaData.java 2006-11-29
00:55:35 UTC (rev 5742)
+++
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/DatasourceMetaData.java 2006-11-29
13:29:37 UTC (rev 5743)
@@ -0,0 +1,92 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.portal.identity2.config.metadata;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw
Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class DatasourceMetaData
+{
+ private String name;
+ private String serviceName;
+ private String className;
+ //private String jndiName;
+ private ConfigMetaData config;
+
+
+ public DatasourceMetaData()
+ {
+ }
+
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getServiceName()
+ {
+ return serviceName;
+ }
+
+ public void setServiceName(String serviceName)
+ {
+ this.serviceName = serviceName;
+ }
+
+ public String getClassName()
+ {
+ return className;
+ }
+
+ public void setClassName(String className)
+ {
+ this.className = className;
+ }
+
+ /*public String getJndiName()
+ {
+ return jndiName;
+ }
+
+ public void setJndiName(String jndiName)
+ {
+ this.jndiName = jndiName;
+ }*/
+
+ public ConfigMetaData getConfig()
+ {
+ return config;
+ }
+
+ public void setConfig(ConfigMetaData config)
+ {
+ this.config = config;
+ }
+
+}
Added:
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/DatasourcesMetaData.java
===================================================================
---
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/DatasourcesMetaData.java 2006-11-29
00:55:35 UTC (rev 5742)
+++
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/DatasourcesMetaData.java 2006-11-29
13:29:37 UTC (rev 5743)
@@ -0,0 +1,56 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.portal.identity2.config.metadata;
+
+import java.util.List;
+import java.util.LinkedList;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw
Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class DatasourcesMetaData
+{
+ private List datasources;
+
+
+ public DatasourcesMetaData()
+ {
+ datasources = new LinkedList();
+ }
+
+
+ public List getDatasources()
+ {
+ return datasources;
+ }
+
+ public void setDatasources(List datasources)
+ {
+ this.datasources = datasources;
+ }
+
+ public void addDatasource(DatasourceMetaData datasource)
+ {
+ datasources.add(datasource);
+ }
+}
Modified:
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/IdentityConfigurationMetaData.java
===================================================================
---
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/IdentityConfigurationMetaData.java 2006-11-29
00:55:35 UTC (rev 5742)
+++
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/IdentityConfigurationMetaData.java 2006-11-29
13:29:37 UTC (rev 5743)
@@ -32,6 +32,7 @@
{
private ModulesMetaData modules;
private OptionsMetaData options;
+ private DatasourcesMetaData datasources;
public IdentityConfigurationMetaData()
@@ -58,4 +59,15 @@
{
this.options = options;
}
+
+
+ public DatasourcesMetaData getDatasources()
+ {
+ return datasources;
+ }
+
+ public void setDatasources(DatasourcesMetaData datasources)
+ {
+ this.datasources = datasources;
+ }
}
Deleted:
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModuleConfigMetaData.java
===================================================================
---
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModuleConfigMetaData.java 2006-11-29
00:55:35 UTC (rev 5742)
+++
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModuleConfigMetaData.java 2006-11-29
13:29:37 UTC (rev 5743)
@@ -1,61 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-package org.jboss.portal.identity2.config.metadata;
-
-import java.util.Map;
-import java.util.HashMap;
-
-/**
- * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw
Dawidowicz</a>
- * @version $Revision: 1.1 $
- */
-public class ModuleConfigMetaData
-{
- private Map options;
-
-
- public ModuleConfigMetaData()
- {
- options = new HashMap();
- }
-
-
- public Map getOptions()
- {
- return options;
- }
-
- public void setOptions(Map options)
- {
- this.options = options;
- }
-
- public void addOption(ModuleConfigOptionMetaData option)
- {
- options.put(option.getName(), option);
- }
-
- public ModuleConfigOptionMetaData getOption(String name)
- {
- return (ModuleConfigOptionMetaData)options.get(name);
- }
-}
Deleted:
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModuleConfigOptionMetaData.java
===================================================================
---
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModuleConfigOptionMetaData.java 2006-11-29
00:55:35 UTC (rev 5742)
+++
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModuleConfigOptionMetaData.java 2006-11-29
13:29:37 UTC (rev 5743)
@@ -1,58 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-package org.jboss.portal.identity2.config.metadata;
-
-/**
- * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw
Dawidowicz</a>
- * @version $Revision: 1.1 $
- */
-public class ModuleConfigOptionMetaData
-{
- private String name;
- private String value;
-
-
- public ModuleConfigOptionMetaData()
- {
- }
-
-
- public String getName()
- {
- return name;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
-
- public String getValue()
- {
- return value;
- }
-
- public void setValue(String value)
- {
- this.value = value;
- }
-}
Modified:
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModuleMetaData.java
===================================================================
---
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModuleMetaData.java 2006-11-29
00:55:35 UTC (rev 5742)
+++
trunk/identity/src/main/org/jboss/portal/identity2/config/metadata/ModuleMetaData.java 2006-11-29
13:29:37 UTC (rev 5743)
@@ -31,8 +31,8 @@
private String implementation;
private String serviceName;
private String className;
- private String jndiName;
- private ModuleConfigMetaData config;
+ //private String jndiName;
+ private ConfigMetaData config;
public ModuleMetaData()
@@ -80,7 +80,7 @@
this.className = className;
}
- public String getJndiName()
+ /*public String getJndiName()
{
return jndiName;
}
@@ -88,14 +88,14 @@
public void setJndiName(String jndiName)
{
this.jndiName = jndiName;
- }
+ }*/
- public ModuleConfigMetaData getConfig()
+ public ConfigMetaData getConfig()
{
return config;
}
- public void setConfig(ModuleConfigMetaData config)
+ public void setConfig(ConfigMetaData config)
{
this.config = config;
}
Modified:
trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPConnectionContext.java
===================================================================
---
trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPConnectionContext.java 2006-11-29
00:55:35 UTC (rev 5742)
+++
trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPConnectionContext.java 2006-11-29
13:29:37 UTC (rev 5743)
@@ -27,6 +27,7 @@
import org.jboss.portal.identity2.IdentityConfiguration;
import org.jboss.portal.identity2.service.IdentityModuleService;
import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.common.util.JNDI;
import javax.naming.Context;
import javax.naming.NamingException;
@@ -39,17 +40,17 @@
* @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw
Dawidowicz</a>
* @version $Revision: 1.1 $
*/
-public class LDAPConnectionContext extends IdentityModuleService
+public class LDAPConnectionContext extends AbstractJBossService
{
private static final org.jboss.logging.Logger log =
org.jboss.logging.Logger.getLogger(IdentityModuleService.class);
+ private String jndiName;
+ private JNDI.Binding jndiBinding;
- /*private String name;
+ private String name;
- private String providerUrl;
-
private String contextFactory;
private String adminDN;
@@ -58,8 +59,12 @@
private String protocol;
- private String authentication = "simple";*/
+ private String authentication = "simple";
+ private String host;
+
+ private String port;
+
/*public LDAPConnectionContext(String name,
String url,
String context,
@@ -77,12 +82,14 @@
this.authentication = authentication;
}*/
- public LDAPConnectionContext()
+ /*public LDAPConnectionContext()
{
super(IdentityContext.TYPE_CONNECTION_CONTEXT);
- }
+ }*/
+
+
public InitialLdapContext createInitialContext() throws IdentityException
{
try
@@ -106,14 +113,28 @@
protected void startService() throws Exception
{
- /*if (getInitOptions() == null)
+
+ //
+ if (jndiName != null)
{
- throw new IdentityException("Cannot initialize ConnectionContext - lack of
module init options");
- }*/
+ log.debug("Binding identity module to JNDI with name: " + jndiName);
+ jndiBinding = new JNDI.Binding(jndiName, this);
+ jndiBinding.bind();
+ }
- super.startService(); //To change body of overridden methods use File | Settings
| File Templates.
}
+
+ protected void stopService() throws Exception
+ {
+ if (jndiBinding != null)
+ {
+ jndiBinding.unbind();
+ jndiBinding = null;
+ }
+
+ }
+
public String toString()
{
StringBuffer str = new StringBuffer();
@@ -130,69 +151,82 @@
//************************************
//******* Getters and Setters ********
//************************************
+ public String getAuthentication()
+ {
+ if (authentication == null)
+ {
+ return "simple";
+ }
+ return authentication;
+ }
- public String getName()
+ public void setAuthentication(String authentication)
{
- return getIdentityConfiguration().getValue(IdentityConfiguration.GROUP_CONNECTION,
IdentityConfiguration.CONNECTION_NAME);
- //return (String)getInitOptions().get(IdentityConfiguration.CONNECTION_NAME);
+ this.authentication = authentication;
}
- /*public void setName(String name)
+
+ public String getJndiName()
{
- this.name = name;
- }*/
+ return jndiName;
+ }
- public String getHost()
+ public void setJndiName(String jndiName)
{
- return getIdentityConfiguration().getValue(IdentityConfiguration.GROUP_CONNECTION,
IdentityConfiguration.CONNECTION_HOST);
- //return (String)getInitOptions().get(IdentityConfiguration.CONNECTION_HOST);
+ this.jndiName = jndiName;
}
- /*public void setProviderUrl(String providerUrl)
+ public JNDI.Binding getJndiBinding()
{
- this.providerUrl = providerUrl;
- }*/
+ return jndiBinding;
+ }
- public String getPort()
+ public void setJndiBinding(JNDI.Binding jndiBinding)
{
- return getIdentityConfiguration().getValue(IdentityConfiguration.GROUP_CONNECTION,
IdentityConfiguration.CONNECTION_PORT);
- //return (String)getInitOptions().get(IdentityConfiguration.CONNECTION_PORT);
+ this.jndiBinding = jndiBinding;
}
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
public String getContextFactory()
{
- return getIdentityConfiguration().getValue(IdentityConfiguration.GROUP_CONNECTION,
IdentityConfiguration.CONNECTION_CONTEXT_FACTORY);
- //return
(String)getInitOptions().get(IdentityConfiguration.CONNECTION_CONTEXT_FACTORY);
+ return contextFactory;
}
- /*public void setContextFactory(String contextFactory)
+ public void setContextFactory(String contextFactory)
{
this.contextFactory = contextFactory;
- }*/
+ }
public String getAdminDN()
{
- return getIdentityConfiguration().getValue(IdentityConfiguration.GROUP_CONNECTION,
IdentityConfiguration.CONNECTION_ADMIN_DN);
- //return (String)getInitOptions().get(IdentityConfiguration.CONNECTION_ADMIN_DN);
+ return adminDN;
}
- /*public void setAdminDN(String adminDN)
+ public void setAdminDN(String adminDN)
{
this.adminDN = adminDN;
- }*/
+ }
public String getAdminPassword()
{
- return getIdentityConfiguration().getValue(IdentityConfiguration.GROUP_CONNECTION,
IdentityConfiguration.CONNECTION_ADMIN_PASSWORD);
- //return
(String)getInitOptions().get(IdentityConfiguration.CONNECTION_ADMIN_PASSWORD);
+ return adminPassword;
}
- /*public void setAdminPassword(String adminPassword)
+ public void setAdminPassword(String adminPassword)
{
this.adminPassword = adminPassword;
- }*/
+ }
- /*public String getProtocol()
+ public String getProtocol()
{
return protocol;
}
@@ -200,27 +234,26 @@
public void setProtocol(String protocol)
{
this.protocol = protocol;
- }*/
+ }
- public String getAuthentication()
+ public String getHost()
{
- String auth =
getIdentityConfiguration().getValue(IdentityConfiguration.GROUP_CONNECTION,
IdentityConfiguration.CONNECTION_AUTHENTICATION);
- //String auth =
(String)getInitOptions().get(IdentityConfiguration.CONNECTION_AUTHENTICATION);
- if (auth == null)
- {
- return "simple";
- }
- return auth;
+ return host;
}
- /*public void setAuthentication(String authentication)
+ public void setHost(String host)
{
- this.authentication = authentication;
- }*/
+ this.host = host;
+ }
-
+ public String getPort()
+ {
+ return port;
+ }
-
-
+ public void setPort(String port)
+ {
+ this.port = port;
+ }
}
Modified:
trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPMembershipModule.java
===================================================================
---
trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPMembershipModule.java 2006-11-29
00:55:35 UTC (rev 5742)
+++
trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPMembershipModule.java 2006-11-29
13:29:37 UTC (rev 5743)
@@ -26,6 +26,8 @@
import org.jboss.portal.identity2.service.MembershipModuleService;
import org.jboss.portal.identity.IdentityException;
+import javax.naming.InitialContext;
+
/**
* @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw
Dawidowicz</a>
* @version $Revision: 1.1 $
@@ -40,7 +42,12 @@
private LDAPRoleModule roleModule;
+ protected void startService() throws Exception
+ {
+ connectionContext = (LDAPConnectionContext)new
InitialContext().lookup(getConnectionJNDIName());
+ super.startService(); //To change body of overridden methods use File | Settings
| File Templates.
+ }
//************************************
//******* Getters and Setters ********
@@ -48,17 +55,10 @@
protected LDAPConnectionContext getConnectionContext() throws IdentityException
{
-
if (connectionContext == null)
{
- try
- {
- this.connectionContext =
(LDAPConnectionContext)getIdentityContext().getObject(IdentityContext.TYPE_CONNECTION_CONTEXT);
- }
- catch (ClassCastException e)
- {
- throw new IdentityException("Not supported object as part of the
context", e);
- }
+ //this.connectionContext =
(LDAPConnectionContext)getIdentityContext().getObject(IdentityContext.TYPE_CONNECTION_CONTEXT);
+ throw new IdentityException("No LDAPConnectionContext available");
}
return connectionContext;
}
Modified: trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPRoleModule.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPRoleModule.java 2006-11-29
00:55:35 UTC (rev 5742)
+++ trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPRoleModule.java 2006-11-29
13:29:37 UTC (rev 5743)
@@ -31,6 +31,7 @@
import javax.naming.directory.Attribute;
import javax.naming.NamingException;
import javax.naming.NamingEnumeration;
+import javax.naming.InitialContext;
import java.util.NoSuchElementException;
/**
@@ -43,6 +44,15 @@
private LDAPConnectionContext connectionContext;
+
+ protected void startService() throws Exception
+ {
+ connectionContext = (LDAPConnectionContext)new
InitialContext().lookup(getConnectionJNDIName());
+
+ super.startService(); //To change body of overridden methods use File | Settings
| File Templates.
+ }
+
+
protected LDAPRoleImpl createRoleInstance(Attributes attrs, String dn) throws
IdentityException
{
LDAPRoleImpl ldapr = null;
@@ -143,7 +153,8 @@
{
if (connectionContext == null)
{
- this.connectionContext =
(LDAPConnectionContext)getIdentityContext().getObject(IdentityContext.TYPE_CONNECTION_CONTEXT);
+ //this.connectionContext =
(LDAPConnectionContext)getIdentityContext().getObject(IdentityContext.TYPE_CONNECTION_CONTEXT);
+ throw new IdentityException("No LDAPConnectionContext available");
}
return connectionContext;
}
Modified: trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPUserModule.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPUserModule.java 2006-11-29
00:55:35 UTC (rev 5742)
+++ trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPUserModule.java 2006-11-29
13:29:37 UTC (rev 5743)
@@ -33,6 +33,7 @@
import javax.naming.directory.Attribute;
import javax.naming.NamingException;
import javax.naming.NamingEnumeration;
+import javax.naming.InitialContext;
import java.util.NoSuchElementException;
import java.util.Map;
@@ -48,9 +49,16 @@
private LDAPConnectionContext connectionContext;
- private UserProfileModule userProfileModule;
+ private UserProfileModule userProfileModule;
-
+
+ protected void startService() throws Exception
+ {
+ connectionContext = (LDAPConnectionContext)new
InitialContext().lookup(getConnectionJNDIName());
+
+ super.startService(); //To change body of overridden methods use File | Settings
| File Templates.
+ }
+
//TODO: add enabled
public LDAPUserImpl createUserInstance(Attributes attrs, String dn) throws
IdentityException
{
@@ -184,7 +192,8 @@
{
if (connectionContext == null)
{
- this.connectionContext =
(LDAPConnectionContext)getIdentityContext().getObject(IdentityContext.TYPE_CONNECTION_CONTEXT);
+ //this.connectionContext =
(LDAPConnectionContext)getIdentityContext().getObject(IdentityContext.TYPE_CONNECTION_CONTEXT);
+ throw new IdentityException("No LDAPConnectionContext available");
}
return connectionContext;
}
Modified:
trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPUserProfileModule.java
===================================================================
---
trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPUserProfileModule.java 2006-11-29
00:55:35 UTC (rev 5742)
+++
trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPUserProfileModule.java 2006-11-29
13:29:37 UTC (rev 5743)
@@ -23,7 +23,10 @@
package org.jboss.portal.identity2.ldap;
import org.jboss.portal.identity2.service.UserProfileModuleService;
+import org.jboss.portal.identity.IdentityException;
+import javax.naming.InitialContext;
+
/**
* @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw
Dawidowicz</a>
* @version $Revision: 1.1 $
@@ -32,8 +35,20 @@
{
private LDAPConnectionContext connectionContext;
- public LDAPConnectionContext getConnectionContext()
+ protected void startService() throws Exception
{
+ connectionContext = (LDAPConnectionContext)new
InitialContext().lookup(getConnectionJNDIName());
+
+ super.startService(); //To change body of overridden methods use File | Settings
| File Templates.
+ }
+
+ protected LDAPConnectionContext getConnectionContext() throws IdentityException
+ {
+ if (connectionContext == null)
+ {
+ //this.connectionContext =
(LDAPConnectionContext)getIdentityContext().getObject(IdentityContext.TYPE_CONNECTION_CONTEXT);
+ throw new IdentityException("No LDAPConnectionContext available");
+ }
return connectionContext;
}
Modified:
trunk/identity/src/main/org/jboss/portal/identity2/service/IdentityModuleService.java
===================================================================
---
trunk/identity/src/main/org/jboss/portal/identity2/service/IdentityModuleService.java 2006-11-29
00:55:35 UTC (rev 5742)
+++
trunk/identity/src/main/org/jboss/portal/identity2/service/IdentityModuleService.java 2006-11-29
13:29:37 UTC (rev 5743)
@@ -39,6 +39,8 @@
private String jndiName;
+ private String connectionJNDIName;
+
private IdentityContext identityContext;
private IdentityConfiguration identityConfiguration;
@@ -160,4 +162,15 @@
{
return moduleType;
}
+
+
+ public String getConnectionJNDIName()
+ {
+ return connectionJNDIName;
+ }
+
+ public void setConnectionJNDIName(String connectionJNDIName)
+ {
+ this.connectionJNDIName = connectionJNDIName;
+ }
}
Modified:
trunk/identity/src/main/org/jboss/portal/identity2/service/UserProfileModuleService.java
===================================================================
---
trunk/identity/src/main/org/jboss/portal/identity2/service/UserProfileModuleService.java 2006-11-29
00:55:35 UTC (rev 5742)
+++
trunk/identity/src/main/org/jboss/portal/identity2/service/UserProfileModuleService.java 2006-11-29
13:29:37 UTC (rev 5743)
@@ -45,3 +45,4 @@
}
+
Added: trunk/identity/src/main/org/jboss/portal/test/identity/ConfigurationTestCase.java
===================================================================
---
trunk/identity/src/main/org/jboss/portal/test/identity/ConfigurationTestCase.java 2006-11-29
00:55:35 UTC (rev 5742)
+++
trunk/identity/src/main/org/jboss/portal/test/identity/ConfigurationTestCase.java 2006-11-29
13:29:37 UTC (rev 5743)
@@ -0,0 +1,156 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.portal.test.identity;
+
+import org.apache.log4j.Appender;
+import org.apache.log4j.ConsoleAppender;
+import org.apache.log4j.SimpleLayout;
+import org.apache.log4j.Logger;
+import org.apache.log4j.Level;
+import org.jboss.portal.identity2.IdentityContextImpl;
+import org.jboss.portal.identity2.IdentityServiceControllerImpl;
+import org.jboss.portal.identity2.IdentityContext;
+import org.jboss.portal.identity2.service.IdentityModuleService;
+import org.jboss.portal.identity2.config.SimpleConfigurationImpl;
+import org.jboss.portal.test.framework.TestRuntimeContext;
+
+
+import java.util.Set;
+import java.util.Iterator;
+
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss dot
com">Boleslaw Dawidowicz</a>
+ * @version $Revision: 5247 $
+ */
+public class ConfigurationTestCase extends junit.framework.TestCase
+{
+
+ private static final org.jboss.logging.Logger log =
org.jboss.logging.Logger.getLogger(ConfigurationTestCase.class);
+
+ static
+ {
+ Appender appender = new ConsoleAppender(new SimpleLayout());
+ Logger.getRoot().addAppender(appender);
+ Logger.getRoot().setLevel(Level.INFO);
+ Logger.getLogger("org.jboss.portal.identity2").setLevel(Level.DEBUG);
+ }
+
+ /*public static TestSuite createTestSuite(Class clazz) throws Exception
+ {
+ URL configsURL =
Thread.currentThread().getContextClassLoader().getResource("directories.xml");
+ Map parameterMap = new HashMap();
+ parameterMap.put("DirectoryServerConfig",
DSConfig.fromXML2(configsURL));
+ POJOJUnitTest abc = new POJOJUnitTest(clazz);
+ JUnitAdapter adapter = new JUnitAdapter(abc);
+ TestSuite suite = new TestSuite();
+ suite.addTest(adapter);
+ return suite;
+ }*/
+
+ public ConfigurationTestCase()
+ {
+
+ }
+
+ /*public ConfigurationTestCase(DSConfig dsConfig)
+ {
+ this.directoryServerConfigParameter = dsConfig;
+ }
+
+ private DSConfig directoryServerConfigParameter;
+
+ public String getName()
+ {
+ return super.getName();// + "," +
directoryServerConfigParameter.getName() + "," +
directoryServerConfigParameter.getDescription();
+ }
+
+ public DSConfig getDirectoryServerConfigParameter()
+ {
+ return directoryServerConfigParameter;
+ }
+
+ public void setDirectoryServerConfigParameter(DSConfig
directoryServerConfigParameter)
+ {
+ this.directoryServerConfigParameter = directoryServerConfigParameter;
+ }*/
+
+ IdentityContextImpl context;
+
+
+ public void setUp() throws Exception
+ {
+ TestRuntimeContext runtimeContext = new
TestRuntimeContext("org/jboss/portal/test/identity/ldap-beans.xml");
+ runtimeContext.addBean("LDAPTestBean", this);
+ runtimeContext.start();
+ this.context = new IdentityContextImpl();
+ context.start();
+
+
+ }
+
+ /*public void testSimpleConfigurationFactory() throws Exception
+ {
+ SimpleConfigurationImpl configuration = new SimpleConfigurationImpl();
+ configuration.setIdentityContext(context);
+ configuration.setConfigFile("identityconfig/test-config.xml");
+ configuration.start();
+ Set keys = configuration.getOptionGroups().keySet();
+ log.info("Option Groups:");
+ for (Iterator iterator = keys.iterator(); iterator.hasNext();)
+ {
+ String group = (String)iterator.next();
+ log.info("option-group: " + group);
+
+ log.info("Options:");
+ Set names = configuration.getOptions(group).keySet();
+ for (Iterator iterator1 = names.iterator(); iterator1.hasNext();)
+ {
+ String optionName = (String)iterator1.next();
+ log.info("Name: " + optionName);
+
+ }
+
+ }
+
+
+
assertEquals("uid",configuration.getValue("user.uidAttributeId"));
+ }*/
+
+
+ public void testIdentityServiceController() throws Exception
+ {
+ IdentityServiceControllerImpl controller = new IdentityServiceControllerImpl();
+ controller.setRegisterMBeans(false);
+ controller.setConfigFile("config/minimal-ldap-identity-config.xml");
+ controller.setDefaultConfigFile("config/standardidentity-config.xml");
+ controller.start();
+
+ IdentityModuleService service =
(IdentityModuleService)controller.getIdentityContext().getObject(IdentityContext.TYPE_USER_MODULE);
+ assertEquals("java:/portal/UserModule", service.getJndiName());
+ }
+
+
+
+
+}
Modified:
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPStaticRoleMembershipModuleTestCase.java
===================================================================
---
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPStaticRoleMembershipModuleTestCase.java 2006-11-29
00:55:35 UTC (rev 5742)
+++
trunk/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPStaticRoleMembershipModuleTestCase.java 2006-11-29
13:29:37 UTC (rev 5743)
@@ -86,6 +86,7 @@
((MembershipModuleService)identityContext.getObject(IdentityContext.TYPE_MEMBERSHIP_MODULE)).stop();
MembershipModuleService membership = new LDAPStaticRoleMembershipModuleImpl();
membership.setIdentityContext(identityContext);
+ membership.setConnectionJNDIName("java:/portal/LDAPConnectionContext");
membership.start();
userModule =
(UserModule)identityContext.getObject(IdentityContext.TYPE_USER_MODULE);
Modified: trunk/identity/src/resources/draft/standardidentity-config.xml
===================================================================
--- trunk/identity/src/resources/draft/standardidentity-config.xml 2006-11-29 00:55:35 UTC
(rev 5742)
+++ trunk/identity/src/resources/draft/standardidentity-config.xml 2006-11-29 13:29:37 UTC
(rev 5743)
@@ -22,6 +22,68 @@
~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org. ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<identity-configuration>
+ <datasources>
+ <datasouce>
+ <!--schema that maps hibernate objects-->
+ <name>Identity</name>
+
+ <class>blah.IdentitySessionFactoryBinder</class>
+ <service-name>portal:service=Hibernate,type=Identity</service-name>
+
+ <config>
+ <option>
+ <name>DoChecking</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>ProfileConfigLocation</name>
+ <value>conf/hibernate/user/profile-config.xml</value>
+ </option>
+ <option>
+ <name>ConfigLocation</name>
+ <value>conf/hibernate/user/hibernate.cfg.xml</value>
+ </option>
+ <option>
+ <name>SetupLocation</name>
+ <value>conf/hibernate/user/setup.txt</value>
+ </option>
+ <option>
+ <name>JNDIName</name>
+ <value>java:/portal/UserSessionFactory</value>
+ </option>
+ </config>
+ </datasouce>
+ <datasouce>
+ <!--schema that provides dynamic database property store for ldap impl-->
+ <name>Dynamic</name>
+
+ <class>org.jboss.portal.jems.hibernate.SessionFactoryBinder</class>
+
<service-name>portal:service=Hibernate,type=UserDynProfile</service-name>
+
+ <config>
+ <option>
+ <name>DoChecking</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>ProfileConfigLocation</name>
+ <value>conf/hibernate/user/profile-config.xml</value>
+ </option>
+ <option>
+ <name>ConfigLocation</name>
+ <value>conf/hibernate/user/hibernate.cfg.xml</value>
+ </option>
+ <option>
+ <name>SetupLocation</name>
+ <value>conf/hibernate/user/setup.txt</value>
+ </option>
+ <option>
+ <name>JNDIName</name>
+ <value>java:/portal/DynamicProfileSessionFactory</value>
+ </option>
+ </config>
+ </datasouce>
+ </datasources>
<modules>
<module>
<!--type used to correctly map in IdentityContext registry-->
Modified: trunk/identity/src/resources/test/config/standardidentity-config.xml
===================================================================
--- trunk/identity/src/resources/test/config/standardidentity-config.xml 2006-11-29
00:55:35 UTC (rev 5742)
+++ trunk/identity/src/resources/test/config/standardidentity-config.xml 2006-11-29
13:29:37 UTC (rev 5743)
@@ -22,6 +22,68 @@
~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org. ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<identity-configuration>
+ <datasources>
+ <datasouce>
+ <!--schema that maps hibernate objects-->
+ <name>Identity</name>
+
+ <class>blah.IdentitySessionFactoryBinder</class>
+ <service-name>portal:service=Hibernate,type=Identity</service-name>
+
+ <config>
+ <option>
+ <name>DoChecking</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>ProfileConfigLocation</name>
+ <value>conf/hibernate/user/profile-config.xml</value>
+ </option>
+ <option>
+ <name>ConfigLocation</name>
+ <value>conf/hibernate/user/hibernate.cfg.xml</value>
+ </option>
+ <option>
+ <name>SetupLocation</name>
+ <value>conf/hibernate/user/setup.txt</value>
+ </option>
+ <option>
+ <name>JNDIName</name>
+ <value>java:/portal/UserSessionFactory</value>
+ </option>
+ </config>
+ </datasouce>
+ <datasouce>
+ <!--schema that provides dynamic database property store for ldap impl-->
+ <name>Dynamic</name>
+
+ <class>org.jboss.portal.jems.hibernate.SessionFactoryBinder</class>
+
<service-name>portal:service=Hibernate,type=UserDynProfile</service-name>
+
+ <config>
+ <option>
+ <name>DoChecking</name>
+ <value>true</value>
+ </option>
+ <option>
+ <name>ProfileConfigLocation</name>
+ <value>conf/hibernate/user/profile-config.xml</value>
+ </option>
+ <option>
+ <name>ConfigLocation</name>
+ <value>conf/hibernate/user/hibernate.cfg.xml</value>
+ </option>
+ <option>
+ <name>SetupLocation</name>
+ <value>conf/hibernate/user/setup.txt</value>
+ </option>
+ <option>
+ <name>JNDIName</name>
+ <value>java:/portal/DynamicProfileSessionFactory</value>
+ </option>
+ </config>
+ </datasouce>
+ </datasources>
<modules>
<module>
<!--type used to correctly map in IdentityContext registry-->
Modified: trunk/test/src/etc/identityconfig/opends-config.xml
===================================================================
--- trunk/test/src/etc/identityconfig/opends-config.xml 2006-11-29 00:55:35 UTC (rev
5742)
+++ trunk/test/src/etc/identityconfig/opends-config.xml 2006-11-29 13:29:37 UTC (rev
5743)
@@ -22,53 +22,55 @@
~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org. ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<identity-configuration>
+ <datasources>
+ <datasource>
+ <name>LDAP</name>
+ <config>
+ <option>
+ <name>host</name>
+ <value>localhost</value>
+ </option>
+ <option>
+ <name>port</name>
+ <value>10389</value>
+ </option>
+ <option>
+ <name>adminDN</name>
+ <value>cn=Directory Manager</value>
+ </option>
+ <option>
+ <name>adminPassword</name>
+ <value>password</value>
+ </option>
+ </config>
+ </datasource>
+ </datasources>
<modules>
<module>
<!--type used to correctly map in IdentityContext registry-->
- <type>UserModule</type>
+ <type>User</type>
<implementation>LDAP</implementation>
+ <config/>
</module>
<module>
- <type>RoleModule</type>
+ <type>Role</type>
<implementation>LDAP</implementation>
+ <config/>
</module>
<module>
- <type>MembershipModule</type>
+ <type>Membership</type>
<implementation>LDAP</implementation>
+ <config/>
</module>
<module>
- <type>UserProfileModule</type>
+ <type>UserProfile</type>
<implementation>LDAP</implementation>
+ <config/>
</module>
-
- <!--For ldap configuration this is needed additionally to use ldap
connection...-->
- <module>
- <type>ConnectionContext</type>
- <implementation>LDAP</implementation>
- </module>
</modules>
<options>
<option-group>
- <group-name>connection</group-name>
- <option>
- <name>host</name>
- <value>localhost</value>
- </option>
- <option>
- <name>port</name>
- <value>10389</value>
- </option>
- <option>
- <name>admin-dn</name>
- <value>cn=Directory Manager</value>
- </option>
- <option>
- <name>admin-password</name>
- <value>password</value>
- </option>
- </option-group>
- <option-group>
<group-name>common</group-name>
<option>
<name>userContainerDN</name>
Modified: trunk/test/src/etc/identityconfig/rhds-config.xml
===================================================================
--- trunk/test/src/etc/identityconfig/rhds-config.xml 2006-11-29 00:55:35 UTC (rev 5742)
+++ trunk/test/src/etc/identityconfig/rhds-config.xml 2006-11-29 13:29:37 UTC (rev 5743)
@@ -22,23 +22,50 @@
~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org. ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<identity-configuration>
+ <datasources>
+ <datasource>
+ <name>LDAP</name>
+ <config>
+ <option>
+ <name>host</name>
+ <value>dev39.qa.atl.jboss.com</value>
+ </option>
+ <option>
+ <name>port</name>
+ <value>10389</value>
+ </option>
+ <option>
+ <name>adminDN</name>
+ <value>cn=Directory Manager</value>
+ </option>
+ <option>
+ <name>adminPassword</name>
+ <value>qpq123qpq</value>
+ </option>
+ </config>
+ </datasource>
+ </datasources>
<modules>
<module>
<!--type used to correctly map in IdentityContext registry-->
- <type>UserModule</type>
+ <type>User</type>
<implementation>LDAP</implementation>
+ <config/>
</module>
<module>
- <type>RoleModule</type>
+ <type>Role</type>
<implementation>LDAP</implementation>
+ <config/>
</module>
<module>
- <type>MembershipModule</type>
+ <type>Membership</type>
<implementation>LDAP</implementation>
+ <config/>
</module>
<module>
- <type>UserProfileModule</type>
+ <type>UserProfile</type>
<implementation>LDAP</implementation>
+ <config/>
</module>
<!--For ldap configuration this is needed additionally to use ldap
connection...-->
@@ -47,28 +74,8 @@
<implementation>LDAP</implementation>
</module>
</modules>
-
<options>
<option-group>
- <group-name>connection</group-name>
- <option>
- <name>host</name>
- <value>dev39.qa.atl.jboss.com</value>
- </option>
- <option>
- <name>port</name>
- <value>10389</value>
- </option>
- <option>
- <name>admin-dn</name>
- <value>cn=Directory Manager</value>
- </option>
- <option>
- <name>admin-password</name>
- <value>qpq123qpq</value>
- </option>
- </option-group>
- <option-group>
<group-name>common</group-name>
<option>
<name>userContainerDN</name>
Modified: trunk/test/src/etc/identityconfig/standardidentity-config.xml
===================================================================
--- trunk/test/src/etc/identityconfig/standardidentity-config.xml 2006-11-29 00:55:35 UTC
(rev 5742)
+++ trunk/test/src/etc/identityconfig/standardidentity-config.xml 2006-11-29 13:29:37 UTC
(rev 5743)
@@ -22,10 +22,44 @@
~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org. ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<identity-configuration>
+ <datasources>
+ <datasource>
+ <name>LDAP</name>
+ <!--name of service and class for creating mbean-->
+
<service-name>portal:service=Module,type=LDAPConnectionContext</service-name>
+
<class>org.jboss.portal.identity2.ldap.LDAPConnectionContext</class>
+ <config>
+ <option>
+ <name>host</name>
+ <value>jboss.com</value>
+ </option>
+ <option>
+ <name>port</name>
+ <value>389</value>
+ </option>
+ <option>
+ <name>contextFactory</name>
+ <value>com.sun.jndi.ldap.LdapCtxFactory</value>
+ </option>
+ <option>
+ <name>adminDN</name>
+ <value>cn=Directory Manager</value>
+ </option>
+ <option>
+ <name>adminPassword</name>
+ <value>password</value>
+ </option>
+ <option>
+ <name>jndiName</name>
+ <value>java:/portal/LDAPConnectionContext</value>
+ </option>
+ </config>
+ </datasource>
+ </datasources>
<modules>
<module>
<!--type used to correctly map in IdentityContext registry-->
- <type>UserModule</type>
+ <type>User</type>
<implementation>DB</implementation>
<!--name of service and class for creating mbean-->
@@ -39,12 +73,16 @@
<name>SessionFactoryJNDIName</name>
<value>java:/portal/UserSessionFactory</value>
</option>
+ <option>
+ <name>jndiName</name>
+ <value>java:/portal/UserModule</value>
+ </option>
</config>
</module>
<module>
<!--type used to correctly map in IdentityContext registry-->
- <type>RoleModule</type>
+ <type>Role</type>
<implementation>DB</implementation>
<!--name of service and class for creating mbean-->
@@ -58,12 +96,16 @@
<name>SessionFactoryJNDIName</name>
<value>java:/portal/UserSessionFactory</value>
</option>
+ <option>
+ <name>jndiName</name>
+ <value>java:/portal/RoleModule</value>
+ </option>
</config>
</module>
<module>
<!--type used to correctly map in IdentityContext registry-->
- <type>MembershipModule</type>
+ <type>Membership</type>
<implementation>DB</implementation>
<!--name of service and class for creating mbean-->
@@ -77,12 +119,16 @@
<name>SessionFactoryJNDIName</name>
<value>java:/portal/UserSessionFactory</value>
</option>
+ <option>
+ <name>jndiName</name>
+ <value>java:/portal/MembershipModule</value>
+ </option>
</config>
</module>
<module>
<!--type used to correctly map in IdentityContext registry-->
- <type>UserProfileModule</type>
+ <type>UserProfile</type>
<implementation>DB</implementation>
<!--name of service and class for creating mbean-->
@@ -96,13 +142,17 @@
<name>SessionFactoryJNDIName</name>
<value>java:/portal/UserSessionFactory</value>
</option>
+ <option>
+ <name>jndiName</name>
+ <value>java:/portal/UserProfileModule</value>
+ </option>
</config>
</module>
<!--for ldap modules...-->
<module>
<!--type used to correctly map in IdentityContext registry-->
- <type>UserModule</type>
+ <type>User</type>
<implementation>LDAP</implementation>
<!--name of service and class for creating mbean-->
@@ -111,12 +161,21 @@
<jndi-name>java:/portal/UserModule</jndi-name>
<!--set of options that are passed to a class constructor-->
- <config/>
+ <config>
+ <option>
+ <name>jndiName</name>
+ <value>java:/portal/UserModule</value>
+ </option>
+ <option>
+ <name>connectionJNDIName</name>
+ <value>java:/portal/LDAPConnectionContext</value>
+ </option>
+ </config>
</module>
<module>
<!--type used to correctly map in IdentityContext registry-->
- <type>RoleModule</type>
+ <type>Role</type>
<implementation>LDAP</implementation>
<!--name of service and class for creating mbean-->
@@ -125,12 +184,21 @@
<jndi-name>java:/portal/RoleModule</jndi-name>
<!--set of options that are passed to a class constructor-->
- <config/>
+ <config>
+ <option>
+ <name>jndiName</name>
+ <value>java:/portal/RoleModule</value>
+ </option>
+ <option>
+ <name>connectionJNDIName</name>
+ <value>java:/portal/LDAPConnectionContext</value>
+ </option>
+ </config>
</module>
<module>
<!--type used to correctly map in IdentityContext registry-->
- <type>MembershipModule</type>
+ <type>Membership</type>
<implementation>LDAP</implementation>
<!--name of service and class for creating mbean-->
@@ -139,12 +207,21 @@
<jndi-name>java:/portal/MembershipModule</jndi-name>
<!--set of options that are passed to a class constructor-->
- <config/>
+ <config>
+ <option>
+ <name>jndiName</name>
+ <value>java:/portal/MembershipModule</value>
+ </option>
+ <option>
+ <name>connectionJNDIName</name>
+ <value>java:/portal/LDAPConnectionContext</value>
+ </option>
+ </config>
</module>
<module>
<!--type used to correctly map in IdentityContext registry-->
- <type>UserProfileModule</type>
+ <type>UserProfile</type>
<implementation>LDAP</implementation>
<!--name of service and class for creating mbean-->
@@ -159,58 +236,28 @@
<value>java:/portal/UserSessionFactory</value>
</option>-->
<!--Hibernate mappings for db level store (dynamic properties not mapped
as ldap attributes)-->
- <option>
+ <!--<option>
<name>SessionFactoryJNDIName</name>
<value>java:/portal/PropertyStoreSessionFactory</value>
</option>
<option>
<name>profileMappings</name>
<value>ldap-profile.xml</value>
+ </option>-->
+ <option>
+ <name>jndiName</name>
+ <value>java:/portal/UserProfileModule</value>
</option>
+ <option>
+ <name>connectionJNDIName</name>
+ <value>java:/portal/LDAPConnectionContext</value>
+ </option>
</config>
</module>
- <!--For ldap configuration this is needed additionally to use ldap
connection...-->
- <module>
- <!--type used to correctly map in IdentityContext registry-->
- <type>ConnectionContext</type>
- <implementation>LDAP</implementation>
-
- <!--name of service and class for creating mbean-->
-
<service-name>portal:service=Module,type=LDAPConnectionContext</service-name>
-
<class>org.jboss.portal.identity2.ldap.LDAPConnectionContext</class>
- <jndi-name>java:/portal/LDAPConnectionContext</jndi-name>
-
- <!--set of options that are passed to a class constructor-->
- <config/>
- </module>
</modules>
<options>
- <option-group>
- <group-name>connection</group-name>
- <option>
- <name>host</name>
- <value>jboss.com</value>
- </option>
- <option>
- <name>port</name>
- <value>389</value>
- </option>
- <option>
- <name>context-factory</name>
- <value>com.sun.jndi.ldap.LdapCtxFactory</value>
- </option>
- <option>
- <name>admin-dn</name>
- <value>cn=Directory Manager</value>
- </option>
- <option>
- <name>admin-password</name>
- <value>password</value>
- </option>
- </option-group>
-
<!--Common options section-->
<option-group>
<group-name>common</group-name>
@@ -293,5 +340,101 @@
<value>uid=dummynonexistinguser,ou=People,dc=jboss,dc=org</value>
</option>
</option-group>
+ <option-group>
+ <group-name>userProfileMappings</group-name>
+ <option>
+ <name>portal.user.name.given</name>
+ <!--inetOrgPerson-->
+ <value>givenName</value>
+ </option>
+ <!--<option>
+ <name>portal.user.name.family</name>
+ <value></value>
+ </option>
+ <option>
+ <name>portal.user.location</name>
+ <value></value>
+ </option>-->
+ <option>
+ <name>portal.user.occupation</name>
+ <!--inetOrgPerson-->
+ <value>title</value>
+ </option>
+ <!--<option>
+ <name>portal.user.extra</name>
+ <value></value>
+ </option>-->
+ <option>
+ <name>portal.user.signature</name>
+ <!--newPilotPerson-->
+ <value>personalSignature</value>
+ </option>
+ <!--<option>
+ <name>portal.user.interests</name>
+ <value></value>
+ </option>-->
+ <option>
+ <name>portal.user.locale</name>
+ <!--inetOrgPerson-->
+ <value>localityName</value><!--or prefferedLanguage-->
+ </option>
+ <!--<option>
+ <name>portal.user.im.icq</name>
+ <value></value>
+ </option>
+ <option>
+ <name>portal.user.im.aim</name>
+ <value></value>
+ </option>
+ <option>
+ <name>portal.user.im.msnm</name>
+ <value></value>
+ </option>
+ <option>
+ <name>portal.user.im.yim</name>
+ <value></value>
+ </option>
+ <option>
+ <name>portal.user.im.skype</name>
+ <value></value>
+ </option>-->
+ <option>
+ <name>portal.user.homepage</name>
+ <!--inetOrgPerson-->
+ <value>seeAlso</value>
+ </option>
+ <!--<option>
+ <name>portal.user.time-zone-offset</name>
+ <value></value>
+ </option>
+ <option>
+ <name>portal.user.theme</name>
+ <value></value>
+ </option>
+ <option>
+ <name>portal.user.security.question</name>
+ <value></value>
+ </option>
+ <option>
+ <name>portal.user.security.answer</name>
+ <value></value>
+ </option>
+ <option>
+ <name>portal.user.email.fake</name>
+ <value></value>
+ </option>
+ <option>
+ <name>portal.user.email.view-real</name>
+ <value></value>
+ </option>
+ <option>
+ <name>portal.user.last-login-date</name>
+ <value></value>
+ </option>
+ <option>
+ <name>portal.user.registration-date</name>
+ <value></value>
+ </option>-->
+ </option-group>
</options>
</identity-configuration>
\ No newline at end of file