Author: bdaw
Date: 2007-08-22 20:13:18 -0400 (Wed, 22 Aug 2007)
New Revision: 8043
Added:
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/identity/service/
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/identity/service/IdentityServiceControllerImpl.java
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/identity/service/SimpleServiceJNDIBinder.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/ServiceJNDIBinder.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/ConfigMetaData.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/ConfigOptionMetaData.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/ConfigurationParser.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/DatasourceMetaData.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/DatasourcesMetaData.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/IdentityConfigurationMetaData.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/IdentityConfigurationMetaDataFactory.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/IdentityMetadataProcessor.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/ModuleMetaData.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/ModulesMetaData.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/OptionsGroupMetaData.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/OptionsGroupOptionMetaData.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/OptionsMetaData.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/profile/
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/profile/LocalizedStringMetaData.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/profile/LocalizedValueMetaData.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/profile/ProfileMetaData.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/profile/ProfileMetaDataFactory.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/profile/PropertyMappingDatabaseMetaData.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/profile/PropertyMappingLDAPMetaData.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/profile/PropertyMappingMetaData.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/profile/PropertyMetaData.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/profile/info/
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/profile/info/ProfileInfoSupport.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/profile/info/PropertyInfoSupport.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/service/
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/service/DatasourceServiceMetaData.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/service/DatasourceServicesMetaData.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/service/IdentityServicesMetaData.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/service/ModuleServiceMetaData.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/service/ModuleServicesMetaData.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/test/identity/TestServiceLoader.java
Removed:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/config/SimpleConfigurationImpl.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/config/SimpleIdentityConfigurationFactory.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/config/info/
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/config/metadata/
Modified:
branches/JBoss_Portal_Branch_2_6/build/ide/intellij/idea60/modules/core/core.iml
branches/JBoss_Portal_Branch_2_6/build/ide/intellij/idea60/modules/identity/identity.iml
branches/JBoss_Portal_Branch_2_6/build/ide/intellij/idea60/modules/jems/jems.iml
branches/JBoss_Portal_Branch_2_6/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans-security.xml
branches/JBoss_Portal_Branch_2_6/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans-workflow.xml
branches/JBoss_Portal_Branch_2_6/core/build.xml
branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/conf/identity/ldap_identity-config.xml
branches/JBoss_Portal_Branch_2_6/identity/build.xml
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/DelegatingUserProfileModuleImpl.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/IdentityContextImpl.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/db/HibernateMembershipModuleImpl.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/db/HibernateRoleModuleImpl.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/db/HibernateUserModuleImpl.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/db/HibernateUserProfileModuleImpl.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/ldap/LDAPConnectionContext.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/ldap/LDAPMembershipModule.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleModule.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModule.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserProfileModule.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/ldap/helper/LDAPTools.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/service/IdentityConfigurationService.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/service/IdentityEventManagerService.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/service/IdentityModuleService.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/service/UserProfileModuleService.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/test/identity/db/DBIdentityTestCase.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/test/identity/db/DBTestCase.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPExtRoleModuleTestCase.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPExtUserModuleTestCase.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPIdentityTestCase.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPSimpleRoleModuleTestCase.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPSimpleUserModuleTestCase.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPStaticGroupMembershipModuleTestCase.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPStaticRoleMembershipModuleTestCase.java
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPUserProfileModuleTestCase.java
branches/JBoss_Portal_Branch_2_6/portlet/src/main/org/jboss/portal/portlet/state/StateConversionException.java
branches/JBoss_Portal_Branch_2_6/portlet/src/main/org/jboss/portal/portlet/state/StateManagementPolicy.java
branches/JBoss_Portal_Branch_2_6/portlet/src/main/org/jboss/portal/portlet/state/consumer/ConsumerPersistenceManager.java
branches/JBoss_Portal_Branch_2_6/portlet/src/main/org/jboss/portal/portlet/state/consumer/ConsumerState.java
branches/JBoss_Portal_Branch_2_6/portlet/src/main/org/jboss/portal/portlet/state/consumer/ConsumerStateContext.java
branches/JBoss_Portal_Branch_2_6/search/src/main/org/jboss/portal/search/FederatedSearcher.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/portlet/UserContextPortlet.java
Log:
- Identity module refactoring to drop jems dependency
Modified:
branches/JBoss_Portal_Branch_2_6/build/ide/intellij/idea60/modules/core/core.iml
===================================================================
---
branches/JBoss_Portal_Branch_2_6/build/ide/intellij/idea60/modules/core/core.iml 2007-08-22
23:03:16 UTC (rev 8042)
+++
branches/JBoss_Portal_Branch_2_6/build/ide/intellij/idea60/modules/core/core.iml 2007-08-23
00:13:18 UTC (rev 8043)
@@ -216,7 +216,6 @@
<SOURCES />
</library>
</orderEntry>
- <orderEntry type="module" module-name="jems" />
<orderEntry type="module-library">
<library>
<CLASSES>
@@ -303,6 +302,16 @@
<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" module-name="jems" />
<orderEntryProperties />
</component>
<component name="VcsManagerConfiguration">
Modified:
branches/JBoss_Portal_Branch_2_6/build/ide/intellij/idea60/modules/identity/identity.iml
===================================================================
---
branches/JBoss_Portal_Branch_2_6/build/ide/intellij/idea60/modules/identity/identity.iml 2007-08-22
23:03:16 UTC (rev 8042)
+++
branches/JBoss_Portal_Branch_2_6/build/ide/intellij/idea60/modules/identity/identity.iml 2007-08-23
00:13:18 UTC (rev 8043)
@@ -145,6 +145,15 @@
<SOURCES />
</library>
</orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root
url="jar://$MODULE_DIR$/../../../../../../thirdparty/jboss-portal/modules/test/lib/portal-test-lib.jar!/"
/>
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
<orderEntryProperties />
</component>
<component name="VcsManagerConfiguration">
Modified:
branches/JBoss_Portal_Branch_2_6/build/ide/intellij/idea60/modules/jems/jems.iml
===================================================================
---
branches/JBoss_Portal_Branch_2_6/build/ide/intellij/idea60/modules/jems/jems.iml 2007-08-22
23:03:16 UTC (rev 8042)
+++
branches/JBoss_Portal_Branch_2_6/build/ide/intellij/idea60/modules/jems/jems.iml 2007-08-23
00:13:18 UTC (rev 8043)
@@ -235,6 +235,15 @@
<SOURCES />
</library>
</orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root
url="jar://$MODULE_DIR$/../../../../../../thirdparty/jboss-portal/modules/common/lib/portal-common-lib.jar!/"
/>
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
<orderEntryProperties />
</component>
<component name="VcsManagerConfiguration">
Modified:
branches/JBoss_Portal_Branch_2_6/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans-security.xml
===================================================================
---
branches/JBoss_Portal_Branch_2_6/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans-security.xml 2007-08-22
23:03:16 UTC (rev 8042)
+++
branches/JBoss_Portal_Branch_2_6/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans-security.xml 2007-08-23
00:13:18 UTC (rev 8043)
@@ -69,7 +69,7 @@
</property>
</bean>
- <bean name="IdentityServiceController"
class="org.jboss.portal.identity.IdentityServiceControllerImpl">
+ <bean name="IdentityServiceController"
class="org.jboss.portal.core.identity.service.IdentityServiceControllerImpl">
<property name="configFile">db-config.xml</property>
<property
name="defaultConfigFile">standardidentity-config.xml</property>
<property name="registerMBeans">false</property>
Modified:
branches/JBoss_Portal_Branch_2_6/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans-workflow.xml
===================================================================
---
branches/JBoss_Portal_Branch_2_6/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans-workflow.xml 2007-08-22
23:03:16 UTC (rev 8042)
+++
branches/JBoss_Portal_Branch_2_6/cms/src/resources/portal-cms-jar/org/jboss/portal/cms/jboss-beans-workflow.xml 2007-08-23
00:13:18 UTC (rev 8043)
@@ -158,7 +158,7 @@
</property>
</bean>
- <bean name="IdentityServiceController"
class="org.jboss.portal.identity.IdentityServiceControllerImpl">
+ <bean name="IdentityServiceController"
class="org.jboss.portal.core.identity.service.IdentityServiceControllerImpl">
<property name="configFile">db-config.xml</property>
<property
name="defaultConfigFile">standardidentity-config.xml</property>
<property name="registerMBeans">false</property>
Modified: branches/JBoss_Portal_Branch_2_6/core/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/build.xml 2007-08-22 23:03:16 UTC (rev 8042)
+++ branches/JBoss_Portal_Branch_2_6/core/build.xml 2007-08-23 00:13:18 UTC (rev 8043)
@@ -91,6 +91,7 @@
<path refid="jboss.portal/modules/web.classpath"/>
<path refid="jboss.portal/modules/test.classpath"/>
<path refid="jboss/backport.concurrent.classpath"/>
+ <path refid="jboss.microcontainer.classpath"/>
<path refid="jboss.jbossxb.classpath"/>
<path refid="jboss.cache.classpath"/>
<path refid="jbossas/core.libs.classpath"/>
Copied:
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/identity/service/IdentityServiceControllerImpl.java
(from rev 8000,
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/IdentityServiceControllerImpl.java)
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/identity/service/IdentityServiceControllerImpl.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/identity/service/IdentityServiceControllerImpl.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -0,0 +1,254 @@
+/*
+* 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.core.identity.service;
+
+import org.jboss.portal.jems.as.system.AbstractJBossService;
+import org.jboss.portal.jems.as.system.JBossServiceModelMBean;
+import org.jboss.portal.jems.as.JNDI;
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.IdentityContext;
+import org.jboss.portal.identity.IdentityContextImpl;
+import org.jboss.portal.identity.IdentityServiceController;
+import org.jboss.portal.identity.ServiceJNDIBinder;
+import org.jboss.portal.identity.boot.IdentityServiceLoader;
+import org.jboss.portal.identity.event.IdentityEventBroadcaster;
+import org.jboss.portal.identity.event.IdentityEvent;
+import org.jboss.portal.identity.metadata.service.IdentityServicesMetaData;
+import org.jboss.portal.identity.service.IdentityConfigurationService;
+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 javax.management.ObjectName;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw
Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class IdentityServiceControllerImpl extends AbstractJBossService implements
IdentityServiceController {
+
+ private static final org.jboss.logging.Logger log =
org.jboss.logging.Logger.getLogger(IdentityServiceControllerImpl.class);
+
+ private String jndiName;
+
+ protected JNDI.Binding jndiBinding;
+
+ private IdentityContext identityContext;
+
+ private boolean registerMBeans = true;
+
+ private String configFile;
+
+ private String defaultConfigFile;
+
+ private IdentityEventBroadcaster identityEventBroadcaster;
+
+ /**
+ * .
+ */
+ protected Kernel kernel;
+
+
+ protected void startService() throws Exception
+ {
+ if (jndiName != null)
+ {
+ jndiBinding = new JNDI.Binding(jndiName, this);
+ jndiBinding.bind();
+ }
+
+ //initialize microcontainer stuff
+ try
+ {
+ BasicBootstrap bootstrap = new BasicBootstrap();
+ bootstrap.run();
+ kernel = bootstrap.getKernel();
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException(e);
+ }
+
+ IdentityServicesMetaData servicesMetaData = new
IdentityServicesMetaData(defaultConfigFile, configFile);
+
+ identityContext = bootstrapIdentityContext();
+
+
+ // IdentityEventBroadcaster
+ IdentityEventBroadcaster broadcaster = identityEventBroadcaster;
+ if(broadcaster == null)
+ {
+ broadcaster = new IdentityEventBroadcaster()
+ {
+ public void fireEvent(IdentityEvent event)
+ {
+ // Noop
+ }
+ };
+ }
+
+ //
+ try
+ {
+ identityContext.register(broadcaster,
IdentityContext.TYPE_IDENTITY_EVENT_BROADCASTER);
+ }
+ catch (Throwable throwable)
+ {
+ throw new IdentityException("Unable to install
IdentityEventBroadcaster", throwable);
+ }
+
+
+ //process the list of modules, instantiate them, configure them, tide them
+ try
+ {
+
+ //inject configuration service
+ IdentityConfigurationService configuration =
servicesMetaData.getConfigurationService();
+ configuration.setIdentityContext(identityContext);
+ //TODO:set proper jndiName and serviceName and JNDI binder
+ configuration.start();
+
+ IdentityServiceLoader serviceLoader = new IdentityServiceLoader(identityContext,
kernel, registerMBeans) {
+
+ protected void registerMBean(String serviceName, Object serviceObject) throws
Exception
+ {
+ JBossServiceModelMBean mbean = new JBossServiceModelMBean(serviceObject);
+ getServer().registerMBean(mbean, new ObjectName(serviceName));
+ }
+
+
+ protected ServiceJNDIBinder getServiceJNDIBinder() throws Exception
+ {
+ return new SimpleServiceJNDIBinder();
+ }
+ };
+
+ // process datasources and modules
+
serviceLoader.bootstrapDatasource(servicesMetaData.getDatasourceServices().getDatasourcesList());
+
+
serviceLoader.bootstrapModules(servicesMetaData.getModuleServices().getModulesList());
+
+ }
+ catch (Throwable e)
+ {
+ throw new IdentityException("Cannot initiate identity modules: ", e);
+ }
+ }
+
+
+ protected void stopService() throws Exception
+ {
+ if (jndiBinding != null)
+ {
+ jndiBinding.unbind();
+ jndiBinding = null;
+ }
+
+ }
+
+ private IdentityContext bootstrapIdentityContext() throws Exception
+ {
+ KernelControllerContext identityKernelContext;
+ try
+ {
+ AbstractBeanMetaData contextBMD = new AbstractBeanMetaData(
+ "portal:identity=IdentityContext",
+ IdentityContextImpl.class.getName());
+ //beans.add(contextBMD);
+ identityKernelContext = kernel.getController().install(contextBMD);
+ return (IdentityContext)identityKernelContext.getTarget();
+
+ }
+ catch (Throwable throwable)
+ {
+ throw new IdentityException("Unable to install
IdentityContext",throwable);
+ }
+
+ }
+
+
+ public IdentityContext getIdentityContext()
+ {
+ return identityContext;
+ }
+
+ public String getConfigFile()
+ {
+ return configFile;
+ }
+
+ public void setConfigFile(String configFile)
+ {
+ this.configFile = configFile;
+ }
+
+ public String getDefaultConfigFile()
+ {
+ return defaultConfigFile;
+ }
+
+ public void setDefaultConfigFile(String defaultConfigFile)
+ {
+ this.defaultConfigFile = defaultConfigFile;
+ }
+
+ public String getJndiName()
+ {
+ return jndiName;
+ }
+
+ public void setJndiName(String jndiName)
+ {
+ this.jndiName = jndiName;
+ }
+
+ public JNDI.Binding getJndiBinding()
+ {
+ return jndiBinding;
+ }
+
+ public void setJndiBinding(JNDI.Binding jndiBinding)
+ {
+ this.jndiBinding = jndiBinding;
+ }
+
+ public boolean isRegisterMBeans()
+ {
+ return registerMBeans;
+ }
+
+ public void setRegisterMBeans(boolean registerMBeans)
+ {
+ this.registerMBeans = registerMBeans;
+ }
+
+ public IdentityEventBroadcaster getIdentityEventBroadcaster()
+ {
+ return identityEventBroadcaster;
+ }
+
+ public void setIdentityEventBroadcaster(IdentityEventBroadcaster
identityEventBroadcaster)
+ {
+ this.identityEventBroadcaster = identityEventBroadcaster;
+ }
+}
Added:
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/identity/service/SimpleServiceJNDIBinder.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/identity/service/SimpleServiceJNDIBinder.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/identity/service/SimpleServiceJNDIBinder.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -0,0 +1,65 @@
+/*
+* 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.core.identity.service;
+
+import org.jboss.portal.identity.ServiceJNDIBinder;
+import org.jboss.util.naming.NonSerializableFactory;
+
+import javax.naming.CompositeName;
+import javax.naming.NameNotFoundException;
+
+/**
+ * Really dummy JNDI binder
+ *
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version $Revision: 0.1 $
+ */
+public class SimpleServiceJNDIBinder implements ServiceJNDIBinder
+{
+ public void bind(String jndiName, Object service) throws Exception
+ {
+ if (jndiName == null)
+ {
+ new IllegalArgumentException("Null JNDI name to bind");
+ }
+ if (service == null)
+ {
+ new IllegalArgumentException("Null service to bind to JNDI");
+ }
+ NonSerializableFactory.rebind(new CompositeName(jndiName), service, true);
+ }
+
+ public void unbind(String jndiName)
+ {
+ if (jndiName != null)
+ {
+ try
+ {
+ NonSerializableFactory.unbind(jndiName);
+ }
+ catch (NameNotFoundException ignore)
+ {
+ }
+ }
+ }
+}
Modified:
branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-08-22
23:03:16 UTC (rev 8042)
+++
branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-08-23
00:13:18 UTC (rev 8043)
@@ -529,7 +529,7 @@
<xmbean/>
</mbean>
<mbean
- code="org.jboss.portal.identity.IdentityServiceControllerImpl"
+
code="org.jboss.portal.core.identity.service.IdentityServiceControllerImpl"
name="portal:service=Module,type=IdentityServiceController"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
Modified:
branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/conf/identity/ldap_identity-config.xml
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/conf/identity/ldap_identity-config.xml 2007-08-22
23:03:16 UTC (rev 8042)
+++
branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/conf/identity/ldap_identity-config.xml 2007-08-23
00:13:18 UTC (rev 8043)
@@ -59,11 +59,17 @@
<!--type used to correctly map in IdentityContext registry-->
<type>User</type>
<implementation>LDAP</implementation>
+ <class>
+ org.jboss.portal.identity.ldap.LDAPExtUserModuleImpl
+ </class>
<config/>
</module>
<module>
<type>Role</type>
<implementation>LDAP</implementation>
+ <class>
+ org.jboss.portal.identity.ldap.LDAPExtRoleModuleImpl
+ </class>
<config/>
</module>
<module>
@@ -106,42 +112,18 @@
<value>ou=People,o=test,dc=portal,dc=example,dc=com</value>
</option>
<option>
+ <name>userSearchFilter</name>
+
<value><![CDATA[(&((uid={0})(objectClass=person)))]]></value>
+ </option>
+ <option>
<name>roleCtxDN</name>
<value>ou=Roles,o=test,dc=portal,dc=example,dc=com</value>
</option>
- </option-group>
- <option-group>
- <group-name>userCreateAttibutes</group-name>
<option>
- <name>objectClass</name>
- <!--This objectclasses should work with Red Hat Directory-->
- <value>top</value>
- <value>person</value>
- <value>inetOrgPerson</value>
+ <name>roleSearchFilter</name>
+
<value><![CDATA[(&((cn={0})(objectClass=groupOfNames)))]]></value>
</option>
- <!--Schema requires those to have initial value-->
- <option>
- <name>cn</name>
- <value>none</value>
- </option>
- <option>
- <name>sn</name>
- <value>none</value>
- </option>
</option-group>
- <option-group>
- <group-name>roleCreateAttibutes</group-name>
- <!--Schema requires those to have initial value-->
- <option>
- <name>cn</name>
- <value>none</value>
- </option>
- <!--Some directory servers require this attribute to be valid DN-->
- <!--For safety reasons point to the admin user here-->
- <option>
- <name>member</name>
-
<value>uid=admin,ou=People,o=test,dc=portal,dc=example,dc=com</value>
- </option>
- </option-group>
+
</options>
</identity-configuration>
\ No newline at end of file
Modified: branches/JBoss_Portal_Branch_2_6/identity/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/identity/build.xml 2007-08-22 23:03:16 UTC (rev
8042)
+++ branches/JBoss_Portal_Branch_2_6/identity/build.xml 2007-08-23 00:13:18 UTC (rev
8043)
@@ -111,7 +111,6 @@
<!-- Configure modules -->
<call target="configure-modules"/>
<path id="dependentmodule.classpath">
- <path refid="jboss.portal-jems.classpath"/>
</path>
<!--+=======================================+-->
@@ -389,7 +388,7 @@
<path refid="cglib.cglib.classpath"/>
<path refid="jboss.portal/modules/test.classpath"/>
<path refid="jboss.portal/modules/common.classpath"/>
- <path refid="jboss.portal-jems.classpath"/>
+ <!--<path refid="jboss.portal-jems.classpath"/>-->
<path refid="sun.jaf.classpath"/>
</x-classpath>
</execute-tests>
@@ -454,7 +453,7 @@
<path refid="cglib.cglib.classpath"/>
<path refid="jboss.portal/modules/test.classpath"/>
<path refid="jboss.portal/modules/common.classpath"/>
- <path refid="jboss.portal-jems.classpath"/>
+ <!--<path refid="jboss.portal-jems.classpath"/>-->
<path refid="sleepycat.sleepycat.classpath"/>
<path refid="sun.jaf.classpath"/>
</x-classpath>
@@ -479,14 +478,14 @@
<x-test>
<!--<test todir="${test.reports}"
name="org.jboss.portal.test.identity.db.DBIdentityTestCase"/>-->
- <test todir="${test.reports}"
name="org.jboss.portal.test.identity.ldap.LDAPIdentityTestCase"/>
+ <!--<test todir="${test.reports}"
name="org.jboss.portal.test.identity.ldap.LDAPIdentityTestCase"/>-->
<!--<test todir="${test.reports}"
name="org.jboss.portal.test.identity.ldap.LDAPSimpleUserModuleTestCase"/>-->
- <!--<test todir="${test.reports}"
name="org.jboss.portal.test.identity.ldap.LDAPSimpleRoleModuleTestCase"/>-->
- <!--<test todir="${test.reports}"
name="org.jboss.portal.test.identity.ldap.LDAPStaticGroupMembershipModuleTestCase"/>-->
- <!--<test todir="${test.reports}"
name="org.jboss.portal.test.identity.ldap.LDAPStaticRoleMembershipModuleTestCase"/>-->
- <!--<test todir="${test.reports}"
name="org.jboss.portal.test.identity.ldap.LDAPUserProfileModuleTestCase"/>-->
- <!--<test todir="${test.reports}"
name="org.jboss.portal.test.identity.ldap.LDAPExtUserModuleTestCase"/>-->
- <!--<test todir="${test.reports}"
name="org.jboss.portal.test.identity.ldap.LDAPExtRoleModuleTestCase"/>-->
+ <!--<test todir="${test.reports}"
name="org.jboss.portal.test.identity.ldap.LDAPSimpleRoleModuleTestCase"/>
+ <test todir="${test.reports}"
name="org.jboss.portal.test.identity.ldap.LDAPStaticGroupMembershipModuleTestCase"/>-->
+ <test todir="${test.reports}"
name="org.jboss.portal.test.identity.ldap.LDAPStaticRoleMembershipModuleTestCase"/>
+ <!--<test todir="${test.reports}"
name="org.jboss.portal.test.identity.ldap.LDAPUserProfileModuleTestCase"/>
+ <test todir="${test.reports}"
name="org.jboss.portal.test.identity.ldap.LDAPExtUserModuleTestCase"/>
+ <test todir="${test.reports}"
name="org.jboss.portal.test.identity.ldap.LDAPExtRoleModuleTestCase"/>-->
</x-test>
<x-classpath>
<pathelement
location="${build.lib}/portal-identity-lib.jar"/>
@@ -521,7 +520,7 @@
<path refid="cglib.cglib.classpath"/>
<path refid="jboss.portal/modules/test.classpath"/>
<path refid="jboss.portal/modules/common.classpath"/>
- <path refid="jboss.portal-jems.classpath"/>
+ <!--<path refid="jboss.portal-jems.classpath"/>-->
<path refid="sleepycat.sleepycat.classpath"/>
<path refid="sun.jaf.classpath"/>
</x-classpath>
Modified:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/DelegatingUserProfileModuleImpl.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/DelegatingUserProfileModuleImpl.java 2007-08-22
23:03:16 UTC (rev 8042)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/DelegatingUserProfileModuleImpl.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -52,9 +52,9 @@
private UserProfileModule dbModule;
- protected void startService() throws Exception
+ public void start() throws Exception
{
- super.startService();
+ super.start();
if(getProfileInfo() == null)
{
@@ -263,4 +263,14 @@
return LDAPModule;
}
+
+ public void setLDAPModule(UserProfileModule LDAPModule)
+ {
+ this.LDAPModule = LDAPModule;
+ }
+
+ public void setDbModule(UserProfileModule dbModule)
+ {
+ this.dbModule = dbModule;
+ }
}
Modified:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/IdentityContextImpl.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/IdentityContextImpl.java 2007-08-22
23:03:16 UTC (rev 8042)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/IdentityContextImpl.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -21,7 +21,6 @@
*/
package org.jboss.portal.identity;
-import org.jboss.portal.jems.as.system.AbstractJBossService;
import org.jboss.portal.common.util.CopyOnWriteRegistry;
import java.util.Collection;
@@ -32,9 +31,10 @@
* @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw
Dawidowicz</a>
* @version $Revision: 1.1 $
*/
-public class IdentityContextImpl extends AbstractJBossService implements IdentityContext
{
- //private static final org.jboss.logging.Logger log =
org.jboss.logging.Logger.getLogger(IdentityContextImpl.class);
+public class IdentityContextImpl implements IdentityContext {
+ private static final org.jboss.logging.Logger log =
org.jboss.logging.Logger.getLogger(IdentityContextImpl.class);
+
private final CopyOnWriteRegistry registry;
public IdentityContextImpl()
Added:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/ServiceJNDIBinder.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/ServiceJNDIBinder.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/ServiceJNDIBinder.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -0,0 +1,38 @@
+/*
+* 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.identity;
+
+/**
+ * Simple interface to hide JNDI binding logic
+ *
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version $Revision: 0.1 $
+ */
+public interface ServiceJNDIBinder
+{
+ public void bind(String jndiName, Object service) throws Exception;
+
+ public void unbind(String jndiName);
+
+
+}
Deleted:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/config/SimpleConfigurationImpl.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/config/SimpleConfigurationImpl.java 2007-08-22
23:03:16 UTC (rev 8042)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/config/SimpleConfigurationImpl.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -1,318 +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.identity.config;
-
-import org.jboss.portal.jems.as.JNDI;
-import org.jboss.portal.identity.IdentityConfiguration;
-import org.jboss.portal.identity.IdentityContext;
-import org.jboss.portal.jems.as.system.AbstractJBossService;
-import org.jboss.portal.identity.IdentityException;
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.ObjectModelFactory;
-import org.jboss.xb.binding.UnmarshallerFactory;
-
-import java.util.Map;
-import java.util.Set;
-import java.net.URL;
-import java.io.InputStream;
-
-/**
- * Immutable object storing options in simple manner
- *
- * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw
Dawidowicz</a>
- * @version $Revision: 1.1 $
- */
-public class SimpleConfigurationImpl extends AbstractJBossService implements
IdentityConfiguration
-{
-
- private Map data;
-
- private String jndiName;
-
- private String configFile;
-
- protected JNDI.Binding jndiBinding;
-
- private IdentityContext identityContext;
-
- protected void startService() throws Exception
- {
-
-
- try
- {
- log.info("Processing portal identity configuration");
- log.debug("config file: " + configFile);
- URL config =
Thread.currentThread().getContextClassLoader().getResource(configFile);
- InputStream in = config.openStream();
- // create unmarshaller
- Unmarshaller unmarshaller =
UnmarshallerFactory.newInstance().newUnmarshaller();
-
- // create an instance of ObjectModelFactory
- ObjectModelFactory factory = new SimpleIdentityConfigurationFactory();
-
- // let the object model factory to create an instance of Map and populate it
with data from XML
- data = (Map)unmarshaller.unmarshal(in, factory, null);
-
- // close the XML stream
- in.close();
- }
- catch (Exception e)
- {
- throw new IdentityException("Cannot parse configuration file", e);
- }
-
- //
- if (jndiName != null)
- {
- jndiBinding = new JNDI.Binding(jndiName, this);
- jndiBinding.bind();
- }
-
- if (identityContext == null)
- {
- throw new IdentityException("Cannot register module in context - missing
reference");
- }
- else
- {
- identityContext.register(this, IdentityContext.TYPE_IDENTITY_CONFIGURATION);
- }
-
-
- }
-
-
- protected void stopService() throws Exception
- {
- if (jndiBinding != null)
- {
- jndiBinding.unbind();
- jndiBinding = null;
- }
-
- if (identityContext == null)
- {
- log.error("Cannot unregister module in context - missing reference");
- }
- else
- {
- identityContext.unregister(IdentityContext.TYPE_IDENTITY_CONFIGURATION);
- }
-
- }
-
-
-
- public Set getValues(String optionGroup, String option)
- {
- if (optionGroup == null)
- {
- throw new IllegalArgumentException("null option group");
- }
- if (option == null)
- {
- throw new IllegalArgumentException("null option name");
- }
- if (data.containsKey(optionGroup))
- {
- Map group = (Map)data.get(optionGroup);
- if (group.containsKey(option))
- {
- return (Set)group.get(option);
- }
- }
- return null;
- }
-
- public String getValue(String optionGroup, String option)
- {
- if (optionGroup == null)
- {
- throw new IllegalArgumentException("null option group");
- }
- if (option == null)
- {
- throw new IllegalArgumentException("null option name");
- }
- if (data.containsKey(optionGroup))
- {
- Map group = (Map)data.get(optionGroup);
- if (group.containsKey(option))
- {
- Set values = (Set)group.get(option);
- if (values.size() > 0)
- {
- return (String)values.toArray()[0];
- }
- }
- }
- return null;
- }
-
- public String getValue(String option)
- {
- if (option == null)
- {
- throw new IllegalArgumentException("null option name");
- }
- if (data.containsKey(GROUP_COMMON))
- {
- Map group = (Map)data.get(GROUP_COMMON);
- if (group.containsKey(option))
- {
- Set values = (Set)group.get(option);
- if (values.size() > 0)
- {
- return (String)values.toArray()[0];
- }
- }
- }
- return null;
- }
-
- public void setValues(String optionGroup, String option, Set values)
- {
- if (optionGroup == null)
- {
- throw new IllegalArgumentException("null option group");
- }
- if (option == null)
- {
- throw new IllegalArgumentException("null option name");
- }
- if (values == null)
- {
- throw new IllegalArgumentException("null values list");
- }
- if (data.containsKey(optionGroup))
- {
- ((Map)data.get(optionGroup)).put(option, values);
- }
- }
-
- public void addValue(String optionGroup, String option, String value)
- {
- if (optionGroup == null)
- {
- throw new IllegalArgumentException("null option group");
- }
- if (option == null)
- {
- throw new IllegalArgumentException("null option name");
- }
- if (value == null)
- {
- throw new IllegalArgumentException("null value name");
- }
- if (data.containsKey(optionGroup))
- {
- Map group = (Map)data.get(optionGroup);
- if (group.containsKey(option))
- {
- ((Set)group.get(option)).add(value);
- }
- }
- }
-
- public Map getOptions(String optionGroup)
- {
- if (optionGroup == null)
- {
- throw new IllegalArgumentException("null option group");
- }
- if (data.containsKey(optionGroup))
- {
- return (Map)data.get(optionGroup);
- }
- return null;
- }
-
- public void setOptions(String optionGroup, Map options)
- {
- if (optionGroup == null)
- {
- throw new IllegalArgumentException("null option group");
- }
- if (options == null)
- {
- throw new IllegalArgumentException("null options map");
- }
- data.put(optionGroup,options);
- }
-
- public void remoeOption(String optionGroup, String option)
- {
- if (optionGroup == null)
- {
- throw new IllegalArgumentException("null option group");
- }
- if (option == null)
- {
- throw new IllegalArgumentException("null option name");
- }
- if (data.containsKey(optionGroup))
- {
- ((Map)data.get(optionGroup)).put(option, null);
- }
- }
-
-
- public void setData(Map data)
- {
- this.data = data;
- }
-
- public Map getOptionGroups()
- {
- return data;
- }
-
- public String getJndiName()
- {
- return jndiName;
- }
-
- public void setJndiName(String jndiName)
- {
- this.jndiName = jndiName;
- }
-
- public String getConfigFile()
- {
- return configFile;
- }
-
- public void setConfigFile(String configFile)
- {
- this.configFile = configFile;
- }
-
- public IdentityContext getIdentityContext()
- {
- return identityContext;
- }
-
- public void setIdentityContext(IdentityContext identityContext)
- {
- this.identityContext = identityContext;
- }
-}
Deleted:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/config/SimpleIdentityConfigurationFactory.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/config/SimpleIdentityConfigurationFactory.java 2007-08-22
23:03:16 UTC (rev 8042)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/config/SimpleIdentityConfigurationFactory.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -1,117 +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.identity.config;
-
-import org.jboss.xb.binding.UnmarshallingContext;
-import org.jboss.xb.binding.GenericObjectModelFactory;
-import org.xml.sax.Attributes;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-import java.util.HashSet;
-
-/**
- * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw
Dawidowicz</a>
- * @version $Revision: 1.1 $
- */
-public class SimpleIdentityConfigurationFactory implements GenericObjectModelFactory
-{
- private static final org.jboss.logging.Logger log =
org.jboss.logging.Logger.getLogger(SimpleIdentityConfigurationFactory.class);
-
- String currentGroupName;
-
- String currentOptionName;
-
- public Object newRoot(Object object, UnmarshallingContext unmarshallingContext, String
string, String string1, Attributes attributes)
- {
- return new HashMap();
- }
-
- public Object completeRoot(Object root, UnmarshallingContext unmarshallingContext,
String string, String string1)
- {
- return root;
- }
-
- public Object newChild(Object root, UnmarshallingContext nav, String nsURI, String
localName, Attributes attrs)
- {
- //return a new map for group options
- if ("option-group".equals(localName))
- {
- return new HashMap();
- }
- //return list for option values
- if ("option".equals(localName))
- {
- return new HashSet();
- }
- if (root instanceof Set)
- {
- if ("value".equals(localName))
- {
- return root;
- }
- }
- return null;
- }
-
- public void addChild(Object parent, Object child, UnmarshallingContext nav, String
nsURI, String localName)
- {
- if (child instanceof Set && parent instanceof Map)
- {
- if ("option".equals(localName))
- {
- ((Map)parent).put(this.currentOptionName, child);
- }
- }
- if (child instanceof Map && parent instanceof Map)
- {
- if ("option-group".equals(localName))
- {
- ((Map)parent).put(this.currentGroupName, child);
- }
- }
- }
-
- public void setValue(Object object, UnmarshallingContext unmarshallingContext, String
nsUri, String localName, String value)
- {
- if(object instanceof Map)
- {
- if ("group-name".equals(localName))
- {
- this.currentGroupName = value;
- }
- }
- if(object instanceof Set)
- {
- if ("name".equals(localName))
- {
- this.currentOptionName = value;
- }
- if ("value".equals(localName))
- {
- Set option = (Set)object;
- option.add(value);
- }
- }
- }
-}
Modified:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/db/HibernateMembershipModuleImpl.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/db/HibernateMembershipModuleImpl.java 2007-08-22
23:03:16 UTC (rev 8042)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/db/HibernateMembershipModuleImpl.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -60,21 +60,21 @@
private HibernateUserModuleImpl userModule;
- protected void startService() throws Exception
+ public void start() throws Exception
{
//
sessionFactory = (SessionFactory)new
InitialContext().lookup(sessionFactoryJNDIName);
- super.startService();
+ super.start();
}
- protected void stopService() throws Exception
+ public void stop() throws Exception
{
//
sessionFactory = null;
- super.stopService();
+ super.stop();
}
public String getSessionFactoryJNDIName()
Modified:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/db/HibernateRoleModuleImpl.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/db/HibernateRoleModuleImpl.java 2007-08-22
23:03:16 UTC (rev 8042)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/db/HibernateRoleModuleImpl.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -59,21 +59,21 @@
/** . */
protected String sessionFactoryJNDIName;
- protected void startService() throws Exception
+ public void start() throws Exception
{
//
sessionFactory = (SessionFactory)new
InitialContext().lookup(sessionFactoryJNDIName);
- super.startService();
+ super.start();
}
- protected void stopService() throws Exception
+ public void stop() throws Exception
{
//
sessionFactory = null;
- super.stopService();
+ super.stop();
}
// public SessionFactory getSessionFactory()
Modified:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/db/HibernateUserModuleImpl.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/db/HibernateUserModuleImpl.java 2007-08-22
23:03:16 UTC (rev 8042)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/db/HibernateUserModuleImpl.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -36,7 +36,6 @@
import java.util.Set;
import java.util.Iterator;
-import EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet </a>
@@ -55,21 +54,21 @@
/** . */
protected String sessionFactoryJNDIName;
- protected void startService() throws Exception
+ public void start() throws Exception
{
//
sessionFactory = (SessionFactory)new
InitialContext().lookup(sessionFactoryJNDIName);
- super.startService();
+ super.start();
}
- protected void stopService() throws Exception
+ public void stop() throws Exception
{
//
sessionFactory = null;
- super.stopService();
+ super.stop();
}
public String getSessionFactoryJNDIName()
Modified:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/db/HibernateUserProfileModuleImpl.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/db/HibernateUserProfileModuleImpl.java 2007-08-22
23:03:16 UTC (rev 8042)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/db/HibernateUserProfileModuleImpl.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -73,20 +73,20 @@
private boolean randomSynchronizePassword = false;
- protected void startService() throws Exception
+ public void start() throws Exception
{
//
sessionFactory = (SessionFactory)new
InitialContext().lookup(sessionFactoryJNDIName);
- super.startService();
+ super.start();
}
- protected void stopService() throws Exception
+ public void stop() throws Exception
{
//
sessionFactory = null;
- super.stopService();
+ super.stop();
}
public String getSessionFactoryJNDIName()
Modified:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/ldap/LDAPConnectionContext.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/ldap/LDAPConnectionContext.java 2007-08-22
23:03:16 UTC (rev 8042)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/ldap/LDAPConnectionContext.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -22,10 +22,10 @@
******************************************************************************/
package org.jboss.portal.identity.ldap;
-import org.jboss.portal.jems.as.system.AbstractJBossService;
import org.jboss.portal.identity.service.IdentityModuleService;
import org.jboss.portal.identity.IdentityException;
-import org.jboss.portal.jems.as.JNDI;
+import org.jboss.portal.identity.ServiceJNDIBinder;
+import org.jboss.portal.identity.IdentityContext;
import javax.naming.Context;
import javax.naming.NamingException;
@@ -39,15 +39,17 @@
* @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw
Dawidowicz</a>
* @version $Revision: 1.1 $
*/
-public class LDAPConnectionContext extends AbstractJBossService
+public class LDAPConnectionContext
{
private static final org.jboss.logging.Logger log =
org.jboss.logging.Logger.getLogger(IdentityModuleService.class);
private String jndiName;
- private JNDI.Binding jndiBinding;
+ private ServiceJNDIBinder jndiBinder;
+ //private JNDI.Binding jndiBinding;
+
private String name;
private String contextFactory;
@@ -66,7 +68,9 @@
private String externalContextJndiName;
+ private IdentityContext identityContext;
+
public Hashtable getEnvironment()
{
Hashtable env = new Hashtable();
@@ -108,26 +112,33 @@
}
- protected void startService() throws Exception
+ public void start() throws Exception
{
//
- if (jndiName != null)
+ if (jndiName != null && jndiBinder != null)
{
log.debug("Binding identity module to JNDI with name: " + jndiName);
- jndiBinding = new JNDI.Binding(jndiName, this);
- jndiBinding.bind();
+ //jndiBinding = new JNDI.Binding(jndiName, this);
+ //jndiBinding.bind();
+ jndiBinder.bind(jndiName, this);
}
+ if (identityContext != null)
+ {
+ identityContext.register(this, IdentityContext.TYPE_CONNECTION_CONTEXT);
+ }
+
}
- protected void stopService() throws Exception
+ public void stop() throws Exception
{
- if (jndiBinding != null)
+ if (jndiName != null && jndiBinder != null)
{
- jndiBinding.unbind();
- jndiBinding = null;
+ //jndiBinding.unbind();
+ //jndiBinding = null;
+ jndiBinder.unbind(jndiName);
}
}
@@ -176,16 +187,6 @@
this.jndiName = jndiName;
}
- public JNDI.Binding getJNDIBinding()
- {
- return jndiBinding;
- }
-
- public void setJNDIBinding(JNDI.Binding jndiBinding)
- {
- this.jndiBinding = jndiBinding;
- }
-
public String getName()
{
return name;
@@ -267,4 +268,24 @@
this.externalContextJndiName = externalContextJndiName;
}
+ public ServiceJNDIBinder getJndiBinder()
+ {
+ return jndiBinder;
+ }
+
+ public void setJndiBinder(ServiceJNDIBinder jndiBinder)
+ {
+ this.jndiBinder = jndiBinder;
+ }
+
+
+ public IdentityContext getIdentityContext()
+ {
+ return identityContext;
+ }
+
+ public void setIdentityContext(IdentityContext identityContext)
+ {
+ this.identityContext = identityContext;
+ }
}
Modified:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/ldap/LDAPMembershipModule.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/ldap/LDAPMembershipModule.java 2007-08-22
23:03:16 UTC (rev 8042)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/ldap/LDAPMembershipModule.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -27,6 +27,7 @@
import org.jboss.portal.identity.IdentityException;
import javax.naming.InitialContext;
+import javax.naming.NamingException;
/**
* @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw
Dawidowicz</a>
@@ -42,16 +43,23 @@
private LDAPRoleModule roleModule;
- protected void startService() throws Exception
+ public void start() throws Exception
{
if (getConnectionJNDIName() == null)
{
throw new IdentityException("Cannot obtain ldap connection context JNDI
name");
}
-
- connectionContext = (LDAPConnectionContext)new
InitialContext().lookup(getConnectionJNDIName());
- super.startService(); //To change body of overridden methods use File | Settings
| File Templates.
+ try
+ {
+ connectionContext = (LDAPConnectionContext)new
InitialContext().lookup(getConnectionJNDIName());
+ }
+ catch (NamingException e)
+ {
+ log.error("Couldn't obtain connection context");
+ }
+
+ super.start(); //To change body of overridden methods use File | Settings | File
Templates.
}
//************************************
@@ -62,8 +70,14 @@
{
if (connectionContext == null)
{
- //this.connectionContext =
(LDAPConnectionContext)getIdentityContext().getObject(IdentityContext.TYPE_CONNECTION_CONTEXT);
- throw new IdentityException("No LDAPConnectionContext available");
+ try
+ {
+ this.connectionContext =
(LDAPConnectionContext)getIdentityContext().getObject(IdentityContext.TYPE_CONNECTION_CONTEXT);
+ }
+ catch (IdentityException e)
+ {
+ throw new IdentityException("No LDAPConnectionContext available");
+ }
}
return connectionContext;
}
@@ -144,4 +158,9 @@
return value;
}
+ public void setConnectionContext(LDAPConnectionContext connectionContext)
+ {
+ this.connectionContext = connectionContext;
+ }
+
}
Modified:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleModule.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleModule.java 2007-08-22
23:03:16 UTC (rev 8042)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/ldap/LDAPRoleModule.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -49,16 +49,23 @@
private LDAPConnectionContext connectionContext;
- protected void startService() throws Exception
+ public void start() throws Exception
{
if (getConnectionJNDIName() == null)
{
throw new IdentityException("Cannot obtain ldap connection context JNDI
name");
}
- connectionContext = (LDAPConnectionContext)new
InitialContext().lookup(getConnectionJNDIName());
+ try
+ {
+ connectionContext = (LDAPConnectionContext)new
InitialContext().lookup(getConnectionJNDIName());
+ }
+ catch (NamingException e)
+ {
+ log.error("Couldn't obtain connection context");
+ }
- super.startService(); //To change body of overridden methods use File | Settings
| File Templates.
+ super.start(); //To change body of overridden methods use File | Settings | File
Templates.
}
public void updateDisplayName(LDAPRoleImpl ldapr, String name) throws
IdentityException
@@ -286,6 +293,10 @@
}
return recurtion;
}*/
-
+
+ public void setConnectionContext(LDAPConnectionContext connectionContext)
+ {
+ this.connectionContext = connectionContext;
+ }
}
Modified:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModule.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModule.java 2007-08-22
23:03:16 UTC (rev 8042)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserModule.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -61,16 +61,23 @@
private UserProfileModule userProfileModule;
- protected void startService() throws Exception
+ public void start() throws Exception
{
if (getConnectionJNDIName() == null)
{
throw new IdentityException("Cannot obtain ldap connection context JNDI
name");
}
- connectionContext = (LDAPConnectionContext)new
InitialContext().lookup(getConnectionJNDIName());
+ try
+ {
+ connectionContext = (LDAPConnectionContext)new
InitialContext().lookup(getConnectionJNDIName());
+ }
+ catch (NamingException e)
+ {
+ log.error("Couldn't obtain connection context");
+ }
- super.startService(); //To change body of overridden methods use File | Settings
| File Templates.
+ super.start(); //To change body of overridden methods use File | Settings | File
Templates.
}
public void updatePassword(LDAPUserImpl ldapu, String password) throws
IdentityException
@@ -372,5 +379,10 @@
}
return attributesToAdd;
}
+
+ public void setConnectionContext(LDAPConnectionContext connectionContext)
+ {
+ this.connectionContext = connectionContext;
+ }
}
Modified:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserProfileModule.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserProfileModule.java 2007-08-22
23:03:16 UTC (rev 8042)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserProfileModule.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -26,6 +26,7 @@
import org.jboss.portal.identity.IdentityException;
import javax.naming.InitialContext;
+import javax.naming.NamingException;
/**
* @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw
Dawidowicz</a>
@@ -33,17 +34,26 @@
*/
public abstract class LDAPUserProfileModule extends UserProfileModuleService
{
+ private static final org.jboss.logging.Logger log =
org.jboss.logging.Logger.getLogger(LDAPUserProfileModule.class);
+
private LDAPConnectionContext connectionContext;
- protected void startService() throws Exception
+ public void start() throws Exception
{
if (getConnectionJNDIName() == null)
{
throw new IdentityException("Cannot obtain ldap connection context JNDI
name");
}
- connectionContext = (LDAPConnectionContext)new
InitialContext().lookup(getConnectionJNDIName());
+ try
+ {
+ connectionContext = (LDAPConnectionContext)new
InitialContext().lookup(getConnectionJNDIName());
+ }
+ catch (NamingException e)
+ {
+ log.error("Couldn't obtain connection context");
+ }
- super.startService(); //To change body of overridden methods use File | Settings
| File Templates.
+ super.start(); //To change body of overridden methods use File | Settings | File
Templates.
}
protected LDAPConnectionContext getConnectionContext() throws IdentityException
Modified:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/ldap/helper/LDAPTools.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/ldap/helper/LDAPTools.java 2007-08-22
23:03:16 UTC (rev 8042)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/ldap/helper/LDAPTools.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -70,7 +70,7 @@
//name = name.replaceAll("\\","");
name = name.replaceAll(",","\\\\\\,");
name = name.replaceAll("\\+","\\\\\\+");
- name = name.replaceAll("\"","\\\"");
+ name = name.replaceAll("\"","\\\\\"");
name = name.replaceAll("<","\\\\\\<");
name = name.replaceAll(">","\\\\\\>");
name = name.replaceAll(";","\\\\\\;");
Added:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/ConfigMetaData.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/ConfigMetaData.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/ConfigMetaData.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -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.identity.metadata.config;
+
+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);
+ }
+}
Added:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/ConfigOptionMetaData.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/ConfigOptionMetaData.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/ConfigOptionMetaData.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -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.identity.metadata.config;
+
+/**
+ * @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:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/ConfigurationParser.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/ConfigurationParser.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/ConfigurationParser.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -0,0 +1,112 @@
+/*
+* 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.identity.metadata.config;
+
+import org.jboss.portal.identity.metadata.profile.ProfileMetaData;
+import org.jboss.portal.identity.metadata.profile.ProfileMetaDataFactory;
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+import org.jboss.xb.binding.ObjectModelFactory;
+
+import java.net.URL;
+import java.io.InputStream;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw
Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class ConfigurationParser
+{
+
+ private static final org.jboss.logging.Logger log =
org.jboss.logging.Logger.getLogger(ConfigurationParser.class);
+
+
+ //TODO: merge this two methods (redundancy)
+
+ /**
+ * Parse identity config file
+ * @param configFile
+ * @return
+ * @throws org.jboss.portal.identity.IdentityException
+ */
+ public static ProfileMetaData parseProfileConfiguration(String configFile) throws
IdentityException
+ {
+ ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+ ProfileMetaData meta;
+ try
+ {
+ log.info("Processing identity profile configuration");
+ if (log.isDebugEnabled())
+ {
+ log.debug("config file: " + configFile);
+ }
+ URL config = tcl.getResource(configFile);
+ InputStream in = config.openStream();
+ // create unmarshaller
+ Unmarshaller unmarshaller =
UnmarshallerFactory.newInstance().newUnmarshaller();
+
+ // create an instance of ObjectModelFactory
+ ObjectModelFactory factory = new ProfileMetaDataFactory();
+
+ // let the object model factory to create an instance of Map and populate it
with data from XML
+ meta = (ProfileMetaData)unmarshaller.unmarshal(in, factory, null);
+
+ // close the XML stream
+ in.close();
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException("Cannot parse identity profile configuration
file", e);
+ }
+ return meta;
+ }
+
+ public static IdentityConfigurationMetaData parseIdentityConfiguration(String
configFile) throws IdentityException
+ {
+ ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+ IdentityConfigurationMetaData meta;
+ try
+ {
+ log.info("Processing portal identity configuration");
+ log.debug("config file: " + configFile);
+ URL config = tcl.getResource(configFile);
+ InputStream in = config.openStream();
+ // create unmarshaller
+ Unmarshaller unmarshaller =
UnmarshallerFactory.newInstance().newUnmarshaller();
+
+ // create an instance of ObjectModelFactory
+ ObjectModelFactory factory = new IdentityConfigurationMetaDataFactory();
+
+ // let the object model factory to create an instance of Map and populate it
with data from XML
+ meta = (IdentityConfigurationMetaData)unmarshaller.unmarshal(in, factory,
null);
+
+ // close the XML stream
+ in.close();
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException("Cannot parse identity configuration
file", e);
+ }
+ return meta;
+ }
+}
Added:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/DatasourceMetaData.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/DatasourceMetaData.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/DatasourceMetaData.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -0,0 +1,82 @@
+/*
+* 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.identity.metadata.config;
+
+/**
+ * @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 ConfigMetaData getConfig()
+ {
+ return config;
+ }
+
+ public void setConfig(ConfigMetaData config)
+ {
+ this.config = config;
+ }
+
+}
Added:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/DatasourcesMetaData.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/DatasourcesMetaData.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/DatasourcesMetaData.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -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.identity.metadata.config;
+
+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);
+ }
+}
Added:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/IdentityConfigurationMetaData.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/IdentityConfigurationMetaData.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/IdentityConfigurationMetaData.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -0,0 +1,70 @@
+/*
+* 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.identity.metadata.config;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw
Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class IdentityConfigurationMetaData
+{
+ private ModulesMetaData modules;
+ private OptionsMetaData options;
+ private DatasourcesMetaData datasources;
+
+
+ public IdentityConfigurationMetaData()
+ {
+ }
+
+
+ public ModulesMetaData getModules()
+ {
+ return modules;
+ }
+
+ public void setModules(ModulesMetaData modules)
+ {
+ this.modules = modules;
+ }
+
+ public OptionsMetaData getOptions()
+ {
+ return options;
+ }
+
+ public void setOptions(OptionsMetaData options)
+ {
+ this.options = options;
+ }
+
+
+ public DatasourcesMetaData getDatasources()
+ {
+ return datasources;
+ }
+
+ public void setDatasources(DatasourcesMetaData datasources)
+ {
+ this.datasources = datasources;
+ }
+}
Added:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/IdentityConfigurationMetaDataFactory.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/IdentityConfigurationMetaDataFactory.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/IdentityConfigurationMetaDataFactory.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -0,0 +1,273 @@
+/*
+* 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.identity.metadata.config;
+
+import org.jboss.xb.binding.GenericObjectModelFactory;
+import org.jboss.xb.binding.UnmarshallingContext;
+import org.jboss.portal.identity.metadata.config.IdentityConfigurationMetaData;
+import org.jboss.portal.identity.metadata.config.ModulesMetaData;
+import org.jboss.portal.identity.metadata.config.OptionsMetaData;
+import org.jboss.portal.identity.metadata.config.ModuleMetaData;
+import org.jboss.portal.identity.metadata.config.ConfigMetaData;
+import org.jboss.portal.identity.metadata.config.ConfigOptionMetaData;
+import org.jboss.portal.identity.metadata.config.OptionsGroupMetaData;
+import org.jboss.portal.identity.metadata.config.OptionsGroupOptionMetaData;
+import org.jboss.portal.identity.metadata.config.DatasourcesMetaData;
+import org.jboss.portal.identity.metadata.config.DatasourceMetaData;
+import org.xml.sax.Attributes;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw
Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class IdentityConfigurationMetaDataFactory implements GenericObjectModelFactory
+{
+ private static final org.jboss.logging.Logger log =
org.jboss.logging.Logger.getLogger(IdentityConfigurationMetaDataFactory.class);
+
+ public Object newRoot(Object object, UnmarshallingContext unmarshallingContext, String
string, String string1, Attributes attributes)
+ {
+ return new IdentityConfigurationMetaData();
+ }
+
+ public Object completeRoot(Object root, UnmarshallingContext unmarshallingContext,
String string, String string1)
+ {
+ return root;
+ }
+
+ public Object newChild(Object root, UnmarshallingContext nav, String nsURI, String
localName, Attributes attrs)
+ {
+ if (root instanceof IdentityConfigurationMetaData)
+ {
+ if ("modules".equals(localName))
+ {
+ 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))
+ {
+ return new ModuleMetaData();
+ }
+ }
+ else if (root instanceof ModuleMetaData)
+ {
+ if ("config".equals(localName))
+ {
+ return new ConfigMetaData();
+ }
+ }
+ else if (root instanceof ConfigMetaData)
+ {
+ if ("option".equals(localName))
+ {
+ return new ConfigOptionMetaData();
+ }
+ }
+ else if (root instanceof OptionsMetaData)
+ {
+ if ("option-group".equals(localName))
+ {
+ return new OptionsGroupMetaData();
+ }
+ }
+ else if (root instanceof OptionsGroupMetaData)
+ {
+ if ("option".equals(localName))
+ {
+ return new OptionsGroupOptionMetaData();
+ }
+ }
+ return null;
+ }
+
+ public void addChild(Object parent, Object child, UnmarshallingContext nav, String
nsURI, String localName)
+ {
+ if (parent instanceof IdentityConfigurationMetaData)
+ {
+ IdentityConfigurationMetaData identity = (IdentityConfigurationMetaData)parent;
+ if (child instanceof ModulesMetaData)
+ {
+ 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;
+ if (child instanceof ModuleMetaData)
+ {
+ modules.addModule((ModuleMetaData)child);
+ }
+ }
+ else if (parent instanceof ModuleMetaData)
+ {
+ ModuleMetaData module = (ModuleMetaData)parent;
+ if (child instanceof ConfigMetaData)
+ {
+ module.setConfig((ConfigMetaData)child);
+ }
+ }
+ else if (parent instanceof ConfigMetaData)
+ {
+ ConfigMetaData config = (ConfigMetaData)parent;
+ if (child instanceof ConfigOptionMetaData)
+ {
+ config.addOption((ConfigOptionMetaData)child);
+ }
+ }
+ else if (parent instanceof OptionsMetaData)
+ {
+ OptionsMetaData options = (OptionsMetaData)parent;
+ if (child instanceof OptionsGroupMetaData)
+ {
+ options.addGroup((OptionsGroupMetaData)child);
+ }
+ }
+ else if (parent instanceof OptionsGroupMetaData)
+ {
+ OptionsGroupMetaData group = (OptionsGroupMetaData)parent;
+ if (child instanceof OptionsGroupOptionMetaData)
+ {
+ group.addOption((OptionsGroupOptionMetaData)child);
+ }
+ }
+ }
+
+ public void setValue(Object object, UnmarshallingContext unmarshallingContext, String
nsUri, String localName, String value)
+ {
+ if (object instanceof ModuleMetaData)
+ {
+ ModuleMetaData module = (ModuleMetaData)object;
+ if ("type".equals(localName))
+ {
+ module.setType(value);
+ }
+ else if ("implementation".equals(localName))
+ {
+ module.setImplementation(value);
+ }
+ else if ("service-name".equals(localName))
+ {
+ module.setServiceName(value);
+ }
+ else if ("class".equals(localName))
+ {
+ module.setClassName(value);
+ }
+ }
+ if (object instanceof DatasourceMetaData)
+ {
+ DatasourceMetaData ds = (DatasourceMetaData)object;
+ if ("name".equals(localName))
+ {
+ ds.setName(value);
+ }
+ else if ("service-name".equals(localName))
+ {
+ ds.setServiceName(value);
+ }
+ else if ("class".equals(localName))
+ {
+ ds.setClassName(value);
+ }
+ }
+ else if (object instanceof ConfigOptionMetaData)
+ {
+ ConfigOptionMetaData option = (ConfigOptionMetaData)object;
+ if ("name".equals(localName))
+ {
+ option.setName(value);
+ }
+ else if ("value".equals(localName))
+ {
+ option.setValue(value);
+ }
+ }
+ else if (object instanceof OptionsGroupMetaData)
+ {
+ OptionsGroupMetaData group = (OptionsGroupMetaData)object;
+ if ("group-name".equals(localName))
+ {
+ group.setName(value);
+ }
+ }
+ else if (object instanceof OptionsGroupOptionMetaData)
+ {
+ OptionsGroupOptionMetaData option = (OptionsGroupOptionMetaData)object;
+ if ("name".equals(localName))
+ {
+ option.setName(value);
+ }
+ else if ("value".equals(localName))
+ {
+ option.addValue(value);
+ }
+ }
+ }
+}
Added:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/IdentityMetadataProcessor.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/IdentityMetadataProcessor.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/IdentityMetadataProcessor.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -0,0 +1,192 @@
+/*
+* 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.identity.metadata.config;
+
+import org.jboss.portal.identity.metadata.config.ModuleMetaData;
+import org.jboss.portal.identity.metadata.config.ConfigOptionMetaData;
+import org.jboss.portal.identity.metadata.config.DatasourceMetaData;
+import org.jboss.portal.identity.metadata.config.OptionsMetaData;
+import org.jboss.portal.identity.metadata.config.OptionsGroupMetaData;
+import org.jboss.portal.identity.metadata.config.OptionsGroupOptionMetaData;
+import org.jboss.portal.identity.service.IdentityConfigurationService;
+
+import java.util.Map;
+import java.util.Iterator;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version $Revision: 0.1 $
+ */
+public class IdentityMetadataProcessor
+{
+ /**
+ * updates module with proper defaults
+ *
+ * @param module
+ * @param defaultModules
+ */
+ public static void updateModuleWithDefaults(ModuleMetaData module, Map
defaultModules)
+ {
+ if (module.getImplementation() == null)
+ {
+ return;
+ }
+ if (!defaultModules.containsKey(module.getImplementation()))
+ {
+ return;
+ }
+ Map modules = (Map)defaultModules.get(module.getImplementation());
+ if (!modules.containsKey(module.getType()))
+ {
+ return;
+ }
+ ModuleMetaData def = (ModuleMetaData)modules.get(module.getType());
+
+ if (module.getClassName() == null)
+ {
+ module.setClassName(def.getClassName());
+ }
+ if (module.getServiceName() == null)
+ {
+ module.setServiceName(def.getServiceName());
+ }
+
+ //now check if config options are overwritten
+ if (module.getConfig() == null)
+ {
+ module.setConfig(def.getConfig());
+ }
+ else
+ {
+ Map moduleOptions = module.getConfig().getOptions();
+ if (moduleOptions == null)
+ {
+ return;
+ }
+ Map defOptions = def.getConfig().getOptions();
+
+ for (Iterator iterator = defOptions.keySet().iterator(); iterator.hasNext();)
+ {
+ String key = (String)iterator.next();
+ if (!moduleOptions.containsKey(key))
+ {
+ ConfigOptionMetaData o = (ConfigOptionMetaData)defOptions.get(key);
+ module.getConfig().addOption(o);
+ }
+ }
+ }
+ }
+
+ /**
+ * updates module with proper defaults
+ */
+ public static 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
+ */
+ public static void updateOptionsWithDefaults(IdentityConfigurationService config,
OptionsMetaData defaults)
+ {
+ //Map newGroups = new HashMap();
+ Map groups = defaults.getGroups();
+ for (Iterator iterator = groups.keySet().iterator(); iterator.hasNext();)
+ {
+ String groupKey = (String)iterator.next();
+
+ OptionsGroupMetaData group = (OptionsGroupMetaData)groups.get(groupKey);
+
+ if (config.getOptions(groupKey) == null)
+ {
+ config.setOptions(groupKey, new HashMap());
+ }
+
+ //Map newOptions = new HashMap();
+ Map options = group.getOptions();
+ for (Iterator iterator1 = options.keySet().iterator(); iterator1.hasNext();)
+ {
+ String optionKey = (String)iterator1.next();
+
+ OptionsGroupOptionMetaData option =
(OptionsGroupOptionMetaData)options.get(optionKey);
+
+ if (config.getValues(groupKey, optionKey) == null)
+ {
+
+ //config.setValues(groupKey, optionKey, new HashSet());
+ config.setValues(groupKey, optionKey, option.getValues());
+ }
+
+
+ }
+ }
+
+ }
+
+}
Added:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/ModuleMetaData.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/ModuleMetaData.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/ModuleMetaData.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -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.identity.metadata.config;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw
Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class ModuleMetaData
+{
+ private String type;
+ private String implementation;
+ private String serviceName;
+ private String className;
+ //private String jndiName;
+ private ConfigMetaData config;
+
+
+ public ModuleMetaData()
+ {
+ }
+
+
+ public String getType()
+ {
+ return type;
+ }
+
+ public void setType(String type)
+ {
+ this.type = type;
+ }
+
+ public String getImplementation()
+ {
+ return implementation;
+ }
+
+ public void setImplementation(String implementation)
+ {
+ this.implementation = implementation;
+ }
+
+ 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 ConfigMetaData getConfig()
+ {
+ return config;
+ }
+
+ public void setConfig(ConfigMetaData config)
+ {
+ this.config = config;
+ }
+}
Added:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/ModulesMetaData.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/ModulesMetaData.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/ModulesMetaData.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -0,0 +1,63 @@
+/*
+* 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.identity.metadata.config;
+
+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 ModulesMetaData
+{
+ private List modules;
+
+
+ public ModulesMetaData()
+ {
+ modules = new LinkedList();
+ }
+
+
+ public List getModules()
+ {
+ return modules;
+ }
+
+ public void setModules(List modules)
+ {
+ this.modules = modules;
+ }
+
+ public void addModule(ModuleMetaData module)
+ {
+ modules.add(module);
+ }
+
+ /*public ModuleMetaData getModule(String type)
+ {
+ return (ModuleMetaData)modules.get(type);
+ }*/
+
+
+}
Added:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/OptionsGroupMetaData.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/OptionsGroupMetaData.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/OptionsGroupMetaData.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -0,0 +1,70 @@
+/*
+* 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.identity.metadata.config;
+
+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 OptionsGroupMetaData
+{
+ private String name;
+ private Map options;
+
+ public OptionsGroupMetaData()
+ {
+ options = new HashMap();
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public Map getOptions()
+ {
+ return options;
+ }
+
+ public void setOptions(Map options)
+ {
+ this.options = options;
+ }
+
+ public void addOption(OptionsGroupOptionMetaData option)
+ {
+ options.put(option.getName(), option);
+ }
+
+ public OptionsGroupOptionMetaData getOption(String name)
+ {
+ return (OptionsGroupOptionMetaData)options.get(name);
+ }
+}
Added:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/OptionsGroupOptionMetaData.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/OptionsGroupOptionMetaData.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/OptionsGroupOptionMetaData.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -0,0 +1,67 @@
+/*
+* 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.identity.metadata.config;
+
+import java.util.Set;
+import java.util.HashSet;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw
Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class OptionsGroupOptionMetaData
+{
+ private String name;
+ private Set values;
+
+
+ public OptionsGroupOptionMetaData()
+ {
+ values = new HashSet();
+ }
+
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public Set getValues()
+ {
+ return values;
+ }
+
+ public void setValues(Set values)
+ {
+ this.values = values;
+ }
+
+ public void addValue(String value)
+ {
+ values.add(value);
+ }
+}
Added:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/OptionsMetaData.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/OptionsMetaData.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/config/OptionsMetaData.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -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.identity.metadata.config;
+
+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 OptionsMetaData
+{
+ private Map groups;
+
+
+ public OptionsMetaData()
+ {
+ groups = new HashMap();
+ }
+
+
+ public Map getGroups()
+ {
+ return groups;
+ }
+
+ public void setGroups(Map groups)
+ {
+ this.groups = groups;
+ }
+
+ public void addGroup(OptionsGroupMetaData group)
+ {
+ groups.put(group.getName(), group);
+ }
+
+ public OptionsGroupMetaData getGroup(String name)
+ {
+ return (OptionsGroupMetaData)groups.get(name);
+ }
+}
Added:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/profile/LocalizedStringMetaData.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/profile/LocalizedStringMetaData.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/profile/LocalizedStringMetaData.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -0,0 +1,46 @@
+/*
+* 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.identity.metadata.profile;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class LocalizedStringMetaData
+{
+
+ /** . */
+ private List values;
+
+ public LocalizedStringMetaData()
+ {
+ values = new ArrayList();
+ }
+
+ public List getValues()
+ {
+ return values;
+ }
+}
Added:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/profile/LocalizedValueMetaData.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/profile/LocalizedValueMetaData.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/profile/LocalizedValueMetaData.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -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.identity.metadata.profile;
+
+import java.util.Locale;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class LocalizedValueMetaData
+{
+
+ /** . */
+ private Locale locale;
+
+ /** . */
+ private String value;
+
+ public Locale getLocale()
+ {
+ return locale;
+ }
+
+ public void setLocale(Locale locale)
+ {
+ this.locale = locale;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+
+ public void setValue(String value)
+ {
+ this.value = value;
+ }
+}
Added:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/profile/ProfileMetaData.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/profile/ProfileMetaData.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/profile/ProfileMetaData.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -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.identity.metadata.profile;
+
+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 ProfileMetaData
+{
+ private Map properties;
+
+
+ public ProfileMetaData()
+ {
+ properties = new HashMap();
+ }
+
+
+ public Map getProperties()
+ {
+ return properties;
+ }
+
+ public void setProperties(Map properties)
+ {
+ this.properties = properties;
+ }
+
+ public void addProperty(PropertyMetaData property)
+ {
+ properties.put(property.getName(),property);
+ }
+
+ public PropertyMetaData getProperty(String name)
+ {
+ return (PropertyMetaData)properties.get(name);
+ }
+}
Added:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/profile/ProfileMetaDataFactory.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/profile/ProfileMetaDataFactory.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/profile/ProfileMetaDataFactory.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -0,0 +1,216 @@
+/*
+* 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.identity.metadata.profile;
+
+import org.jboss.xb.binding.GenericObjectModelFactory;
+import org.jboss.xb.binding.UnmarshallingContext;
+import org.jboss.portal.common.i18n.LocaleFormat;
+import org.jboss.portal.common.util.ConversionException;
+import org.xml.sax.Attributes;
+
+import java.util.Locale;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw
Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class ProfileMetaDataFactory implements GenericObjectModelFactory
+{
+ private static final org.jboss.logging.Logger log =
org.jboss.logging.Logger.getLogger(ProfileMetaDataFactory.class);
+
+ public Object newRoot(Object object, UnmarshallingContext unmarshallingContext, String
string, String string1, Attributes attributes)
+ {
+ return new ProfileMetaData();
+ }
+
+ public Object completeRoot(Object root, UnmarshallingContext unmarshallingContext,
String string, String string1)
+ {
+ return root;
+ }
+
+ public Object newChild(Object root, UnmarshallingContext nav, String nsURI, String
localName, Attributes attrs)
+ {
+ if (root instanceof ProfileMetaData)
+ {
+ if ("property".equals(localName))
+ {
+ return new PropertyMetaData();
+ }
+ }
+ else if (root instanceof PropertyMetaData)
+ {
+ if ("mapping".equals(localName))
+ {
+ return new PropertyMappingMetaData();
+ }
+ else if ("description".equals(localName))
+ {
+ String lang = attrs.getValue("xml:lang");
+ LocalizedValueMetaData value = new LocalizedValueMetaData();
+ if (lang != null)
+ {
+ try
+ {
+ Locale locale = LocaleFormat.DEFAULT.getLocale(lang);
+ value.setLocale(locale);
+ }
+ catch (ConversionException e)
+ {
+ log.error("Cannot obtain language value", e);
+ return null;
+ }
+ }
+ return value;
+ }
+ else if ("display-name".equals(localName))
+ {
+ String lang = attrs.getValue("xml:lang");
+ LocalizedValueMetaData value = new LocalizedValueMetaData();
+ if (lang != null)
+ {
+ try
+ {
+ Locale locale = LocaleFormat.DEFAULT.getLocale(lang);
+ value.setLocale(locale);
+ }
+ catch (ConversionException e)
+ {
+ log.error("Cannot obtain language value", e);
+ return null;
+ }
+ }
+ return value;
+ }
+ }
+ else if (root instanceof PropertyMappingMetaData)
+ {
+ if ("database".equals(localName))
+ {
+ return new PropertyMappingDatabaseMetaData();
+ }
+ else if ("ldap".equals(localName))
+ {
+ return new PropertyMappingLDAPMetaData();
+ }
+ }
+ return null;
+ }
+
+ public void addChild(Object parent, Object child, UnmarshallingContext nav, String
nsURI, String localName)
+ {
+ if (parent instanceof ProfileMetaData)
+ {
+ ProfileMetaData profile = (ProfileMetaData)parent;
+ if (child instanceof PropertyMetaData)
+ {
+ profile.addProperty((PropertyMetaData)child);
+ }
+ }
+ else if (parent instanceof PropertyMetaData)
+ {
+ PropertyMetaData describable = (PropertyMetaData)parent;
+ if (child instanceof LocalizedValueMetaData)
+ {
+ if ("description".equals(localName))
+ {
+ describable.getDescription().getValues().add(child);
+ }
+ else if ("dispalay-name".equals(localName))
+ {
+ describable.getDisplayName().getValues().add(child);
+ }
+ }
+ else if (child instanceof PropertyMappingMetaData)
+ {
+ describable.setMapping((PropertyMappingMetaData)child);
+ }
+ }
+ else if (parent instanceof PropertyMappingMetaData)
+ {
+ PropertyMappingMetaData mapping = (PropertyMappingMetaData)parent;
+ if (child instanceof PropertyMappingDatabaseMetaData)
+ {
+ mapping.setMappingDatabase((PropertyMappingDatabaseMetaData)child);
+ }
+ else if (child instanceof PropertyMappingLDAPMetaData)
+ {
+ mapping.setMappingLDAP((PropertyMappingLDAPMetaData)child);
+ }
+ }
+ }
+
+ public void setValue(Object object, UnmarshallingContext unmarshallingContext, String
nsUri, String localName, String value)
+ {
+ if (object instanceof PropertyMetaData)
+ {
+ PropertyMetaData property = (PropertyMetaData)object;
+ if ("name".equals(localName))
+ {
+ property.setName(value);
+ }
+ else if ("type".equals(localName))
+ {
+ property.setType(value);
+ }
+ else if ("access-mode".equals(localName))
+ {
+ property.setAccessMode(value);
+ }
+ else if ("usage".equals(localName))
+ {
+ property.setUsage(value);
+ }
+ }
+ else if (object instanceof LocalizedValueMetaData)
+ {
+ LocalizedValueMetaData localized = (LocalizedValueMetaData)object;
+ if ("description".equals(localName))
+ {
+ localized.setValue(value);
+ }
+ else if ("display-name".equals(localName))
+ {
+ localized.setValue(value);
+ }
+ }
+ else if (object instanceof PropertyMappingDatabaseMetaData)
+ {
+ PropertyMappingDatabaseMetaData mapping =
(PropertyMappingDatabaseMetaData)object;
+ if ("type".equals(localName))
+ {
+ mapping.setType(value);
+ }
+ else if ("value".equals(localName))
+ {
+ mapping.setValue(value);
+ }
+ }
+ else if (object instanceof PropertyMappingLDAPMetaData)
+ {
+ PropertyMappingLDAPMetaData mapping = (PropertyMappingLDAPMetaData)object;
+ if ("value".equals(localName))
+ {
+ mapping.setValue(value);
+ }
+ }
+ }
+}
Added:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/profile/PropertyMappingDatabaseMetaData.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/profile/PropertyMappingDatabaseMetaData.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/profile/PropertyMappingDatabaseMetaData.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -0,0 +1,57 @@
+/*
+* 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.identity.metadata.profile;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw
Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class PropertyMappingDatabaseMetaData
+{
+ private String type;
+ private String value;
+
+ public PropertyMappingDatabaseMetaData()
+ {
+
+ }
+
+ public String getType()
+ {
+ return type;
+ }
+
+ public void setType(String type)
+ {
+ this.type = type;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+
+ public void setValue(String value)
+ {
+ this.value = value;
+ }
+}
Added:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/profile/PropertyMappingLDAPMetaData.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/profile/PropertyMappingLDAPMetaData.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/profile/PropertyMappingLDAPMetaData.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -0,0 +1,46 @@
+/*
+* 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.identity.metadata.profile;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw
Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class PropertyMappingLDAPMetaData
+{
+ String value;
+
+ public PropertyMappingLDAPMetaData()
+ {
+
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+
+ public void setValue(String value)
+ {
+ this.value = value;
+ }
+}
Added:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/profile/PropertyMappingMetaData.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/profile/PropertyMappingMetaData.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/profile/PropertyMappingMetaData.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -0,0 +1,57 @@
+/*
+* 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.identity.metadata.profile;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw
Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class PropertyMappingMetaData
+{
+ private PropertyMappingDatabaseMetaData mappingDatabase;
+
+ private PropertyMappingLDAPMetaData mappingLDAP;
+
+ public PropertyMappingMetaData()
+ {
+ }
+
+ public PropertyMappingDatabaseMetaData getMappingDatabase()
+ {
+ return mappingDatabase;
+ }
+
+ public void setMappingDatabase(PropertyMappingDatabaseMetaData mappingDatabase)
+ {
+ this.mappingDatabase = mappingDatabase;
+ }
+
+ public PropertyMappingLDAPMetaData getMappingLDAP()
+ {
+ return mappingLDAP;
+ }
+
+ public void setMappingLDAP(PropertyMappingLDAPMetaData mappingLDAP)
+ {
+ this.mappingLDAP = mappingLDAP;
+ }
+}
Added:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/profile/PropertyMetaData.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/profile/PropertyMetaData.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/profile/PropertyMetaData.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -0,0 +1,116 @@
+/*
+* 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.identity.metadata.profile;
+
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw
Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class PropertyMetaData
+{
+ private String name;
+ private String type;
+ private String accessMode;
+ private String usage;
+ private LocalizedStringMetaData displayName;
+ private LocalizedStringMetaData description;
+ private PropertyMappingMetaData mapping;
+
+
+ public PropertyMetaData()
+ {
+ displayName= new LocalizedStringMetaData();
+ description = new LocalizedStringMetaData();
+ }
+
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getType()
+ {
+ return type;
+ }
+
+ public void setType(String type)
+ {
+ this.type = type;
+ }
+
+ public String getAccessMode()
+ {
+ return accessMode;
+ }
+
+ public void setAccessMode(String accessMode)
+ {
+ this.accessMode = accessMode;
+ }
+
+ public String getUsage()
+ {
+ return usage;
+ }
+
+ public void setUsage(String usage)
+ {
+ this.usage = usage;
+ }
+
+ public LocalizedStringMetaData getDisplayName()
+ {
+ return displayName;
+ }
+
+ public void setDisplayName(LocalizedStringMetaData displayName)
+ {
+ this.displayName = displayName;
+ }
+
+ public LocalizedStringMetaData getDescription()
+ {
+ return description;
+ }
+
+ public void setDescription(LocalizedStringMetaData description)
+ {
+ this.description = description;
+ }
+
+ public PropertyMappingMetaData getMapping()
+ {
+ return mapping;
+ }
+
+ public void setMapping(PropertyMappingMetaData mapping)
+ {
+ this.mapping = mapping;
+ }
+}
Added:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/profile/info/ProfileInfoSupport.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/profile/info/ProfileInfoSupport.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/profile/info/ProfileInfoSupport.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -0,0 +1,85 @@
+/*
+* 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.identity.metadata.profile.info;
+
+import org.jboss.portal.identity.info.ProfileInfo;
+import org.jboss.portal.identity.info.PropertyInfo;
+import org.jboss.portal.identity.metadata.profile.ProfileMetaData;
+import org.jboss.portal.identity.metadata.profile.PropertyMetaData;
+import org.jboss.portal.identity.IdentityException;
+
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw
Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class ProfileInfoSupport implements ProfileInfo
+{
+ private Map properties;
+
+
+ public ProfileInfoSupport(ProfileMetaData profile) throws IdentityException
+ {
+
+ try
+ {
+ properties = new HashMap();
+ Map meta = profile.getProperties();
+ for (Iterator iterator = meta.keySet().iterator(); iterator.hasNext();)
+ {
+ String name = (String)iterator.next();
+ PropertyMetaData property = (PropertyMetaData)meta.get(name);
+ PropertyInfo pi = new PropertyInfoSupport(property);
+ properties.put(pi.getName(), pi);
+ }
+ }
+ catch (IdentityException e)
+ {
+ throw new IdentityException("PrifileInfo creation error: ", e);
+ }
+ }
+
+ public Map getPropertiesInfo()
+ {
+ if (properties != null)
+ {
+ return Collections.unmodifiableMap(properties);
+ }
+ else
+ {
+ return Collections.EMPTY_MAP;
+ }
+ }
+
+ public PropertyInfo getPropertyInfo(String name)
+ {
+ if (name != null)
+ {
+ return (PropertyInfo)properties.get(name);
+ }
+ return null;
+ }
+}
Added:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/profile/info/PropertyInfoSupport.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/profile/info/PropertyInfoSupport.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/profile/info/PropertyInfoSupport.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -0,0 +1,206 @@
+/*
+* 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.identity.metadata.profile.info;
+
+import org.jboss.portal.identity.info.PropertyInfo;
+import org.jboss.portal.identity.metadata.profile.PropertyMetaData;
+import org.jboss.portal.identity.metadata.profile.LocalizedValueMetaData;
+import org.jboss.portal.common.i18n.LocalizedString;
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.logging.Logger;
+
+import java.util.Locale;
+import java.util.Iterator;
+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 PropertyInfoSupport implements PropertyInfo
+{
+ private static final Logger log = Logger.getLogger(PropertyInfo.class);
+
+ //TODO: introduce safe types enums where possible.
+
+ private String name;
+ private String type;
+ private String accessMode;
+ private String usage;
+ private LocalizedString displayName;
+ private LocalizedString description;
+ private String mappingDBType;
+ private String mappingDBValue;
+ private String mappingLDAPValue;
+ private boolean mappedLDAP;
+ private boolean mappedDB;
+
+
+ public PropertyInfoSupport(PropertyMetaData meta) throws IdentityException
+ {
+
+
+
+ name = meta.getName();
+ type = meta.getType();
+ accessMode = meta.getAccessMode();
+ if (!accessMode.equals(PropertyInfo.ACCESS_MODE_READ_ONLY) &&
!accessMode.equals(PropertyInfo.ACCESS_MODE_READ_WRITE))
+ {
+ throw new IdentityException("Wrong value in user profile configuration for
access-mode: " + accessMode);
+ }
+ usage = meta.getUsage();
+
+ if (!usage.equals(PropertyInfo.USAGE_MANDATORY) &&
!usage.equals(PropertyInfo.USAGE_OPTIONAL))
+ {
+ throw new IdentityException("Wrong value in user profile configuration for
usage: " + usage);
+ }
+
+
+
+ //mappingType = meta.getMapping().getType();
+ //mappingValue = meta.getMapping().getValue();
+
+
+
+ Map descValues = new HashMap();
+ for (Iterator iterator = meta.getDescription().getValues().iterator();
iterator.hasNext();)
+ {
+ LocalizedValueMetaData value = (LocalizedValueMetaData)iterator.next();
+ descValues.put(value.getLocale(),value.getValue());
+ }
+ Map dispValues = new HashMap();
+ for (Iterator iterator = meta.getDisplayName().getValues().iterator();
iterator.hasNext();)
+ {
+ LocalizedValueMetaData value = (LocalizedValueMetaData)iterator.next();
+ dispValues.put(value.getLocale(),value.getValue());
+ }
+
+ description = new LocalizedString(descValues, Locale.ENGLISH);
+ displayName = new LocalizedString(dispValues, Locale.ENGLISH);
+
+ if (meta.getMapping() == null)
+ {
+ throw new IdentityException("Mapping section is missing");
+ }
+ if (meta.getMapping().getMappingDatabase() != null)
+ {
+ if (meta.getMapping().getMappingDatabase().getType() != null &&
meta.getMapping().getMappingDatabase().getValue() != null)
+ {
+ mappedDB = true;
+ mappingDBType = meta.getMapping().getMappingDatabase().getType();
+ if (!mappingDBType.equals(PropertyInfo.MAPPING_DB_TYPE_COLUMN) &&
!mappingDBType.equals(PropertyInfo.MAPPING_DB_TYPE_DYNAMIC))
+ {
+ throw new IdentityException("Wrong value in user profile
configuration for database mapping type: " + mappingDBType);
+ }
+ mappingDBValue = meta.getMapping().getMappingDatabase().getValue();
+ }
+ }
+
+ if (meta.getMapping().getMappingLDAP() != null)
+ {
+ if (meta.getMapping().getMappingLDAP().getValue() != null)
+ {
+ mappedLDAP = true;
+ mappingLDAPValue = meta.getMapping().getMappingLDAP().getValue();
+ }
+ }
+
+ if (log.isDebugEnabled())
+ {
+ log.debug("created PropertyInfo: " + toString());
+ }
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getType()
+ {
+ return type;
+ }
+
+ public String getAccessMode()
+ {
+ return accessMode;
+ }
+
+ public String getUsage()
+ {
+ return usage;
+ }
+
+ public LocalizedString getDisplayName()
+ {
+ return displayName;
+ }
+
+ public LocalizedString getDescription()
+ {
+ return description;
+ }
+
+ public String getMappingDBType()
+ {
+ return mappingDBType;
+ }
+
+ public String getMappingLDAPValue()
+ {
+ return mappingLDAPValue;
+ }
+
+ public String getMappingDBValue()
+ {
+ return mappingDBValue;
+ }
+
+
+ public boolean isMappedDB()
+ {
+ return mappedDB;
+ }
+
+ public boolean isMappedLDAP()
+ {
+ return mappedLDAP;
+ }
+
+ public String toString()
+ {
+ StringBuffer buf = new StringBuffer();
+ buf.append("name: ").append(name)
+ .append("; type:").append(type)
+ .append("; accessMode:").append(accessMode)
+ .append("; usage: ").append(usage)
+ .append("; displayName: ").append(displayName)
+ .append("; description: ").append(description)
+ .append("; mappingDBType: ").append(mappingDBType)
+ .append("; mappingLDAPValue: ").append(mappingLDAPValue)
+ .append("; mappingDBValue: ").append(mappingDBValue)
+ .append("; mappedDB: ").append(mappedDB)
+ .append("; mappedLDAP: ").append(mappedLDAP);
+ return buf.toString();
+ }
+}
Added:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/service/DatasourceServiceMetaData.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/service/DatasourceServiceMetaData.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/service/DatasourceServiceMetaData.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -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.identity.metadata.service;
+
+import org.jboss.portal.identity.metadata.config.DatasourceMetaData;
+
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version $Revision: 0.1 $
+ */
+public class DatasourceServiceMetaData
+{
+ private final DatasourceMetaData datasource;
+
+ private final Map options;
+
+
+ public DatasourceServiceMetaData(DatasourceMetaData datasource, Map options)
+ {
+ this.datasource = datasource;
+ this.options = options;
+ }
+
+
+ public DatasourceMetaData getDatasource()
+ {
+ return datasource;
+ }
+
+ public Map getOptions()
+ {
+ return options;
+ }
+}
Added:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/service/DatasourceServicesMetaData.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/service/DatasourceServicesMetaData.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/service/DatasourceServicesMetaData.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -0,0 +1,107 @@
+/*
+* 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.identity.metadata.service;
+
+import org.jboss.portal.identity.metadata.config.DatasourcesMetaData;
+import org.jboss.portal.identity.metadata.config.DatasourceMetaData;
+import org.jboss.portal.identity.metadata.config.IdentityMetadataProcessor;
+import org.jboss.portal.identity.metadata.config.ConfigOptionMetaData;
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.plugins.AbstractPropertyMetaData;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+
+import javax.management.ObjectName;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.LinkedList;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version $Revision: 0.1 $
+ */
+public class DatasourceServicesMetaData
+{
+
+ private List datasourcesList = new LinkedList();
+
+ public DatasourceServicesMetaData(DatasourcesMetaData defaultDatasourcesMeta,
DatasourcesMetaData datasourcesMeta) throws Exception
+ {
+ if (datasourcesMeta == null)
+ {
+ new IllegalArgumentException("null datasources");
+ }
+
+ if (defaultDatasourcesMeta == null)
+ {
+ new IllegalArgumentException("null defaultDatasources");
+ }
+
+ //map default datasources by name
+ Map defaultDatasources = new HashMap();
+ for (Iterator iterator = defaultDatasourcesMeta.getDatasources().iterator();
iterator.hasNext();)
+ {
+ DatasourceMetaData ds = (DatasourceMetaData)iterator.next();
+ defaultDatasources.put(ds.getName(), ds);
+
+ }
+
+ for (Iterator iterator = datasourcesMeta.getDatasources().iterator();
iterator.hasNext();)
+ {
+ DatasourceMetaData ds = (DatasourceMetaData)iterator.next();
+ //if (log.isDebugEnabled()) log.debug("processing datasource: " +
ds.getName() + "/" + ds.getClassName());
+ //log.info("Installing datasourc: " + ds.getName());
+ IdentityMetadataProcessor.updateDatasourceWithDefaults(ds,
defaultDatasources);
+
+ //generate initial options
+ 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());
+ }
+
+ datasourcesList.add(new DatasourceServiceMetaData(ds, optionMap));
+
+ //instantiate the module
+ //IdentityModuleService moduleService = null;
+
+
+ if (ds.getClassName() == null)
+ {
+ throw new IdentityException("Class name not found for datasource
type: " + ds.getName() + " wrong configuration");
+ }
+
+ }
+ }
+
+
+ public List getDatasourcesList()
+ {
+ return datasourcesList;
+ }
+}
Added:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/service/IdentityServicesMetaData.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/service/IdentityServicesMetaData.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/service/IdentityServicesMetaData.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -0,0 +1,72 @@
+/*
+* 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.identity.metadata.service;
+
+import org.jboss.portal.identity.metadata.config.IdentityConfigurationMetaData;
+import org.jboss.portal.identity.metadata.config.ConfigurationParser;
+import org.jboss.portal.identity.metadata.config.IdentityMetadataProcessor;
+import org.jboss.portal.identity.service.IdentityConfigurationService;
+
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version $Revision: 0.1 $
+ */
+public class IdentityServicesMetaData
+{
+
+ private DatasourceServicesMetaData datasourceServices;
+
+ private ModuleServicesMetaData moduleServices;
+
+ private IdentityConfigurationService configurationService;
+
+ public IdentityServicesMetaData(String defaultConfigFile, String configFile) throws
Exception
+ {
+ IdentityConfigurationMetaData meta =
ConfigurationParser.parseIdentityConfiguration(configFile);
+ IdentityConfigurationMetaData defaultMeta =
ConfigurationParser.parseIdentityConfiguration(defaultConfigFile);
+
+ datasourceServices = new DatasourceServicesMetaData(defaultMeta.getDatasources(),
meta.getDatasources());
+ moduleServices = new ModuleServicesMetaData(defaultMeta.getModules(),
meta.getModules());
+
+ //inject configuration service
+ configurationService = new IdentityConfigurationService(meta.getOptions());
+ IdentityMetadataProcessor.updateOptionsWithDefaults(configurationService,
defaultMeta.getOptions());
+
+ }
+
+ public DatasourceServicesMetaData getDatasourceServices()
+ {
+ return datasourceServices;
+ }
+
+ public ModuleServicesMetaData getModuleServices()
+ {
+ return moduleServices;
+ }
+
+ public IdentityConfigurationService getConfigurationService()
+ {
+ return configurationService;
+ }
+}
Added:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/service/ModuleServiceMetaData.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/service/ModuleServiceMetaData.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/service/ModuleServiceMetaData.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -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.identity.metadata.service;
+
+import org.jboss.portal.identity.metadata.config.ModuleMetaData;
+
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version $Revision: 0.1 $
+ */
+public class ModuleServiceMetaData
+{
+ private final ModuleMetaData moduleData;
+
+ private final Map moduleOptions;
+
+
+ public ModuleServiceMetaData(ModuleMetaData moduleData, Map moduleOptions)
+ {
+ this.moduleData = moduleData;
+ this.moduleOptions = moduleOptions;
+ }
+
+
+ public ModuleMetaData getModuleData()
+ {
+ return moduleData;
+ }
+
+ public Map getModuleOptions()
+ {
+ return moduleOptions;
+ }
+}
Added:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/service/ModuleServicesMetaData.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/service/ModuleServicesMetaData.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/metadata/service/ModuleServicesMetaData.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -0,0 +1,135 @@
+/*
+* 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.identity.metadata.service;
+
+import org.jboss.portal.identity.metadata.config.ModulesMetaData;
+import org.jboss.portal.identity.metadata.config.ModuleMetaData;
+import org.jboss.portal.identity.metadata.config.IdentityMetadataProcessor;
+import org.jboss.portal.identity.metadata.config.ConfigOptionMetaData;
+import org.jboss.portal.identity.IdentityException;
+
+import java.util.List;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version $Revision: 0.1 $
+ */
+public class ModuleServicesMetaData
+{
+ private List modulesList = new LinkedList();
+
+
+ public ModuleServicesMetaData(ModulesMetaData defaultModulesMetaData, ModulesMetaData
modulesMetaData) throws Exception
+ {
+ //Map[implementation] --> Map[Type] --> ModuleMetaData
+ Map defaultImplementations = new HashMap();
+
+ //update modules data with defaults
+ try
+ {
+ List defaultModules = defaultModulesMetaData.getModules();
+ for (Iterator iterator = defaultModules.iterator(); iterator.hasNext();)
+ {
+ ModuleMetaData module = (ModuleMetaData)iterator.next();
+
+ //check if defaults contains all information
+ if (module.getType() == null ||
+ module.getImplementation() == null ||
+ //module.getJNDIName() == null ||
+ module.getServiceName() == null ||
+ module.getConfig() == null)
+ {
+ throw new IdentityException("Default module configuration must be
complete");
+ }
+
+ //store them as maps for different implementations
+ String implType = module.getImplementation();
+ Map implementation;
+ if (defaultImplementations.containsKey(implType))
+ {
+ implementation = (Map)defaultImplementations.get(implType);
+ }
+ else
+ {
+ implementation = new HashMap();
+ }
+
+ //store per implementation
+ implementation.put(module.getType(), module);
+ defaultImplementations.put(implType, implementation);
+ }
+ }
+ catch (Exception e)
+ {
+ throw new IdentityException("Error during processing default configuration
file", e);
+ }
+
+ //process modules for instantiation
+ for (Iterator iterator = modulesMetaData.getModules().iterator();
iterator.hasNext();)
+ {
+
+ ModuleMetaData module = (ModuleMetaData)iterator.next();
+ //log.info("Processing module: " + module.getType() + "/"
+ module.getImplementation());// + "/" + module.getClassName());
+
+ IdentityMetadataProcessor.updateModuleWithDefaults(module,
defaultImplementations);
+
+ //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();
+ ConfigOptionMetaData option =
(ConfigOptionMetaData)configOptions.get(optionName);
+ optionMap.put(optionName, option.getValue());
+ }
+
+
+
+
+
+ //instantiate the module
+ //IdentityModuleService moduleService = null;
+
+
+ if (module.getClassName() == null)
+ {
+ throw new IdentityException("Class name not found for module type:
" + module.getType() + " wrong configuration");
+ }
+
+ modulesList.add(new ModuleServiceMetaData(module, optionMap));
+
+
+ }
+
+ }
+
+
+ public List getModulesList()
+ {
+ return modulesList;
+ }
+}
Modified:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/service/IdentityConfigurationService.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/service/IdentityConfigurationService.java 2007-08-22
23:03:16 UTC (rev 8042)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/service/IdentityConfigurationService.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -23,9 +23,9 @@
import org.jboss.portal.identity.IdentityConfiguration;
import org.jboss.portal.identity.IdentityContext;
-import org.jboss.portal.identity.config.metadata.OptionsMetaData;
-import org.jboss.portal.identity.config.metadata.OptionsGroupMetaData;
-import org.jboss.portal.identity.config.metadata.OptionsGroupOptionMetaData;
+import org.jboss.portal.identity.metadata.config.OptionsMetaData;
+import org.jboss.portal.identity.metadata.config.OptionsGroupMetaData;
+import org.jboss.portal.identity.metadata.config.OptionsGroupOptionMetaData;
import org.jboss.portal.identity.IdentityException;
import java.util.Map;
Modified:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/service/IdentityEventManagerService.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/service/IdentityEventManagerService.java 2007-08-22
23:03:16 UTC (rev 8042)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/service/IdentityEventManagerService.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -27,17 +27,19 @@
import org.jboss.portal.identity.event.IdentityEvent;
import org.jboss.portal.identity.event.IdentityEventEmitter;
import org.jboss.portal.common.util.CopyOnWriteRegistry;
-import org.jboss.portal.jems.as.system.AbstractJBossService;
+
import java.util.Iterator;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 1.1 $
*/
-public class IdentityEventManagerService extends AbstractJBossService implements
IdentityEventBroadcaster, IdentityEventEmitter
+public class IdentityEventManagerService implements IdentityEventBroadcaster,
IdentityEventEmitter
{
+ private static final org.jboss.logging.Logger log =
org.jboss.logging.Logger.getLogger(IdentityEventManagerService.class);
+
/** . */
private final CopyOnWriteRegistry listeners;
Modified:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/service/IdentityModuleService.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/service/IdentityModuleService.java 2007-08-22
23:03:16 UTC (rev 8042)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/service/IdentityModuleService.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -23,10 +23,9 @@
import org.jboss.portal.identity.IdentityContext;
import org.jboss.portal.identity.IdentityConfiguration;
-import org.jboss.portal.jems.as.JNDI;
import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.ServiceJNDIBinder;
import org.jboss.portal.identity.event.IdentityEventBroadcaster;
-import org.jboss.portal.jems.as.system.AbstractJBossService;
import java.util.Map;
@@ -34,7 +33,7 @@
* @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw
Dawidowicz</a>
* @version $Revision: 1.1 $
*/
-public class IdentityModuleService extends AbstractJBossService
+public class IdentityModuleService
{
private static final org.jboss.logging.Logger log =
org.jboss.logging.Logger.getLogger(IdentityModuleService.class);
@@ -46,7 +45,7 @@
private IdentityConfiguration identityConfiguration;
- private JNDI.Binding jndiBinding;
+ private ServiceJNDIBinder jndiBinder;
private Map initOptions;
@@ -63,15 +62,16 @@
moduleType = type;
}
- protected void startService() throws Exception
+ public void start() throws Exception
{
//
- if (jndiName != null)
+ if (jndiName != null && jndiBinder != null)
{
log.debug("Binding identity module to JNDI with name: " + jndiName);
- jndiBinding = new JNDI.Binding(jndiName, this);
- jndiBinding.bind();
+ //jndiBinding = new JNDI.Binding(jndiName, this);
+ //jndiBinding.bind();
+ jndiBinder.bind(jndiName, this);
}
if (identityContext == null)
@@ -86,12 +86,13 @@
}
- protected void stopService() throws Exception
+ public void stop() throws Exception
{
- if (jndiBinding != null)
+ if (jndiName != null && jndiBinder != null)
{
- jndiBinding.unbind();
- jndiBinding = null;
+ //jndiBinding.unbind();
+ //jndiBinding = null;
+ jndiBinder.unbind(jndiName);
}
if (identityContext == null)
@@ -184,4 +185,14 @@
{
this.connectionJNDIName = connectionJNDIName;
}
+
+ public ServiceJNDIBinder getJndiBinder()
+ {
+ return jndiBinder;
+ }
+
+ public void setJndiBinder(ServiceJNDIBinder jndiBinder)
+ {
+ this.jndiBinder = jndiBinder;
+ }
}
Modified:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/service/UserProfileModuleService.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/service/UserProfileModuleService.java 2007-08-22
23:03:16 UTC (rev 8042)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/service/UserProfileModuleService.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -21,11 +21,10 @@
*/
package org.jboss.portal.identity.service;
-import org.jboss.portal.identity.IdentityException;
import org.jboss.portal.identity.IdentityContext;
import org.jboss.portal.identity.UserProfileModule;
-import org.jboss.portal.identity.config.info.ProfileInfoSupport;
-import org.jboss.portal.identity.config.metadata.ConfigurationParser;
+import org.jboss.portal.identity.metadata.profile.info.ProfileInfoSupport;
+import org.jboss.portal.identity.metadata.config.ConfigurationParser;
import org.jboss.portal.identity.info.ProfileInfo;
/**
@@ -46,7 +45,7 @@
}
- protected void startService() throws Exception
+ public void start() throws Exception
{
if (getProfileConfigFile() != null)
{
@@ -57,7 +56,7 @@
profileInfo = new
ProfileInfoSupport(ConfigurationParser.parseProfileConfiguration(getProfileConfigFile()));
}
- super.startService();
+ super.start();
}
Added:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/test/identity/TestServiceLoader.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/test/identity/TestServiceLoader.java
(rev 0)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/test/identity/TestServiceLoader.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -0,0 +1,205 @@
+/*
+* 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.jboss.portal.identity.IdentityContext;
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.IdentityContextImpl;
+import org.jboss.portal.identity.UserProfileModule;
+import org.jboss.portal.identity.DelegatingUserProfileModuleImpl;
+import org.jboss.portal.identity.UserModule;
+import org.jboss.portal.identity.RoleModule;
+import org.jboss.portal.identity.MembershipModule;
+import org.jboss.portal.identity.ldap.LDAPConnectionContext;
+import org.jboss.portal.identity.ldap.LDAPUserProfileModuleImpl;
+import org.jboss.portal.identity.ldap.LDAPUserModule;
+import org.jboss.portal.identity.ldap.LDAPRoleModule;
+import org.jboss.portal.identity.ldap.LDAPMembershipModule;
+import org.jboss.portal.identity.event.IdentityEventBroadcaster;
+import org.jboss.portal.identity.event.IdentityEvent;
+import org.jboss.portal.identity.boot.IdentityServiceLoader;
+import org.jboss.portal.identity.service.IdentityConfigurationService;
+import org.jboss.portal.identity.service.UserModuleService;
+import org.jboss.portal.identity.service.RoleModuleService;
+import org.jboss.portal.identity.service.MembershipModuleService;
+import org.jboss.portal.identity.metadata.service.IdentityServicesMetaData;
+import org.jboss.kernel.plugins.bootstrap.basic.BasicBootstrap;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.kernel.Kernel;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version $Revision: 0.1 $
+ */
+public class TestServiceLoader
+{
+
+ public IdentityContext loadServices(String defaultConfigFile, String configFile)
throws Exception
+ {
+ //initialize microcontainer stuff
+ try
+ {
+ BasicBootstrap bootstrap = new BasicBootstrap();
+ bootstrap.run();
+ Kernel kernel = bootstrap.getKernel();
+
+
+ IdentityServicesMetaData servicesMetaData = new
IdentityServicesMetaData(defaultConfigFile, configFile);
+
+ IdentityContext identityContext = bootstrapIdentityContext(kernel);
+
+ // IdentityEventBroadcaster
+ IdentityEventBroadcaster broadcaster = new IdentityEventBroadcaster()
+ {
+ public void fireEvent(IdentityEvent event)
+ {
+ // Noop
+ }
+ };
+
+ //
+ try
+ {
+ identityContext.register(broadcaster,
IdentityContext.TYPE_IDENTITY_EVENT_BROADCASTER);
+ }
+ catch (Throwable throwable)
+ {
+ throw new IdentityException("Unable to install
IdentityEventBroadcaster", throwable);
+ }
+
+ //inject configuration service
+ IdentityConfigurationService configuration =
servicesMetaData.getConfigurationService();
+ configuration.setIdentityContext(identityContext);
+ //TODO:set proper jndiName and serviceName and JNDI binder
+ configuration.start();
+
+ IdentityServiceLoader serviceLoader = new IdentityServiceLoader(identityContext,
kernel, false);
+
+ // process datasources and modules
+
serviceLoader.bootstrapDatasource(servicesMetaData.getDatasourceServices().getDatasourcesList());
+
+ LDAPConnectionContext connectionContext = null;
+
+
+ try
+ {
+ connectionContext =
(LDAPConnectionContext)identityContext.getObject(IdentityContext.TYPE_CONNECTION_CONTEXT);
+ }
+ catch (IdentityException e)
+ {
+ //
+ }
+
+
serviceLoader.bootstrapModules(servicesMetaData.getModuleServices().getModulesList());
+
+ UserModule userModule =
(UserModuleService)identityContext.getObject(IdentityContext.TYPE_USER_MODULE);
+ RoleModule roleModule =
(RoleModuleService)identityContext.getObject(IdentityContext.TYPE_ROLE_MODULE);
+ MembershipModule membershipModule =
(MembershipModuleService)identityContext.getObject(IdentityContext.TYPE_MEMBERSHIP_MODULE);
+
+
+ if (userModule instanceof LDAPUserModule)
+ {
+ ((LDAPUserModule)userModule).setConnectionContext(connectionContext);
+ }
+ if (roleModule instanceof LDAPRoleModule)
+ {
+ ((LDAPRoleModule)roleModule).setConnectionContext(connectionContext);
+ }
+ if (membershipModule instanceof LDAPMembershipModule)
+ {
+
((LDAPMembershipModule)membershipModule).setConnectionContext(connectionContext);
+ }
+
+ //inject delegating profile modules if present
+ UserProfileModule userProfileModule =
(UserProfileModule)identityContext.getObject(IdentityContext.TYPE_USER_PROFILE_MODULE);
+
+ if (userProfileModule != null && userProfileModule instanceof
DelegatingUserProfileModuleImpl)
+ {
+ DelegatingUserProfileModuleImpl delegatingModule =
(DelegatingUserProfileModuleImpl)userProfileModule;
+
+
+ try {
+
+
+ UserProfileModule dbModule =
(UserProfileModule)identityContext.getObject("DBDelegateUserProfile");
+ if (dbModule != null)
+ {
+ delegatingModule.setDbModule(dbModule);
+ }
+
+ }
+ catch(IdentityException e)
+ {
+ //nothirng
+ }
+
+ try
+ {
+ UserProfileModule ldapModule =
(UserProfileModule)identityContext.getObject("LDAPDelegateUserProfile");
+ if (ldapModule != null)
+ {
+ delegatingModule.setLDAPModule(ldapModule);
+
((LDAPUserProfileModuleImpl)ldapModule).setConnectionContext(connectionContext);
+ }
+ }
+ catch (IdentityException e)
+ {
+ //nothing
+ }
+ }
+ else if (userProfileModule != null && userProfileModule instanceof
LDAPUserProfileModuleImpl)
+ {
+
((LDAPUserProfileModuleImpl)userProfileModule).setConnectionContext(connectionContext);
+ }
+
+
+ return identityContext;
+ }
+ catch (Throwable e)
+ {
+ throw new IdentityException(e);
+ }
+ }
+
+ private IdentityContext bootstrapIdentityContext(Kernel kernel) throws Exception
+ {
+ KernelControllerContext identityKernelContext;
+ try
+ {
+ AbstractBeanMetaData contextBMD = new AbstractBeanMetaData(
+ "portal:identity=IdentityContext",
+ IdentityContextImpl.class.getName());
+ //beans.add(contextBMD);
+ identityKernelContext = kernel.getController().install(contextBMD);
+ return (IdentityContext)identityKernelContext.getTarget();
+
+ }
+ catch (Throwable throwable)
+ {
+ throw new IdentityException("Unable to install
IdentityContext",throwable);
+ }
+
+ }
+
+}
Modified:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/test/identity/db/DBIdentityTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/test/identity/db/DBIdentityTestCase.java 2007-08-22
23:03:16 UTC (rev 8042)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/test/identity/db/DBIdentityTestCase.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -28,13 +28,9 @@
import org.jboss.portal.identity.service.MembershipModuleService;
import org.jboss.portal.identity.service.RoleModuleService;
import org.jboss.portal.test.identity.IdentityTest;
+import org.jboss.portal.test.identity.TestServiceLoader;
import junit.framework.TestSuite;
-import java.util.Date;
-import java.util.Collection;
-import java.util.Iterator;
-import java.text.SimpleDateFormat;
-
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 5748 $
@@ -68,12 +64,13 @@
//bootstrap identity modules
- IdentityServiceControllerImpl controller = new IdentityServiceControllerImpl();
- controller.setConfigFile("test/config/db-config.xml");
-
controller.setDefaultConfigFile("test/config/standardidentity-config.xml");
- controller.setRegisterMBeans(false);
- controller.start();
- identityContext = controller.getIdentityContext();
+// IdentityServiceControllerImpl controller = new IdentityServiceControllerImpl();
+// controller.setConfigFile("test/config/db-config.xml");
+//
controller.setDefaultConfigFile("test/config/standardidentity-config.xml");
+// controller.setRegisterMBeans(false);
+// controller.start();
+// identityContext = controller.getIdentityContext();
+ identityContext = new
TestServiceLoader().loadServices("test/config/standardidentity-config.xml",
"test/config/db-config.xml");
this.userModule =
(UserModuleService)identityContext.getObject(IdentityContext.TYPE_USER_MODULE);
this.roleModule =
(RoleModuleService)identityContext.getObject(IdentityContext.TYPE_ROLE_MODULE);
Modified:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/test/identity/db/DBTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/test/identity/db/DBTestCase.java 2007-08-22
23:03:16 UTC (rev 8042)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/test/identity/db/DBTestCase.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -172,10 +172,10 @@
utc = null;
//
- roleModule.destroy();
- userModule.destroy();
- membershipModule.destroy();
- userProfileModule.destroy();
+// roleModule.destroy();
+// userModule.destroy();
+// membershipModule.destroy();
+// userProfileModule.destroy();
roleModule = null;
userModule = null;
Modified:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPExtRoleModuleTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPExtRoleModuleTestCase.java 2007-08-22
23:03:16 UTC (rev 8042)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPExtRoleModuleTestCase.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -2,16 +2,16 @@
import junit.framework.TestSuite;
import org.jboss.portal.identity.RoleModule;
-import org.jboss.portal.identity.IdentityServiceControllerImpl;
+//import org.jboss.portal.identity.IdentityServiceControllerImpl;
import org.jboss.portal.identity.IdentityContext;
import org.jboss.portal.identity.IdentityException;
-import org.jboss.portal.identity.NoSuchUserException;
import org.jboss.portal.identity.UserModule;
import org.jboss.portal.identity.MembershipModule;
import org.jboss.portal.identity.UserProfileModule;
import org.jboss.portal.identity.User;
import org.jboss.portal.identity.Role;
import org.jboss.portal.identity.ldap.LDAPRoleImpl;
+import org.jboss.portal.test.identity.TestServiceLoader;
import java.util.Set;
import java.util.List;
@@ -68,12 +68,14 @@
roleModule.start();
this.roleModule = roleModule;*/
- IdentityServiceControllerImpl controller = new IdentityServiceControllerImpl();
- controller.setConfigFile(getDirectoryServerConfigParameter().getConfigFile());
-
controller.setDefaultConfigFile("test/config/standardidentity-config.xml");
- controller.setRegisterMBeans(false);
- controller.start();
- identityContext = controller.getIdentityContext();
+// IdentityServiceControllerImpl controller = new IdentityServiceControllerImpl();
+// controller.setConfigFile(getDirectoryServerConfigParameter().getConfigFile());
+//
controller.setDefaultConfigFile("test/config/standardidentity-config.xml");
+// controller.setRegisterMBeans(false);
+// controller.start();
+// identityContext = controller.getIdentityContext();
+ identityContext = new
TestServiceLoader().loadServices("test/config/standardidentity-config.xml",
getDirectoryServerConfigParameter().getConfigFile());
+
userModule =
(UserModule)identityContext.getObject(IdentityContext.TYPE_USER_MODULE);
userModule =
(UserModule)identityContext.getObject(IdentityContext.TYPE_USER_MODULE);
roleModule =
(RoleModule)identityContext.getObject(IdentityContext.TYPE_ROLE_MODULE);
Modified:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPExtUserModuleTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPExtUserModuleTestCase.java 2007-08-22
23:03:16 UTC (rev 8042)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPExtUserModuleTestCase.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -5,14 +5,14 @@
import org.jboss.portal.identity.RoleModule;
import org.jboss.portal.identity.MembershipModule;
import org.jboss.portal.identity.UserProfileModule;
-import org.jboss.portal.identity.IdentityServiceControllerImpl;
+//import org.jboss.portal.identity.IdentityServiceControllerImpl;
import org.jboss.portal.identity.IdentityContext;
import org.jboss.portal.identity.IdentityConfiguration;
-import org.jboss.portal.identity.IdentityException;
import org.jboss.portal.identity.User;
import org.jboss.portal.identity.Role;
import org.jboss.portal.identity.NoSuchUserException;
import org.jboss.portal.identity.ldap.LDAPUserImpl;
+import org.jboss.portal.test.identity.TestServiceLoader;
import org.apache.log4j.Appender;
import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.SimpleLayout;
@@ -63,12 +63,15 @@
{
super.setUp();
- IdentityServiceControllerImpl controller = new IdentityServiceControllerImpl();
- controller.setConfigFile(getDirectoryServerConfigParameter().getConfigFile());
-
controller.setDefaultConfigFile("test/config/standardidentity-config.xml");
- controller.setRegisterMBeans(false);
- controller.start();
- identityContext = controller.getIdentityContext();
+// IdentityServiceControllerImpl controller = new IdentityServiceControllerImpl();
+// controller.setConfigFile(getDirectoryServerConfigParameter().getConfigFile());
+//
controller.setDefaultConfigFile("test/config/standardidentity-config.xml");
+// controller.setRegisterMBeans(false);
+// controller.start();
+// identityContext = controller.getIdentityContext();
+
+ identityContext = new
TestServiceLoader().loadServices("test/config/standardidentity-config.xml",
getDirectoryServerConfigParameter().getConfigFile());
+
userModule =
(UserModule)identityContext.getObject(IdentityContext.TYPE_USER_MODULE);
userModule =
(UserModule)identityContext.getObject(IdentityContext.TYPE_USER_MODULE);
roleModule =
(RoleModule)identityContext.getObject(IdentityContext.TYPE_ROLE_MODULE);
@@ -77,7 +80,7 @@
suffix = getDirectoryServerConfigParameter().getCleanUpDN();
- userPrefix =
((IdentityConfiguration)controller.getIdentityContext().getObject(IdentityContext.TYPE_IDENTITY_CONFIGURATION)).getValue(IdentityConfiguration.USER_UID_ATTRIBUTE_ID);
+ userPrefix =
((IdentityConfiguration)identityContext.getObject(IdentityContext.TYPE_IDENTITY_CONFIGURATION)).getValue(IdentityConfiguration.USER_UID_ATTRIBUTE_ID);
populate();
}
Modified:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPIdentityTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPIdentityTestCase.java 2007-08-22
23:03:16 UTC (rev 8042)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPIdentityTestCase.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -1,7 +1,8 @@
package org.jboss.portal.test.identity.ldap;
import org.jboss.portal.test.identity.IdentityTest;
-import org.jboss.portal.identity.IdentityServiceControllerImpl;
+import org.jboss.portal.test.identity.TestServiceLoader;
+//import org.jboss.portal.identity.IdentityServiceControllerImpl;
import org.jboss.portal.identity.IdentityContext;
import org.jboss.portal.identity.UserModule;
import org.jboss.portal.identity.RoleModule;
@@ -11,7 +12,6 @@
import org.jboss.portal.identity.service.RoleModuleService;
import org.jboss.portal.identity.service.MembershipModuleService;
import org.jboss.portal.identity.service.UserProfileModuleService;
-import org.jboss.portal.common.p3p.P3PConstants;
import org.apache.log4j.Appender;
import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.SimpleLayout;
@@ -19,9 +19,6 @@
import org.apache.log4j.Level;
import junit.framework.TestSuite;
-import java.util.Date;
-import java.text.SimpleDateFormat;
-
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 5748 $
@@ -61,13 +58,16 @@
super.setUp();
//bootstrap identity modules
- IdentityServiceControllerImpl controller = new IdentityServiceControllerImpl();
- controller.setConfigFile(getDirectoryServerConfigParameter().getConfigFile());
-
controller.setDefaultConfigFile("test/config/standardidentity-config.xml");
- controller.setRegisterMBeans(false);
- controller.start();
+// IdentityServiceControllerImpl controller = new IdentityServiceControllerImpl();
+// controller.setConfigFile(getDirectoryServerConfigParameter().getConfigFile());
+//
controller.setDefaultConfigFile("test/config/standardidentity-config.xml");
+// controller.setRegisterMBeans(false);
+// controller.start();
+//
+// identityContext = controller.getIdentityContext();
- identityContext = controller.getIdentityContext();
+ identityContext = new
TestServiceLoader().loadServices("test/config/standardidentity-config.xml",
getDirectoryServerConfigParameter().getConfigFile());
+
this.userModule =
(UserModuleService)identityContext.getObject(IdentityContext.TYPE_USER_MODULE);
this.roleModule =
(RoleModuleService)identityContext.getObject(IdentityContext.TYPE_ROLE_MODULE);
Modified:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPSimpleRoleModuleTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPSimpleRoleModuleTestCase.java 2007-08-22
23:03:16 UTC (rev 8042)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPSimpleRoleModuleTestCase.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -26,9 +26,10 @@
import org.jboss.portal.identity.RoleModule;
import org.jboss.portal.identity.ldap.LDAPRoleImpl;
import org.jboss.portal.identity.IdentityContext;
-import org.jboss.portal.identity.IdentityServiceControllerImpl;
+//import org.jboss.portal.identity.IdentityServiceControllerImpl;
import org.jboss.portal.identity.IdentityException;
import org.jboss.portal.test.identity.ldap.LDAPTestCase;
+import org.jboss.portal.test.identity.TestServiceLoader;
import java.util.Set;
import java.util.LinkedList;
@@ -77,12 +78,15 @@
roleModule.start();
this.roleModule = roleModule;*/
- IdentityServiceControllerImpl controller = new IdentityServiceControllerImpl();
- controller.setConfigFile(getDirectoryServerConfigParameter().getConfigFile());
-
controller.setDefaultConfigFile("test/config/standardidentity-config.xml");
- controller.setRegisterMBeans(false);
- controller.start();
- identityContext = controller.getIdentityContext();
+// IdentityServiceControllerImpl controller = new IdentityServiceControllerImpl();
+// controller.setConfigFile(getDirectoryServerConfigParameter().getConfigFile());
+//
controller.setDefaultConfigFile("test/config/standardidentity-config.xml");
+// controller.setRegisterMBeans(false);
+// controller.start();
+// identityContext = controller.getIdentityContext();
+
+ identityContext = new
TestServiceLoader().loadServices("test/config/standardidentity-config.xml",
getDirectoryServerConfigParameter().getConfigFile());
+
this.roleModule =
(RoleModule)identityContext.getObject(IdentityContext.TYPE_ROLE_MODULE);
suffix = getDirectoryServerConfigParameter().getCleanUpDN();
Modified:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPSimpleUserModuleTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPSimpleUserModuleTestCase.java 2007-08-22
23:03:16 UTC (rev 8042)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPSimpleUserModuleTestCase.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -25,9 +25,7 @@
import junit.framework.TestSuite;
import org.jboss.portal.identity.UserModule;
import org.jboss.portal.identity.ldap.LDAPUserImpl;
-import org.jboss.portal.identity.ldap.LDAPRoleImpl;
-import org.jboss.portal.identity.ldap.LDAPUserModuleImpl;
-import org.jboss.portal.identity.IdentityServiceControllerImpl;
+//import org.jboss.portal.identity.IdentityServiceControllerImpl;
import org.jboss.portal.identity.IdentityContext;
import org.jboss.portal.identity.User;
import org.jboss.portal.identity.RoleModule;
@@ -37,6 +35,7 @@
import org.jboss.portal.identity.IdentityException;
import org.jboss.portal.identity.IdentityConfiguration;
import org.jboss.portal.test.identity.ldap.LDAPTestCase;
+import org.jboss.portal.test.identity.TestServiceLoader;
import java.util.Set;
import java.util.HashSet;
@@ -73,12 +72,15 @@
{
super.setUp();
- IdentityServiceControllerImpl controller = new IdentityServiceControllerImpl();
- controller.setConfigFile(getDirectoryServerConfigParameter().getConfigFile());
-
controller.setDefaultConfigFile("test/config/standardidentity-config.xml");
- controller.setRegisterMBeans(false);
- controller.start();
- identityContext = controller.getIdentityContext();
+// IdentityServiceControllerImpl controller = new IdentityServiceControllerImpl();
+// controller.setConfigFile(getDirectoryServerConfigParameter().getConfigFile());
+//
controller.setDefaultConfigFile("test/config/standardidentity-config.xml");
+// controller.setRegisterMBeans(false);
+// controller.start();
+// identityContext = controller.getIdentityContext();
+
+ identityContext = new
TestServiceLoader().loadServices("test/config/standardidentity-config.xml",
getDirectoryServerConfigParameter().getConfigFile());
+
userModule =
(UserModule)identityContext.getObject(IdentityContext.TYPE_USER_MODULE);
userModule =
(UserModule)identityContext.getObject(IdentityContext.TYPE_USER_MODULE);
roleModule =
(RoleModule)identityContext.getObject(IdentityContext.TYPE_ROLE_MODULE);
@@ -87,7 +89,7 @@
suffix = getDirectoryServerConfigParameter().getCleanUpDN();
- userPrefix =
((IdentityConfiguration)controller.getIdentityContext().getObject(IdentityContext.TYPE_IDENTITY_CONFIGURATION)).getValue(IdentityConfiguration.USER_UID_ATTRIBUTE_ID);
+ userPrefix =
((IdentityConfiguration)identityContext.getObject(IdentityContext.TYPE_IDENTITY_CONFIGURATION)).getValue(IdentityConfiguration.USER_UID_ATTRIBUTE_ID);
populate();
}
Modified:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPStaticGroupMembershipModuleTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPStaticGroupMembershipModuleTestCase.java 2007-08-22
23:03:16 UTC (rev 8042)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPStaticGroupMembershipModuleTestCase.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -24,13 +24,14 @@
import junit.framework.TestSuite;
import org.jboss.portal.test.identity.ldap.LDAPMembershipModuleTestCase;
+import org.jboss.portal.test.identity.TestServiceLoader;
import org.jboss.portal.identity.MembershipModule;
import org.jboss.portal.identity.ldap.LDAPRoleImpl;
import org.jboss.portal.identity.ldap.LDAPUserImpl;
import org.jboss.portal.identity.IdentityContext;
import org.jboss.portal.identity.UserModule;
import org.jboss.portal.identity.RoleModule;
-import org.jboss.portal.identity.IdentityServiceControllerImpl;
+//import org.jboss.portal.identity.IdentityServiceControllerImpl;
import org.jboss.portal.identity.IdentityConfiguration;
@@ -68,12 +69,15 @@
{
super.setUp();
- IdentityServiceControllerImpl controller = new IdentityServiceControllerImpl();
- controller.setConfigFile(getDirectoryServerConfigParameter().getConfigFile());
-
controller.setDefaultConfigFile("test/config/standardidentity-config.xml");
- controller.setRegisterMBeans(false);
- controller.start();
- identityContext = controller.getIdentityContext();
+// IdentityServiceControllerImpl controller = new IdentityServiceControllerImpl();
+// controller.setConfigFile(getDirectoryServerConfigParameter().getConfigFile());
+//
controller.setDefaultConfigFile("test/config/standardidentity-config.xml");
+// controller.setRegisterMBeans(false);
+// controller.start();
+// identityContext = controller.getIdentityContext();
+
+ identityContext = new
TestServiceLoader().loadServices("test/config/standardidentity-config.xml",
getDirectoryServerConfigParameter().getConfigFile());
+
userModule =
(UserModule)identityContext.getObject(IdentityContext.TYPE_USER_MODULE);
roleModule =
(RoleModule)identityContext.getObject(IdentityContext.TYPE_ROLE_MODULE);
membershipModule =
(MembershipModule)identityContext.getObject(IdentityContext.TYPE_MEMBERSHIP_MODULE);
Modified:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPStaticRoleMembershipModuleTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPStaticRoleMembershipModuleTestCase.java 2007-08-22
23:03:16 UTC (rev 8042)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPStaticRoleMembershipModuleTestCase.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -27,11 +27,12 @@
import org.jboss.portal.identity.MembershipModule;
import org.jboss.portal.identity.IdentityConfiguration;
import org.jboss.portal.identity.IdentityContext;
-import org.jboss.portal.identity.IdentityServiceControllerImpl;
+//import org.jboss.portal.identity.IdentityServiceControllerImpl;
import org.jboss.portal.identity.service.MembershipModuleService;
import org.jboss.portal.identity.ldap.LDAPRoleImpl;
import org.jboss.portal.identity.ldap.LDAPUserImpl;
import org.jboss.portal.identity.ldap.LDAPStaticRoleMembershipModuleImpl;
+import org.jboss.portal.test.identity.TestServiceLoader;
import java.util.Set;
@@ -68,13 +69,16 @@
{
super.setUp();
- IdentityServiceControllerImpl controller = new IdentityServiceControllerImpl();
- controller.setConfigFile(getDirectoryServerConfigParameter().getConfigFile());
-
controller.setDefaultConfigFile("test/config/standardidentity-config.xml");
- controller.setRegisterMBeans(false);
- controller.start();
- identityContext = controller.getIdentityContext();
+// IdentityServiceControllerImpl controller = new IdentityServiceControllerImpl();
+// controller.setConfigFile(getDirectoryServerConfigParameter().getConfigFile());
+//
controller.setDefaultConfigFile("test/config/standardidentity-config.xml");
+// controller.setRegisterMBeans(false);
+// controller.start();
+// identityContext = controller.getIdentityContext();
+ identityContext = new
TestServiceLoader().loadServices("test/config/standardidentity-config.xml",
getDirectoryServerConfigParameter().getConfigFile());
+
+
//swap the module for the proper one for this test
//identityContext.unregister(IdentityContext.TYPE_MEMBERSHIP_MODULE);
((MembershipModuleService)identityContext.getObject(IdentityContext.TYPE_MEMBERSHIP_MODULE)).stop();
Modified:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPUserProfileModuleTestCase.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPUserProfileModuleTestCase.java 2007-08-22
23:03:16 UTC (rev 8042)
+++
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/test/identity/ldap/LDAPUserProfileModuleTestCase.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -25,11 +25,12 @@
import org.jboss.portal.identity.UserModule;
import org.jboss.portal.identity.RoleModule;
import org.jboss.portal.identity.MembershipModule;
-import org.jboss.portal.identity.IdentityServiceControllerImpl;
+//import org.jboss.portal.identity.IdentityServiceControllerImpl;
import org.jboss.portal.identity.IdentityContext;
import org.jboss.portal.identity.UserProfileModule;
import org.jboss.portal.identity.User;
import org.jboss.portal.identity.ldap.LDAPUserImpl;
+import org.jboss.portal.test.identity.TestServiceLoader;
/**
* @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw
Dawidowicz</a>
@@ -59,12 +60,15 @@
{
super.setUp();
- IdentityServiceControllerImpl controller = new IdentityServiceControllerImpl();
- controller.setConfigFile(getDirectoryServerConfigParameter().getConfigFile());
-
controller.setDefaultConfigFile("test/config/standardidentity-config.xml");
- controller.setRegisterMBeans(false);
- controller.start();
- identityContext = controller.getIdentityContext();
+// IdentityServiceControllerImpl controller = new IdentityServiceControllerImpl();
+// controller.setConfigFile(getDirectoryServerConfigParameter().getConfigFile());
+//
controller.setDefaultConfigFile("test/config/standardidentity-config.xml");
+// controller.setRegisterMBeans(false);
+// controller.start();
+// identityContext = controller.getIdentityContext();
+
+ identityContext = new
TestServiceLoader().loadServices("test/config/standardidentity-config.xml",
getDirectoryServerConfigParameter().getConfigFile());
+
userModule =
(UserModule)identityContext.getObject(IdentityContext.TYPE_USER_MODULE);
roleModule =
(RoleModule)identityContext.getObject(IdentityContext.TYPE_ROLE_MODULE);
membershipModule =
(MembershipModule)identityContext.getObject(IdentityContext.TYPE_MEMBERSHIP_MODULE);
Modified:
branches/JBoss_Portal_Branch_2_6/portlet/src/main/org/jboss/portal/portlet/state/StateConversionException.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/portlet/src/main/org/jboss/portal/portlet/state/StateConversionException.java 2007-08-22
23:03:16 UTC (rev 8042)
+++
branches/JBoss_Portal_Branch_2_6/portlet/src/main/org/jboss/portal/portlet/state/StateConversionException.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -24,7 +24,7 @@
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
+ * @version $Revision$
*/
public class StateConversionException extends Exception
{
Modified:
branches/JBoss_Portal_Branch_2_6/portlet/src/main/org/jboss/portal/portlet/state/StateManagementPolicy.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/portlet/src/main/org/jboss/portal/portlet/state/StateManagementPolicy.java 2007-08-22
23:03:16 UTC (rev 8042)
+++
branches/JBoss_Portal_Branch_2_6/portlet/src/main/org/jboss/portal/portlet/state/StateManagementPolicy.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -24,7 +24,7 @@
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
+ * @version $Revision$
*/
public interface StateManagementPolicy
{
Modified:
branches/JBoss_Portal_Branch_2_6/portlet/src/main/org/jboss/portal/portlet/state/consumer/ConsumerPersistenceManager.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/portlet/src/main/org/jboss/portal/portlet/state/consumer/ConsumerPersistenceManager.java 2007-08-22
23:03:16 UTC (rev 8042)
+++
branches/JBoss_Portal_Branch_2_6/portlet/src/main/org/jboss/portal/portlet/state/consumer/ConsumerPersistenceManager.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -27,7 +27,7 @@
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
+ * @version $Revision$
*/
public interface ConsumerPersistenceManager
{
Modified:
branches/JBoss_Portal_Branch_2_6/portlet/src/main/org/jboss/portal/portlet/state/consumer/ConsumerState.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/portlet/src/main/org/jboss/portal/portlet/state/consumer/ConsumerState.java 2007-08-22
23:03:16 UTC (rev 8042)
+++
branches/JBoss_Portal_Branch_2_6/portlet/src/main/org/jboss/portal/portlet/state/consumer/ConsumerState.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -26,7 +26,7 @@
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
+ * @version $Revision$
*/
public class ConsumerState
{
Modified:
branches/JBoss_Portal_Branch_2_6/portlet/src/main/org/jboss/portal/portlet/state/consumer/ConsumerStateContext.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/portlet/src/main/org/jboss/portal/portlet/state/consumer/ConsumerStateContext.java 2007-08-22
23:03:16 UTC (rev 8042)
+++
branches/JBoss_Portal_Branch_2_6/portlet/src/main/org/jboss/portal/portlet/state/consumer/ConsumerStateContext.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -24,7 +24,7 @@
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
+ * @version $Revision$
*/
public class ConsumerStateContext extends ConsumerState
{
Modified:
branches/JBoss_Portal_Branch_2_6/search/src/main/org/jboss/portal/search/FederatedSearcher.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/search/src/main/org/jboss/portal/search/FederatedSearcher.java 2007-08-22
23:03:16 UTC (rev 8042)
+++
branches/JBoss_Portal_Branch_2_6/search/src/main/org/jboss/portal/search/FederatedSearcher.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -22,10 +22,8 @@
******************************************************************************/
package org.jboss.portal.search;
-import java.util.Locale;
-
import org.jboss.portal.common.i18n.LocalizedString;
-import org.jboss.portal.identity.config.metadata.profile.LocalizedStringMetaData;
+import org.jboss.portal.identity.metadata.profile.LocalizedStringMetaData;
import org.jboss.portal.search.result.ResultSet;
/**
Modified:
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/portlet/UserContextPortlet.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/portlet/UserContextPortlet.java 2007-08-22
23:03:16 UTC (rev 8042)
+++
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/portlet/UserContextPortlet.java 2007-08-23
00:13:18 UTC (rev 8043)
@@ -33,7 +33,7 @@
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
- * @version $Revision: 5440 $
+ * @version $Revision$
* @since 2.4
*/
public class UserContextPortlet extends GenericPortlet