JBoss Portal SVN: r8051 - in trunk/core-identity: src/main/org/jboss/portal/core/identity/services and 23 other directories.
by portal-commits@lists.jboss.org
Author: emuckenhuber
Date: 2007-08-27 15:20:51 -0400 (Mon, 27 Aug 2007)
New Revision: 8051
Added:
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityConstants.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityMailService.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityMailServiceImpl.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/ApproveRegistration.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/CreateUserAction.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/RegistrationService.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/SendValidationMailAction.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/UserContainer.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/ValidateEmailService.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/ValidateEmailServiceImpl.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/faces/
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/faces/PortletDelegatingPropertyResolver.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/faces/PortletVariableResolver.java
trunk/core-identity/src/resources/portal-identity-sar/conf/
trunk/core-identity/src/resources/portal-identity-sar/conf/processes/
trunk/core-identity/src/resources/portal-identity-sar/conf/processes/jbp_identity_validate_email.xml
trunk/core-identity/src/resources/portal-identity-sar/conf/processes/jbp_identity_validation_approval_workflow.xml
trunk/core-identity/src/resources/portal-identity-sar/conf/templates/
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/user/pendingUsers.xhtml
trunk/core-identity/src/resources/resource-bundles/
trunk/core-identity/src/resources/resource-bundles/Identity.properties
trunk/core-identity/src/resources/resource-bundles/Identity_de.properties
Removed:
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/IdentityConstants.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/common/SendMailBean.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/workflow/
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/classes/Identity.properties
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/classes/Identity_de.properties
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/classes/templates/
Modified:
trunk/core-identity/.classpath
trunk/core-identity/build.xml
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityCommandFactoryService.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/captcha/ImageCaptchaServlet.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/services/captcha/JCaptchaService.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/CreateUserAction.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/EditProfileAction.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/LostPasswordAction.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/admin/RoleManagementBean.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/admin/UserAdministrationBean.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/common/IdentityUserBean.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/common/MetaDataServiceBean.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/CaptchaValidator.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/CurrentPasswordValidator.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/EmailValidator.java
trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/UsernameValidator.java
trunk/core-identity/src/resources/portal-identity-sar/META-INF/jboss-service.xml
trunk/core-identity/src/resources/portal-identity-sar/conf/templates/changeEmail/emailTemplate.tpl
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/faces-config.xml
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jboss-portlet.xml
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/index.xhtml
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/roles/roleMembers.xhtml
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/common/register.xhtml
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/index.xhtml
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/lostPassword/lost.xhtml
trunk/core-identity/src/resources/portal-identity-war/WEB-INF/portlet.xml
Log:
- user registration with jBPM
- added portletPreferences variable resolver
Modified: trunk/core-identity/.classpath
===================================================================
--- trunk/core-identity/.classpath 2007-08-27 19:09:00 UTC (rev 8050)
+++ trunk/core-identity/.classpath 2007-08-27 19:20:51 UTC (rev 8051)
@@ -12,17 +12,6 @@
<classpathentry combineaccessrules="false" kind="src" path="/security"/>
<classpathentry combineaccessrules="false" kind="src" path="/server"/>
<classpathentry combineaccessrules="false" kind="src" path="/workflow"/>
- <classpathentry kind="lib" path="output/resources/portal-identity-war/WEB-INF/lib2/commons-beanutils.jar"/>
- <classpathentry kind="lib" path="output/resources/portal-identity-war/WEB-INF/lib2/commons-digester.jar"/>
- <classpathentry kind="lib" path="output/resources/portal-identity-war/WEB-INF/lib2/commons-el.jar"/>
- <classpathentry kind="lib" path="output/resources/portal-identity-war/WEB-INF/lib2/el-api.jar"/>
- <classpathentry kind="lib" path="output/resources/portal-identity-war/WEB-INF/lib2/el-ri.jar"/>
- <classpathentry kind="lib" path="output/resources/portal-identity-war/WEB-INF/lib2/jsf-example.jar"/>
- <classpathentry kind="lib" path="output/resources/portal-identity-war/WEB-INF/lib2/jsf-facelets.jar"/>
- <classpathentry kind="lib" path="output/resources/portal-identity-war/WEB-INF/lib2/jstl.jar"/>
- <classpathentry kind="lib" path="output/resources/portal-identity-war/WEB-INF/lib2/myfaces-api.jar"/>
- <classpathentry kind="lib" path="output/resources/portal-identity-war/WEB-INF/lib2/myfaces-impl.jar"/>
- <classpathentry kind="lib" path="output/resources/portal-identity-war/WEB-INF/lib2/portal-faces-lib.jar"/>
<classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jboss-common.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/common"/>
<classpathentry kind="lib" path="/thirdparty/sun-servlet/lib/servlet-api.jar"/>
@@ -39,11 +28,9 @@
<classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jboss-j2ee.jar"/>
<classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jboss-jaxrpc.jar"/>
<classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jboss-jca.jar"/>
- <classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jboss-jmx.jar" sourcepath="/JBoss_AS_4.0.5/jmx/src/main"/>
<classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jboss-local-jdbc.jar"/>
<classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jboss-saaj.jar"/>
<classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jbosssx.jar"/>
- <classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jboss-system.jar" sourcepath="/JBoss_AS_4.0.5/system/src/main"/>
<classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jboss-transaction.jar"/>
<classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jboss-xml-binding.jar"/>
<classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jmx-invoker-adaptor-client.jar"/>
@@ -51,5 +38,13 @@
<classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jnpserver.jar"/>
<classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/namespace.jar"/>
<classpathentry kind="lib" path="/thirdparty/jcaptcha/lib/jcaptcha.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jboss-system.jar" sourcepath="/JBoss_AS_4.0.5/system/src/main"/>
+ <classpathentry kind="lib" path="/thirdparty/jbossas/core-libs/lib/jboss-jmx.jar" sourcepath="/JBoss_AS_4.0.5/jmx/src/main"/>
+ <classpathentry kind="lib" path="/thirdparty/jbpm/jaronly/lib/jbpm.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/jbpm/jaronly/lib/jbpm-identity.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/facelets/lib/jsf-facelets.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/apache-myfaces/lib/jstl.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/apache-myfaces/lib/myfaces-api.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/apache-myfaces/lib/myfaces-impl.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: trunk/core-identity/build.xml
===================================================================
--- trunk/core-identity/build.xml 2007-08-27 19:09:00 UTC (rev 8050)
+++ trunk/core-identity/build.xml 2007-08-27 19:20:51 UTC (rev 8051)
@@ -102,6 +102,7 @@
<path refid="jakarta.cactus.classpath"/>
<path refid="junit.junit.classpath"/>
<pathelement location="${source.etc}/sun-jsf/jsf-example.jar"/>
+ <path refid="jbpm.jaronly.classpath"/>
</path>
<!-- Configure modules -->
@@ -122,6 +123,7 @@
<path refid="jboss.portal-security.classpath"/>
<path refid="jboss.portal-test.classpath"/>
<path refid="jboss.portal-core.classpath"/>
+ <path refid="jboss.portal-workflow.classpath"/>
</path>
<!--+=======================================+-->
@@ -197,6 +199,7 @@
<!-- portal-core-identity-services-lib.jar -->
<jar jarfile="${build.lib}/portal-core-identity-services-lib.jar">
<fileset dir="${build.classes}" includes="org/jboss/portal/core/identity/services/**" />
+ <fileset dir="${build.resources}/resource-bundles/" />
</jar>
<!-- portal-identity.war -->
Modified: trunk/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityCommandFactoryService.java
===================================================================
--- trunk/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityCommandFactoryService.java 2007-08-27 19:09:00 UTC (rev 8050)
+++ trunk/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityCommandFactoryService.java 2007-08-27 19:20:51 UTC (rev 8051)
@@ -22,25 +22,16 @@
******************************************************************************/
package org.jboss.portal.core.identity.services;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
-import org.jboss.portal.common.util.Tools;
import org.jboss.portal.core.controller.ControllerCommand;
import org.jboss.portal.core.controller.ControllerContext;
import org.jboss.portal.core.controller.command.mapper.AbstractCommandFactory;
-import org.jboss.portal.core.identity.ui.IdentityConstants;
+import org.jboss.portal.core.identity.services.workflow.RegistrationService;
+import org.jboss.portal.core.identity.services.workflow.ValidateEmailService;
import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.core.model.portal.PortalObjectPath;
import org.jboss.portal.core.model.portal.command.action.InvokePortletWindowRenderCommand;
-import org.jboss.portal.core.ui.portlet.user.UserPortletConstants;
-import org.jboss.portal.identity.IdentityException;
-import org.jboss.portal.identity.NoSuchUserException;
-import org.jboss.portal.identity.User;
-import org.jboss.portal.identity.UserModule;
-import org.jboss.portal.identity.UserProfileModule;
import org.jboss.portal.portlet.PortletParametersStateString;
import org.jboss.portal.server.ServerInvocation;
import org.jboss.portal.server.config.ServerConfig;
@@ -62,10 +53,10 @@
protected ServerConfig serverConfig;
/** . */
- protected UserModule userModule;
-
+ protected RegistrationService registrationService = null;
+
/** . */
- protected UserProfileModule userProfileModule;
+ protected ValidateEmailService validateEmailService = null;
public PortalObjectId getTargetWindowId()
{
@@ -82,26 +73,30 @@
this.serverConfig = serverConfig;
}
- public IdentityCommandFactoryService()
+ public RegistrationService getRegistrationService()
{
- try
- {
- // Do something better ?
- InitialContext ctx = new InitialContext();
- this.userModule = (UserModule) ctx.lookup("java:/portal/UserModule");
- this.userProfileModule = (UserProfileModule) ctx.lookup("java:/portal/UserProfileModule");
- }
- catch (NamingException e)
- {
- e.printStackTrace();
- }
+ return registrationService;
}
+ public void setRegistrationService(RegistrationService registrationService)
+ {
+ this.registrationService = registrationService;
+ }
+
+ public ValidateEmailService getValidateEmailService()
+ {
+ return validateEmailService;
+ }
+
+ public void setValidateEmailService(ValidateEmailService validateEmailService)
+ {
+ this.validateEmailService = validateEmailService;
+ }
+
public ControllerCommand doMapping(ControllerContext controllerContext, ServerInvocation invocation, String host,
String contextPath, String requestPath)
{
PortletParametersStateString renderParameters = new PortletParametersStateString();
- //renderParameters.setValue("action", "editProfile");
if (requestPath != null)
{
@@ -111,64 +106,21 @@
String[] aRequest = rPath.split("/");
int aLength = aRequest.length;
- // Values: action / userId / hash / default / default / IdentityUserPorletWindow
- if (aLength > 2)
+ if (aLength == 2)
{
// TODO - UTF-8 decode
- String action = aRequest[0];
- String username = aRequest[1];
- String hash = aRequest[2];
+ String bpmId = aRequest[0];
+ String hash = aRequest[1];
+
+ validateEmailService.validateEmail(bpmId, hash);
- // Building path for targetWindow
- StringBuffer buffer = new StringBuffer();
- for (int i = 3; i < aLength; i++)
- {
- buffer.append(aRequest[i]);
- if ((i + 1) != aLength)
- {
- buffer.append(".");
- }
- }
+ // TODO
+ this.targetWindowId = PortalObjectId.parse("default.default.wizardWindow_10", PortalObjectPath.LEGACY_FORMAT);
- // TODO - nice failure
- this.targetWindowId = PortalObjectId.parse(buffer.toString(), PortalObjectPath.LEGACY_FORMAT);
-
- try
- {
- User user = this.userModule.findUserByUserName(username);
- String storedHash = (String) this.userProfileModule.getProperty(user, IdentityConstants.USER_PROFILE_GENERATED_HASH);
-
- if ( storedHash.equals(hash))
- {
- if (IdentityConstants.VERIFICATION_ACTION_REGISTER.equals(action))
- {
- this.userProfileModule.setProperty(user, User.INFO_USER_ENABLED, Boolean.TRUE);
- }
- else if (IdentityConstants.VERIFICATION_ACTION_UPDATE_EMAIL.equals(action))
- {
- String newEmail = (String) this.userProfileModule.getProperty(user, IdentityConstants.USER_PROFILE_NEW_EMAIL_ADDRESS);
- this.userProfileModule.setProperty(user, User.INFO_USER_EMAIL_REAL, newEmail);
- }
- }
- }
- catch (IllegalArgumentException e)
- {
- // FIXME
- e.printStackTrace();
- }
- catch (NoSuchUserException e)
- {
- //
- }
- catch (IdentityException e)
- {
- // FIXME
- e.printStackTrace();
- }
}
else
{
- this.targetWindowId = PortalObjectId.parse("default.default.wizardWindow_33",
+ this.targetWindowId = PortalObjectId.parse("default.default.wizardWindow_10",
PortalObjectPath.LEGACY_FORMAT);
}
Copied: trunk/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityConstants.java (from rev 8017, trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/IdentityConstants.java)
===================================================================
--- trunk/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityConstants.java (rev 0)
+++ trunk/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityConstants.java 2007-08-27 19:20:51 UTC (rev 8051)
@@ -0,0 +1,52 @@
+/******************************************************************************
+ * 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.services;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class IdentityConstants
+{
+ public static final String HASH_SALT = "fuDrupRunEP2BRuspADr";
+
+ /*
+ * Available actions
+ */
+ public static final String ACTION = "action";
+ public static final String ACTION_REGISTER_USER = "register";
+ public static final String ACTION_CHANGE_EMAIL = "changeEmail";
+ public static final String ACTION_LOST_PASSWORD = "lostPassword";
+
+ public static final String REGISTRATION_REGISTERED = "REGISTERED";
+ public static final String REGISTRATION_PENDING ="PENDING";
+
+ public static final String VALIDATION_HASH = "validationHash";
+ public static final String VARIABLE_LOCALE = "locale";
+ public static final String VARIABLE_EMAIL = "email";
+ public static final String VARIABLE_USER = "user";
+
+ public static final String DEFAULT_LOCALE = "en";
+
+}
+
Added: trunk/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityMailService.java
===================================================================
--- trunk/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityMailService.java (rev 0)
+++ trunk/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityMailService.java 2007-08-27 19:20:51 UTC (rev 8051)
@@ -0,0 +1,39 @@
+/******************************************************************************
+ * 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.services;
+
+import java.io.IOException;
+import java.util.Locale;
+import java.util.Map;
+
+import freemarker.template.TemplateException;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface IdentityMailService
+{
+ void sendMail(String templateLocation, Map mailData, Locale locale) throws IOException, TemplateException;
+}
+
Added: trunk/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityMailServiceImpl.java
===================================================================
--- trunk/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityMailServiceImpl.java (rev 0)
+++ trunk/core-identity/src/main/org/jboss/portal/core/identity/services/IdentityMailServiceImpl.java 2007-08-27 19:20:51 UTC (rev 8051)
@@ -0,0 +1,213 @@
+/******************************************************************************
+ * 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.services;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.StringWriter;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+import java.util.ResourceBundle;
+
+import javax.naming.InitialContext;
+
+import org.jboss.logging.Logger;
+import org.jboss.portal.core.modules.MailModule;
+import org.jboss.portal.jems.as.JNDI;
+import org.jboss.portal.jems.as.system.AbstractJBossService;
+
+import freemarker.template.Configuration;
+import freemarker.template.Template;
+import freemarker.template.TemplateException;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class IdentityMailServiceImpl extends AbstractJBossService implements IdentityMailService
+{
+
+ /** . */
+ private Map mailData = new HashMap();
+
+ /** . */
+ private Locale locale;
+
+ /** . */
+ private String emailText = null;
+
+ /** . */
+ private String emailDomain = "TODO emailDomain";
+
+ /** . */
+ private String emailFrom = "no-reply(a)todo.com";
+
+ /** . */
+ private String templateLocation;
+
+ /** . */
+ private MailModule mailModule;
+
+ /** . */
+ private static final Logger log = Logger.getLogger(IdentityMailServiceImpl.class);
+
+ /** . */
+ private JNDI.Binding jndiBinding;
+
+ /** . */
+ private String jndiName = null;
+
+ /** . */
+ public void startService() throws Exception
+ {
+ super.startService();
+
+ if (this.jndiName != null)
+ {
+ jndiBinding = new JNDI.Binding(jndiName, this);
+ jndiBinding.bind();
+ }
+
+ this.mailModule = (MailModule) new InitialContext().lookup("java:/portal/MailModule");
+ if (mailModule == null)
+ throw new Exception("no mail module");
+ }
+
+ public void stopService() throws Exception
+ {
+ super.stopService();
+
+ if (jndiBinding != null)
+ {
+ jndiBinding.unbind();
+ jndiBinding = null;
+ }
+ }
+
+ public String getEmailDomain()
+ {
+ return emailDomain;
+ }
+
+ public void setEmailDomain(String emailDomain)
+ {
+ this.emailDomain = emailDomain;
+ }
+
+ public String getEmailFrom()
+ {
+ return emailFrom;
+ }
+
+ public void setEmailFrom(String emailFrom)
+ {
+ this.emailFrom = emailFrom;
+ }
+
+ public MailModule getMailModule()
+ {
+ return mailModule;
+ }
+
+ public void setMailModule(MailModule mailModule)
+ {
+ this.mailModule = mailModule;
+ }
+
+ public String getJNDIName()
+ {
+ return this.jndiName;
+ }
+
+ public void setJNDIName(String jndiName)
+ {
+ this.jndiName = jndiName;
+ }
+
+ public void sendMail(String templateLocation, Map mailData, Locale locale) throws IOException, TemplateException
+ {
+ this.templateLocation = templateLocation;
+ this.mailData = mailData;
+ this.locale = locale;
+ this.mailData.put("emailDomain", emailDomain);
+
+ ResourceBundle bundle = ResourceBundle.getBundle("Identity", locale);
+
+ String subject = null;
+ String to = (String) mailData.get("to");
+
+ if (IdentityConstants.ACTION_REGISTER_USER.equals(templateLocation))
+ {
+ subject = bundle.getString("IDENTITY_MAIL_SUBJECT_REGISTER");
+ }
+ else if (IdentityConstants.ACTION_CHANGE_EMAIL.equals(templateLocation))
+ {
+ subject = bundle.getString("IDENTITY_MAIL_SUBJECT_CHANGE_EMAIL");
+ }
+ else if (IdentityConstants.ACTION_LOST_PASSWORD.equals(templateLocation))
+ {
+ subject = bundle.getString("IDENTITY_MAIL_SUBJECT_LOST_PASSWORD");
+ }
+ else
+ {
+ throw new IllegalArgumentException("unknown template.");
+ }
+
+ // Generating message
+ this.generateEmailText();
+
+ // Sending mail
+ // mailModule.send(emailFrom, to , subject, emailText);
+ log.debug(subject + to + this.emailText);
+ }
+
+ private void generateEmailText() throws IOException, TemplateException
+ {
+ ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+ URL config = tcl.getResource("conf/templates/" + this.templateLocation + "/emailTemplate_" + locale.getLanguage() + "_" + locale.getCountry() + ".tpl");
+ if (config == null)
+ {
+ config = tcl.getResource("conf/templates/" + this.templateLocation + "/emailTemplate_" + locale.getLanguage() + ".tpl");
+ }
+ if (config == null)
+ {
+ config = tcl.getResource("conf/templates/" + this.templateLocation + "/emailTemplate.tpl");
+ }
+ if (config == null)
+ {
+ throw new FileNotFoundException("Cannot load a suitable emailTemplate.tpl in templates/"
+ + this.templateLocation);
+ }
+ InputStream in = config.openStream();
+ Template tpl = new Template("emailTemplate", new InputStreamReader(in), new Configuration());
+ StringWriter out = new StringWriter();
+ tpl.process(this.mailData, out);
+ out.close();
+
+ this.emailText = out.toString();
+ }
+}
Modified: trunk/core-identity/src/main/org/jboss/portal/core/identity/services/captcha/ImageCaptchaServlet.java
===================================================================
--- trunk/core-identity/src/main/org/jboss/portal/core/identity/services/captcha/ImageCaptchaServlet.java 2007-08-27 19:09:00 UTC (rev 8050)
+++ trunk/core-identity/src/main/org/jboss/portal/core/identity/services/captcha/ImageCaptchaServlet.java 2007-08-27 19:20:51 UTC (rev 8051)
@@ -22,10 +22,6 @@
******************************************************************************/
package org.jboss.portal.core.identity.services.captcha;
-import com.octo.captcha.service.CaptchaServiceException;
-import com.sun.image.codec.jpeg.JPEGCodec;
-import com.sun.image.codec.jpeg.JPEGImageEncoder;
-
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
@@ -33,63 +29,43 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-
-
-
-import java.awt.image.BufferedImage;
-import java.io.ByteArrayOutputStream;
import java.io.IOException;
/**
* @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
* @version $Revision$
*/
-public class ImageCaptchaServlet extends HttpServlet {
+public class ImageCaptchaServlet extends HttpServlet
+{
+ public void init(ServletConfig servletConfig) throws ServletException
+ {
+ super.init(servletConfig);
+ }
- public void init(ServletConfig servletConfig) throws ServletException {
+ protected void doGet(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse)
+ throws ServletException, IOException
+ {
- super.init(servletConfig);
+ byte[] captchaChallenge = null;
+ String captchaId = httpServletRequest.getSession().getId();
+ try
+ {
+ captchaChallenge = JCaptchaService.getChallengeImage(captchaId, httpServletRequest.getLocale());
+ }
+ catch (IllegalArgumentException e)
+ {
+ httpServletResponse.sendError(HttpServletResponse.SC_NOT_FOUND);
+ return;
+ }
- }
-
- protected void doGet(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws ServletException, IOException {
-
- byte[] captchaChallengeAsJpeg = null;
- // the output stream to render the captcha image as jpeg into
- ByteArrayOutputStream jpegOutputStream = new ByteArrayOutputStream();
- try {
- // get the session id that will identify the generated captcha.
- //the same id must be used to validate the response, the session id is a good candidate!
- String captchaId = httpServletRequest.getSession().getId();
- // call the ImageCaptchaService getChallenge method
- BufferedImage challenge =
- JCaptchaService.getInstance().getImageChallengeForID(captchaId,
- httpServletRequest.getLocale());
-
- // a jpeg encoder
- JPEGImageEncoder jpegEncoder =
- JPEGCodec.createJPEGEncoder(jpegOutputStream);
- jpegEncoder.encode(challenge);
- } catch (IllegalArgumentException e) {
- httpServletResponse.sendError(HttpServletResponse.SC_NOT_FOUND);
- return;
- } catch (CaptchaServiceException e) {
- httpServletResponse.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
- return;
- }
-
- captchaChallengeAsJpeg = jpegOutputStream.toByteArray();
-
- // flush it in the response
- httpServletResponse.setHeader("Cache-Control", "no-store");
- httpServletResponse.setHeader("Pragma", "no-cache");
- httpServletResponse.setDateHeader("Expires", 0);
- httpServletResponse.setContentType("image/jpeg");
- ServletOutputStream responseOutputStream =
- httpServletResponse.getOutputStream();
- responseOutputStream.write(captchaChallengeAsJpeg);
- responseOutputStream.flush();
- responseOutputStream.close();
- }
+ httpServletResponse.setHeader("Cache-Control", "no-store");
+ httpServletResponse.setHeader("Pragma", "no-cache");
+ httpServletResponse.setDateHeader("Expires", 0);
+ httpServletResponse.setContentType("image/jpeg");
+ ServletOutputStream responseOutputStream = httpServletResponse.getOutputStream();
+ responseOutputStream.write(captchaChallenge);
+ responseOutputStream.flush();
+ responseOutputStream.close();
+ }
}
\ No newline at end of file
Modified: trunk/core-identity/src/main/org/jboss/portal/core/identity/services/captcha/JCaptchaService.java
===================================================================
--- trunk/core-identity/src/main/org/jboss/portal/core/identity/services/captcha/JCaptchaService.java 2007-08-27 19:09:00 UTC (rev 8050)
+++ trunk/core-identity/src/main/org/jboss/portal/core/identity/services/captcha/JCaptchaService.java 2007-08-27 19:20:51 UTC (rev 8051)
@@ -23,9 +23,15 @@
package org.jboss.portal.core.identity.services.captcha;
import java.awt.image.BufferedImage;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.Locale;
import com.octo.captcha.service.image.DefaultManageableImageCaptchaService;
import com.octo.captcha.service.image.ImageCaptchaService;
+import com.sun.image.codec.jpeg.ImageFormatException;
+import com.sun.image.codec.jpeg.JPEGCodec;
+import com.sun.image.codec.jpeg.JPEGImageEncoder;
/**
* @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
@@ -33,19 +39,23 @@
*/
public class JCaptchaService
{
-
+ /** . */
private static ImageCaptchaService instance = new DefaultManageableImageCaptchaService();
- public static ImageCaptchaService getInstance()
+ public static Boolean validateResponseForID(String challengeId, String value)
{
- return instance;
+ return instance.validateResponseForID(challengeId, value);
}
- public BufferedImage challenge(String challengeId)
+ public static byte[] getChallengeImage(String challengeId, Locale locale) throws ImageFormatException, IOException
{
- return instance.getImageChallengeForID(challengeId);
+ ByteArrayOutputStream jpegOutputStream = new ByteArrayOutputStream();
+
+ BufferedImage challenge = instance.getImageChallengeForID(challengeId, locale);
+
+ JPEGImageEncoder jpegEncoder = JPEGCodec.createJPEGEncoder(jpegOutputStream);
+ jpegEncoder.encode(challenge);
+
+ return jpegOutputStream.toByteArray();
}
-
-
}
-
Added: trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/ApproveRegistration.java
===================================================================
--- trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/ApproveRegistration.java (rev 0)
+++ trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/ApproveRegistration.java 2007-08-27 19:20:51 UTC (rev 8051)
@@ -0,0 +1,291 @@
+/******************************************************************************
+ * 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.services.workflow;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import org.jboss.logging.Logger;
+import org.jboss.portal.common.io.IOTools;
+import org.jboss.portal.core.identity.services.IdentityConstants;
+import org.jboss.portal.identity.User;
+import org.jboss.portal.jems.as.JNDI;
+import org.jboss.portal.jems.as.system.AbstractJBossService;
+import org.jboss.portal.workflow.service.WorkflowService;
+import org.jbpm.JbpmContext;
+import org.jbpm.db.GraphSession;
+import org.jbpm.graph.def.Node;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.graph.exe.ProcessInstance;
+import org.jbpm.graph.exe.Token;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ApproveRegistration extends AbstractJBossService implements RegistrationService
+{
+
+ /** . */
+ private static final Logger log = Logger.getLogger(ApproveRegistration.class);
+
+ /** . */
+ private WorkflowService workflowService = null;
+
+ /** . */
+ private String processName = "jbp_identity_validation_approval_workflow";
+
+ /** . */
+ private boolean overwrite = false;
+
+ /** . */
+ private String processFile = "conf/processes/" + processName + ".xml";
+
+ /** . */
+ private JNDI.Binding jndiBinding;
+
+ /** . */
+ private String jndiName = null;
+
+ /** . */
+ private ValidateEmailService validateEmailService;
+
+ public void startService() throws Exception
+ {
+ super.startService();
+
+ if (this.jndiName != null)
+ {
+ jndiBinding = new JNDI.Binding(jndiName, this);
+ jndiBinding.bind();
+ }
+
+ InputStream is = null;
+ JbpmContext jbpmContext = null;
+ try
+ {
+ jbpmContext = this.workflowService.getJbpmConfiguration().createJbpmContext();
+
+ ProcessDefinition processDefinition = jbpmContext.getGraphSession().findLatestProcessDefinition(
+ this.processName);
+ if (processDefinition == null)
+ {
+ processDefinition = ProcessDefinition.parseXmlResource(processFile);
+ jbpmContext.deployProcessDefinition(processDefinition);
+ }
+ else
+ {
+ // A process definition already exists....should deploy a new version
+ // of the definition if overwrite is true
+ ProcessDefinition fromConfig = ProcessDefinition.parseXmlResource(processFile);
+ if (this.overwrite)
+ {
+ // If the two of them are not same, create a new version
+ // of this process definition
+ jbpmContext.deployProcessDefinition(fromConfig);
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ //
+ this.stopService();
+
+ //
+ throw e;
+ }
+ finally
+ {
+ IOTools.safeClose(is);
+ IOTools.safeClose(jbpmContext);
+ }
+ }
+
+ public void stopService() throws Exception
+ {
+ super.stopService();
+
+ if (jndiBinding != null)
+ {
+ jndiBinding.unbind();
+ jndiBinding = null;
+ }
+ }
+
+ /** @return */
+ public WorkflowService getWorkflowService()
+ {
+ return this.workflowService;
+ }
+
+ /** @param workflowService */
+ public void setWorkflowService(WorkflowService workflowService)
+ {
+ this.workflowService = workflowService;
+ }
+
+ /** @return */
+ public String getJNDIName()
+ {
+ return this.jndiName;
+ }
+
+ /** @param jndiName */
+ public void setJNDIName(String jndiName)
+ {
+ this.jndiName = jndiName;
+ }
+
+ public ValidateEmailService getValidateEmailService()
+ {
+ return validateEmailService;
+ }
+
+ public void setValidateEmailService(ValidateEmailService validateEmailService)
+ {
+ this.validateEmailService = validateEmailService;
+ }
+
+ public String registerUser(String username, String password, Map profileMap, List roles, Locale locale)
+ {
+ JbpmContext jbpmContext = null;
+ ProcessInstance processInstance = null;
+ // String registrationHash = this.hashGen(); - done at send email action
+ boolean success = false;
+ try
+ {
+ jbpmContext = this.workflowService.getJbpmConfiguration().createJbpmContext();
+ processInstance = jbpmContext.newProcessInstance(this.processName);
+ Token token = processInstance.getRootToken();
+
+ // Setting required attributes for the workflow
+ UserContainer user = new UserContainer(username, password, profileMap, roles);
+ processInstance.getContextInstance().setVariable(IdentityConstants.VARIABLE_USER, user);
+ processInstance.getContextInstance().setVariable(IdentityConstants.VARIABLE_EMAIL, user.getProfileMap().get(User.INFO_USER_EMAIL_REAL));
+ processInstance.getContextInstance().setVariable(IdentityConstants.VARIABLE_LOCALE, locale);
+ processInstance.getContextInstance().setVariable(IdentityConstants.ACTION, IdentityConstants.ACTION_REGISTER_USER);
+ token.signal();
+ success = true;
+ }
+ catch (Exception e)
+ {
+ success = false;
+ log.error("Exception in Workflow", e);
+ // throw new WorkflowException(e);
+ }
+ finally
+ {
+ if (processInstance != null && success)
+ {
+ jbpmContext.save(processInstance);
+ }
+ IOTools.safeClose(jbpmContext);
+ }
+ return IdentityConstants.REGISTRATION_PENDING;
+ }
+
+ public String approve(String id, boolean approve)
+ {
+ JbpmContext jbpmContext = null;
+ try
+ {
+ long processId = Long.valueOf(id).longValue();
+ jbpmContext = jbpmContext.getJbpmConfiguration().createJbpmContext();
+ ProcessInstance processInstance = jbpmContext.getProcessInstance(processId);
+
+ if (processInstance != null)
+ {
+ Node n = processInstance.getRootToken().getNode();
+ if (n.getName().equals("adminApproval"))
+ {
+ if (approve)
+ {
+ processInstance.signal("approved");
+ }
+ else
+ {
+ processInstance.signal("rejected");
+ }
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ log.error("", e);
+ }
+ finally
+ {
+ IOTools.safeClose(jbpmContext);
+ }
+ return IdentityConstants.REGISTRATION_PENDING;
+ }
+
+ public List getPendingUsers()
+ {
+ List queue = new ArrayList();
+ JbpmContext jbpmContext = null;
+ try
+ {
+ jbpmContext = this.workflowService.getJbpmConfiguration().createJbpmContext();
+
+ GraphSession graphSession = jbpmContext.getGraphSession();
+ ProcessDefinition processDef = graphSession.findLatestProcessDefinition(this.processName);
+ List processInstances = graphSession.findProcessInstances(processDef.getId());
+
+ if (processInstances != null)
+ {
+ Iterator i = processInstances.iterator();
+ while (i.hasNext())
+ {
+ ProcessInstance instance = (ProcessInstance) i.next();
+ if (!instance.hasEnded())
+ {
+ Object obj = instance.getContextInstance().getVariable(IdentityConstants.VARIABLE_USER);
+ if (obj instanceof UserContainer)
+ {
+ // Filling pending user List
+ UserContainer user = (UserContainer) obj;
+ user.setProcessId(String.valueOf(instance.getId()));
+ user.setCurrentNode(instance.getRootToken().getNode().getName());
+ queue.add(user);
+ }
+ }
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ log.error("", e);
+ }
+ finally
+ {
+ IOTools.safeClose(jbpmContext);
+ }
+ return queue;
+ }
+
+}
Added: trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/CreateUserAction.java
===================================================================
--- trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/CreateUserAction.java (rev 0)
+++ trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/CreateUserAction.java 2007-08-27 19:20:51 UTC (rev 8051)
@@ -0,0 +1,45 @@
+/******************************************************************************
+ * 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.services.workflow;
+
+import org.jboss.logging.Logger;
+import org.jbpm.graph.def.ActionHandler;
+import org.jbpm.graph.exe.ExecutionContext;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class CreateUserAction implements ActionHandler
+{
+ private static Logger log = Logger.getLogger(CreateUserAction.class);
+
+ public void execute(ExecutionContext ectx) throws Exception
+ {
+ UserContainer user = (UserContainer) ectx.getContextInstance().getVariable("user");
+ // FIXME execute
+ log.debug("creating User: "+ user.getUsername() );
+ }
+
+}
+
Added: trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/RegistrationService.java
===================================================================
--- trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/RegistrationService.java (rev 0)
+++ trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/RegistrationService.java 2007-08-27 19:20:51 UTC (rev 8051)
@@ -0,0 +1,44 @@
+/******************************************************************************
+ * 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.services.workflow;
+
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface RegistrationService
+{
+ /** . */
+ String registerUser(String username, String password, Map profileMap, List roles, Locale locale);
+
+ /** . */
+ String approve(String id, boolean approve);
+
+ /** . */
+ List getPendingUsers();
+}
+
Added: trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/SendValidationMailAction.java
===================================================================
--- trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/SendValidationMailAction.java (rev 0)
+++ trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/SendValidationMailAction.java 2007-08-27 19:20:51 UTC (rev 8051)
@@ -0,0 +1,178 @@
+/******************************************************************************
+ * 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.services.workflow;
+
+import java.security.NoSuchAlgorithmException;
+import java.security.SecureRandom;
+import java.util.HashMap;
+import java.util.Locale;
+
+import javax.naming.InitialContext;
+
+import org.jboss.logging.Logger;
+import org.jboss.portal.common.util.Tools;
+import org.jboss.portal.core.identity.services.IdentityConstants;
+import org.jboss.portal.core.identity.services.IdentityMailService;
+import org.jboss.portal.identity.User;
+import org.jboss.portal.identity.UserModule;
+import org.jboss.portal.identity.UserProfileModule;
+import org.jbpm.graph.def.ActionHandler;
+import org.jbpm.graph.exe.ExecutionContext;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class SendValidationMailAction implements ActionHandler
+{
+ /** . */
+ private UserModule userModule;
+
+ /** . */
+ private UserProfileModule userProfileModule;
+
+ /** . */
+ private IdentityMailService identityMailService;
+
+ /** . */
+ private static Logger log = Logger.getLogger(SendValidationMailAction.class);
+
+ public void execute(ExecutionContext ectx) throws Exception
+ {
+ HashMap emailMap = new HashMap();
+ String hash = this.hashGen();
+
+ String action = (String) ectx.getContextInstance().getVariable(IdentityConstants.ACTION);
+ String email = (String) ectx.getContextInstance().getVariable(IdentityConstants.VARIABLE_EMAIL);
+ Locale locale = (Locale) ectx.getContextInstance().getVariable(IdentityConstants.VARIABLE_LOCALE);
+
+ if ( locale == null)
+ {
+ locale = new Locale(IdentityConstants.DEFAULT_LOCALE);
+ }
+
+ UserContainer uc = (UserContainer) ectx.getContextInstance().getVariable(IdentityConstants.VARIABLE_USER);
+
+ // Register new user
+ if (IdentityConstants.ACTION_REGISTER_USER.equals(action))
+ {
+ emailMap.put("to", email);
+ emailMap.put("username", uc.getUsername());
+ emailMap.put("password", uc.getPassword());
+ }
+ // Change email
+ else if (IdentityConstants.ACTION_CHANGE_EMAIL.equals(action))
+ {
+ User user = this.getUserModule().findUserByUserName(uc.getUsername());
+ emailMap.put("to", (String) this.getUserProfileModule().getProperty(user, User.INFO_USER_EMAIL_REAL));
+ }
+ else
+ {
+ throw new RuntimeException("wrong Action");
+ }
+
+ ectx.getContextInstance().setVariable(IdentityConstants.VALIDATION_HASH, hash);
+ // TODO - build url
+ String activationLink = "validateEmail/" + ectx.getProcessInstance().getId() + "/" + hash;
+ emailMap.put("activationLink", activationLink);
+
+ this.getIdentityMailService().sendMail(action, emailMap, locale);
+ }
+
+ // generating a random hash
+ private String hashGen()
+ {
+ try
+ {
+ SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG");
+
+ byte[] bytes = new byte[512];
+ secureRandom.nextBytes(bytes);
+
+ double rand = secureRandom.nextDouble();
+ long time = System.currentTimeMillis();
+ String salt = IdentityConstants.HASH_SALT;
+
+ StringBuffer buffer = new StringBuffer();
+ buffer.append(rand);
+ buffer.append(salt);
+ buffer.append(time);
+
+ return Tools.md5AsHexString(buffer.toString());
+ }
+ catch (NoSuchAlgorithmException e)
+ {
+ log.error("No Such Algorithm exists " + e);
+ }
+ return null;
+ }
+
+ private IdentityMailService getIdentityMailService()
+ {
+ if (identityMailService == null)
+ {
+ try
+ {
+ this.identityMailService = (IdentityMailService) new InitialContext().lookup("java:/portal/IdentityMailService");
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+ return identityMailService;
+ }
+
+ private UserModule getUserModule()
+ {
+ if (userModule == null)
+ {
+ try
+ {
+ this.userModule = (UserModule) new InitialContext().lookup("java:/portal/UserModule");
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+ return userModule;
+ }
+
+ private UserProfileModule getUserProfileModule()
+ {
+ if (userProfileModule == null)
+ {
+ try
+ {
+ this.userProfileModule = (UserProfileModule) new InitialContext().lookup("java:/portal/UserProfileModule");
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+ return userProfileModule;
+ }
+
+}
Added: trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/UserContainer.java
===================================================================
--- trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/UserContainer.java (rev 0)
+++ trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/UserContainer.java 2007-08-27 19:20:51 UTC (rev 8051)
@@ -0,0 +1,132 @@
+/******************************************************************************
+ * 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.services.workflow;
+
+import java.io.Serializable;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import org.jboss.portal.identity.User;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class UserContainer implements Serializable
+{
+
+ private String processId;
+
+ private String username;
+
+ private String password;
+
+ private Map profileMap;
+
+ private List roles;
+
+ private String currentNode;
+
+ public UserContainer(User user)
+ {
+ this.username = user.getUserName();
+ }
+
+ public UserContainer(String username, String password, Map profileMap, List roles)
+ {
+ this.username = username;
+ this.password = password;
+ this.profileMap = profileMap;
+ this.roles = roles;
+ }
+
+ public String getUsername()
+ {
+ return username;
+ }
+
+ public void setUsername(String username)
+ {
+ this.username = username;
+ }
+
+ public String getPassword()
+ {
+ return password;
+ }
+
+ public void setPassword(String password)
+ {
+ this.password = password;
+ }
+
+ public String getProcessId()
+ {
+ return processId;
+ }
+
+ public void setProcessId(String processId)
+ {
+ this.processId = processId;
+ }
+
+ public Map getProfileMap()
+ {
+ return profileMap;
+ }
+
+ public void setProfileMap(Map profileMap)
+ {
+ this.profileMap = profileMap;
+ }
+
+ public List getRoles()
+ {
+ return roles;
+ }
+
+ public void setRoles(List roles)
+ {
+ this.roles = roles;
+ }
+
+ public String getCurrentNode()
+ {
+ return currentNode;
+ }
+
+ public void setCurrentNode(String currentNode)
+ {
+ this.currentNode = currentNode;
+ }
+
+ public String getEmail()
+ {
+ return (String) this.profileMap.get(User.INFO_USER_EMAIL_REAL);
+ }
+
+ public String getRegistrationDate(){
+ return (String) this.profileMap.get(User.INFO_USER_REGISTRATION_DATE);
+ }
+}
Added: trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/ValidateEmailService.java
===================================================================
--- trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/ValidateEmailService.java (rev 0)
+++ trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/ValidateEmailService.java 2007-08-27 19:20:51 UTC (rev 8051)
@@ -0,0 +1,40 @@
+/******************************************************************************
+ * 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.services.workflow;
+
+import java.util.Locale;
+
+import org.jboss.portal.identity.User;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public interface ValidateEmailService
+{
+
+ boolean validateEmail(String processId, String registrationHash);
+
+ String changeEmail(User user, String email, Locale locale);
+}
+
Added: trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/ValidateEmailServiceImpl.java
===================================================================
--- trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/ValidateEmailServiceImpl.java (rev 0)
+++ trunk/core-identity/src/main/org/jboss/portal/core/identity/services/workflow/ValidateEmailServiceImpl.java 2007-08-27 19:20:51 UTC (rev 8051)
@@ -0,0 +1,234 @@
+/******************************************************************************
+ * 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.services.workflow;
+
+import java.io.InputStream;
+import java.util.Locale;
+
+import org.jboss.logging.Logger;
+import org.jboss.portal.common.io.IOTools;
+import org.jboss.portal.core.identity.services.IdentityConstants;
+import org.jboss.portal.identity.User;
+import org.jboss.portal.jems.as.JNDI;
+import org.jboss.portal.jems.as.system.AbstractJBossService;
+import org.jboss.portal.workflow.service.WorkflowService;
+import org.jbpm.JbpmContext;
+import org.jbpm.graph.def.Node;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.graph.exe.ProcessInstance;
+import org.jbpm.graph.exe.Token;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class ValidateEmailServiceImpl extends AbstractJBossService implements ValidateEmailService
+{
+ private static final Logger log = Logger.getLogger(ValidateEmailService.class);
+
+ private WorkflowService workflowService = null;
+
+ private String processName = "jbp_identity_validate_email";
+
+ private String processFile = "conf/processes/" + processName + ".xml";
+
+ private boolean overwrite = false;
+
+ private JNDI.Binding jndiBinding;
+
+ private String jndiName = null;
+
+ public void startService() throws Exception
+ {
+ super.startService();
+
+ if (this.jndiName != null)
+ {
+ jndiBinding = new JNDI.Binding(jndiName, this);
+ jndiBinding.bind();
+ }
+
+ InputStream is = null;
+ JbpmContext jbpmContext = null;
+ try
+ {
+ jbpmContext = this.workflowService.getJbpmConfiguration().createJbpmContext();
+
+ ProcessDefinition processDefinition = jbpmContext.getGraphSession().findLatestProcessDefinition(
+ this.processName);
+ if (processDefinition == null)
+ {
+ processDefinition = ProcessDefinition.parseXmlResource(processFile);
+ jbpmContext.deployProcessDefinition(processDefinition);
+ }
+ else
+ {
+ // A process definition already exists....should deploy a new version
+ // of the definition if overwrite is true
+ ProcessDefinition fromConfig = ProcessDefinition.parseXmlResource(processFile);
+ if (this.overwrite)
+ {
+ // If the two of them are not same, create a new version
+ // of this process definition
+ jbpmContext.deployProcessDefinition(fromConfig);
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ //
+ this.stopService();
+
+ //
+ throw e;
+ }
+ finally
+ {
+ IOTools.safeClose(is);
+ IOTools.safeClose(jbpmContext);
+ }
+ }
+
+ public void stopService() throws Exception
+ {
+ super.stopService();
+
+ if (jndiBinding != null)
+ {
+ jndiBinding.unbind();
+ jndiBinding = null;
+ }
+ }
+
+ /** @return */
+ public WorkflowService getWorkflowService()
+ {
+ return this.workflowService;
+ }
+
+ /** @param workflowService */
+ public void setWorkflowService(WorkflowService workflowService)
+ {
+ this.workflowService = workflowService;
+ }
+
+ /** @return */
+ public String getJNDIName()
+ {
+ return this.jndiName;
+ }
+
+ /** @param jndiName */
+ public void setJNDIName(String jndiName)
+ {
+ this.jndiName = jndiName;
+ }
+
+ /*
+ * Create new changeEmail request
+ */
+ public String changeEmail(User user, String email, Locale locale)
+ {
+ JbpmContext jbpmContext = null;
+ ProcessInstance processInstance = null;
+ // String registrationHash = this.hashGen(); - generated when sending email
+ boolean success = false;
+ try
+ {
+ jbpmContext = this.workflowService.getJbpmConfiguration().createJbpmContext();
+ processInstance = jbpmContext.newProcessInstance(this.processName);
+ Token token = processInstance.getRootToken();
+
+ processInstance.getContextInstance().setVariable(IdentityConstants.VARIABLE_USER, new UserContainer(user));
+ processInstance.getContextInstance().setVariable(IdentityConstants.VARIABLE_EMAIL, email);
+ processInstance.getContextInstance().setVariable(IdentityConstants.VARIABLE_LOCALE, locale);
+ processInstance.getContextInstance().setVariable(IdentityConstants.ACTION, IdentityConstants.ACTION_CHANGE_EMAIL);
+
+ token.signal();
+ success = true;
+ }
+ catch (Exception e)
+ {
+ success = false;
+ log.error("Exception in Workflow", e);
+ // throw new WorkflowException(e);
+ }
+ finally
+ {
+ if (processInstance != null && success)
+ {
+ jbpmContext.save(processInstance);
+ }
+ IOTools.safeClose(jbpmContext);
+ }
+ // TODO
+ return IdentityConstants.REGISTRATION_PENDING;
+ }
+
+ public boolean validateEmail(String id, String registrationHash)
+ {
+ JbpmContext jbpmContext = null;
+ boolean success = false;
+ try
+ {
+ long processId = Long.valueOf(id).longValue();
+ jbpmContext = this.workflowService.getJbpmConfiguration().createJbpmContext();
+ ProcessInstance processInstance = jbpmContext.getProcessInstance(processId);
+
+ if (processInstance != null)
+ {
+ Node n = processInstance.getRootToken().getNode();
+ if (n.getName().equals("validate_email"))
+ {
+ String hash = (String) processInstance.getContextInstance().getVariable(IdentityConstants.VALIDATION_HASH);
+ if (registrationHash.equals(hash) && !processInstance.hasEnded())
+ {
+ Token token = processInstance.getRootToken();
+ String action = (String) processInstance.getContextInstance().getVariable(IdentityConstants.ACTION);
+ // Processing email change request to transition changeEmail
+ if(IdentityConstants.ACTION_CHANGE_EMAIL.equals(action))
+ {
+ token.signal("changeEmail");
+ }
+ // Processing other requests to end state with ok
+ else
+ {
+ token.signal("ok");
+ }
+ success = true;
+ }
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ log.error("", e);
+ }
+ finally
+ {
+ IOTools.safeClose(jbpmContext);
+ }
+ return success;
+ }
+}
+
Property changes on: trunk/core-identity/src/main/org/jboss/portal/core/identity/ui
___________________________________________________________________
Name: svn:ignore
- faces
+ faces
register
Deleted: trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/IdentityConstants.java
===================================================================
--- trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/IdentityConstants.java 2007-08-27 19:09:00 UTC (rev 8050)
+++ trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/IdentityConstants.java 2007-08-27 19:20:51 UTC (rev 8051)
@@ -1,49 +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.core.identity.ui;
-
-/**
- * @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class IdentityConstants
-{
- public static final String HASH_SALT = "fuDrupRunEP2BRuspADr";
-
- public static final String SUBSCRIPTIONMODE = "subscriptionMode";
- public static final String SUBSCRIPTIONMODE_AUTOMATIC = "automatic";
- public static final String SUBSCRIPTIONMODE_EMAILVERIFICATION = "emailVerification";
-
- public static final String VERIFICATION_ACTION = "validateEmail";
- public static final String VERIFICATION_ACTION_REGISTER = "register";
- public static final String VERIFICATION_ACTION_UPDATE_EMAIL = "update";
- public static final String VERIFICATION_ACTION_DELETE_USER = "delete";
-
- public static final String TEMPLATE_REGISTER_USER = "register";
- public static final String TEMPLATE_CHANGE_EMAIL = "changeEmail";
- public static final String TEMPLATE_LOST_PASSWORD = "lostPassword";
-
- public static final String USER_PROFILE_GENERATED_HASH = "org.jboss.portal.core.identity.validation_hash";
- public static final String USER_PROFILE_NEW_EMAIL_ADDRESS = "org.jboss.portal.core.identity.new_email";
-}
-
Modified: trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/CreateUserAction.java
===================================================================
--- trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/CreateUserAction.java 2007-08-27 19:09:00 UTC (rev 8050)
+++ trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/CreateUserAction.java 2007-08-27 19:20:51 UTC (rev 8051)
@@ -22,26 +22,20 @@
******************************************************************************/
package org.jboss.portal.core.identity.ui.actions;
-import java.awt.image.BufferedImage;
-import java.security.NoSuchAlgorithmException;
-import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.Date;
-import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
+
import javax.faces.application.FacesMessage;
-import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import org.jboss.logging.Logger;
-import org.jboss.portal.core.identity.services.captcha.JCaptchaService;
-import org.jboss.portal.core.identity.ui.IdentityConstants;
+import org.jboss.portal.core.identity.services.workflow.RegistrationService;
import org.jboss.portal.core.identity.ui.IdentityUIUser;
import org.jboss.portal.core.identity.ui.common.IdentityUserBean;
-import org.jboss.portal.core.identity.ui.common.SendMailBean;
import org.jboss.portal.identity.User;
/**
@@ -52,23 +46,17 @@
{
/** . */
- private User user;
-
- /** . */
private List roles = new ArrayList();
/** . */
private IdentityUIUser uiUser = new IdentityUIUser();
/** . */
- private IdentityUserBean identityUserBean;
-
+ private RegistrationService registrationService;
+
/** . */
- private SendMailBean sendMailBean;
+ private IdentityUserBean identityUserBean;
- /** .*/
- private String subscriptionMode;
-
/** . */
private static final Logger log = Logger.getLogger(CreateUserAction.class);
@@ -82,19 +70,19 @@
this.uiUser = uiUser;
}
- public IdentityUserBean getIdentityUserBean()
+ public List getRoles()
{
- return identityUserBean;
+ return roles;
}
- public String getSubscriptionMode()
+ public void setRoles(List roles)
{
- return subscriptionMode;
+ this.roles = roles;
}
- public void setSubscriptionMode(String subscriptionMode)
+ public IdentityUserBean getIdentityUserBean()
{
- this.subscriptionMode = subscriptionMode;
+ return identityUserBean;
}
public void setIdentityUserBean(IdentityUserBean identityUserBean)
@@ -102,26 +90,16 @@
this.identityUserBean = identityUserBean;
}
- public List getRoles()
+ public RegistrationService getRegistrationService()
{
- return roles;
+ return registrationService;
}
- public void setRoles(List roles)
+ public void setRegistrationService(RegistrationService registrationService)
{
- this.roles = roles;
+ this.registrationService = registrationService;
}
- public SendMailBean getSendMailBean()
- {
- return sendMailBean;
- }
-
- public void setSendMailBean(SendMailBean sendMailBean)
- {
- this.sendMailBean = sendMailBean;
- }
-
public String register()
{
if (uiUser.getUsername() != null && uiUser.getPassword() != null)
@@ -131,11 +109,7 @@
try
{
Class registrationDateClass = uiUser.getAttribute().getType("registrationdate");
-
- // Create user && assign roles
- user = identityUserBean.createUser(uiUser.getUsername(), uiUser.getPassword(), this.roles);
-
- //
+
if (registrationDateClass.equals(Date.class))
{
uiUser.getAttribute().setValue("registrationdate", new Date());
@@ -149,44 +123,17 @@
log.warn(User.INFO_USER_REGISTRATION_DATE + " property is mapped in not supported type: "
+ registrationDateClass.toString());
}
+
+ // Variables for RegisterService
+ String wUsername = uiUser.getUsername();
+ String wPassword = uiUser.getPassword();
+ List wRoles = roles;
+ Map wProfileMap = this.identityUserBean.getProfileMap(uiUser.getAttribute().getProfileAttributes());
+ Locale wLocale = FacesContext.getCurrentInstance().getViewRoot().getLocale();
+
+ String registrationStatus = this.registrationService.registerUser(wUsername, wPassword, wProfileMap, wRoles, wLocale);
+ log.debug(registrationStatus);
- if (subscriptionMode != null
- && subscriptionMode.equals(IdentityConstants.SUBSCRIPTIONMODE_EMAILVERIFICATION))
- {
- Map mailMap = new HashMap();
- String hash = identityUserBean.hashGen();
-
- // Disable User
- uiUser.getAttribute().setValue("enabled", Boolean.FALSE);
-
- // TODO Store Hash
- // identityUserBean.setPropertyHash(user, hash);
-
- // TODO change IdentityCommandFactory
- String link = "http://localhost:8080/portal/";
- link += IdentityConstants.VERIFICATION_ACTION + "/";
- link += IdentityConstants.VERIFICATION_ACTION_REGISTER + "/";
- link += uiUser.getUsername() + "/";
- link += hash + "/";
- link += "default/default/wizardWindow_33";
-
- mailMap.put("to", (String) uiUser.getAttribute().getValue("email").getObject());
- mailMap.put("username", uiUser.getUsername());
- mailMap.put("password", uiUser.getPassword());
- mailMap.put("activationLink", link);
-
- // Sending verification mail
- this.sendMailBean.sendMail("register", mailMap);
-
- }
- else
- {
- uiUser.getAttribute().setValue("enabled", Boolean.TRUE);
- }
-
- // Adding dynamically set properties
- identityUserBean.updateProfile(user, uiUser.getAttribute().getProfileAttributes());
-
}
catch (Exception e)
{
@@ -199,9 +146,9 @@
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Missing required values."));
}
- // Clean up
-
- this.user = null;
+ /*
+ * Cleaning up
+ */
this.uiUser = new IdentityUIUser();
return "success";
Modified: trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/EditProfileAction.java
===================================================================
--- trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/EditProfileAction.java 2007-08-27 19:09:00 UTC (rev 8050)
+++ trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/EditProfileAction.java 2007-08-27 19:20:51 UTC (rev 8051)
@@ -22,7 +22,6 @@
******************************************************************************/
package org.jboss.portal.core.identity.ui.actions;
-import java.util.HashMap;
import java.util.Map;
import javax.faces.application.FacesMessage;
@@ -30,10 +29,9 @@
import javax.faces.context.FacesContext;
import org.jboss.logging.Logger;
-import org.jboss.portal.core.identity.ui.IdentityConstants;
+import org.jboss.portal.core.identity.services.workflow.ValidateEmailService;
import org.jboss.portal.core.identity.ui.IdentityUIUser;
import org.jboss.portal.core.identity.ui.common.IdentityUserBean;
-import org.jboss.portal.core.identity.ui.common.SendMailBean;
import org.jboss.portal.identity.IdentityException;
import org.jboss.portal.identity.User;
@@ -58,9 +56,10 @@
/** . */
private IdentityUserBean identityUserBean;
- /** . */
- private SendMailBean sendMailBean;
+ /** . */
+ private ValidateEmailService validateEmailService;
+ /** . */
private static final Logger log = Logger.getLogger(EditProfileAction.class);
public EditProfileAction()
@@ -125,14 +124,14 @@
this.email = email;
}
- public SendMailBean getSendMailBean()
+ public ValidateEmailService getValidateEmailService()
{
- return sendMailBean;
+ return validateEmailService;
}
- public void setSendMailBean(SendMailBean sendMailBean)
+ public void setValidateEmailService(ValidateEmailService validateEmailService)
{
- this.sendMailBean = sendMailBean;
+ this.validateEmailService = validateEmailService;
}
public String editProfile()
@@ -205,45 +204,16 @@
public String changeEmail()
{
- String subscriptionMode = FacesContext.getCurrentInstance().getExternalContext().getInitParameter(
- IdentityConstants.SUBSCRIPTIONMODE);
-
if (this.email != null)
{
try
{
User user = this.identityUserBean.findUserByUserName(this.currentUser);
- if (subscriptionMode != null
- && subscriptionMode.equals(IdentityConstants.SUBSCRIPTIONMODE_EMAILVERIFICATION))
- {
- Map mailMap = new HashMap();
- String hash = identityUserBean.hashGen();
- this.identityUserBean.setPropertyHash(user, hash);
- this.identityUserBean.setPropertyNewEmail(user, email);
-
- // Generate URL
- String link = "http://localhost:8080/portal/";
- link += IdentityConstants.VERIFICATION_ACTION + "/";
- link += IdentityConstants.VERIFICATION_ACTION_UPDATE_EMAIL+ "/";
- link += uiUser.getUsername() + "/";
- link += hash + "/";
- link += "default/default/wizardWindow_33";
-
- // TODO - get right Values
- mailMap.put("subject", "Confirm Email Change");
- mailMap.put("to", email); //(String) uiUser.getAttribute().getValue("email").getObject());
- mailMap.put("from", "emuckenh(a)redhat.com");
- mailMap.put("emailDomain", "JBoss.org");
- mailMap.put("activationLink", link);
-
- this.sendMailBean.sendMail("changeEmail", mailMap);
- }
- else
- {
- HashMap profileMap = new HashMap();
- profileMap.put("email", email);
- this.identityUserBean.updateProfile(user, profileMap);
- }
+
+ // TODO status page
+ // TODO locale
+ String validationStatus = this.validateEmailService.changeEmail(user, email, null);
+ log.debug(validationStatus);
}
catch (Exception e)
{
Modified: trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/LostPasswordAction.java
===================================================================
--- trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/LostPasswordAction.java 2007-08-27 19:09:00 UTC (rev 8050)
+++ trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/LostPasswordAction.java 2007-08-27 19:20:51 UTC (rev 8051)
@@ -25,20 +25,17 @@
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.util.HashMap;
+import java.util.Locale;
import java.util.Map;
import javax.faces.application.FacesMessage;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
import org.jboss.logging.Logger;
+import org.jboss.portal.core.identity.services.IdentityMailService;
import org.jboss.portal.core.identity.ui.IdentityUIUser;
import org.jboss.portal.core.identity.ui.common.IdentityUserBean;
-import org.jboss.portal.core.identity.ui.common.SendMailBean;
import org.jboss.portal.identity.NoSuchUserException;
import org.jboss.portal.identity.User;
@@ -61,22 +58,11 @@
private IdentityUserBean identityUserBean;
/** . */
- private SendMailBean sendMailBean;
+ private IdentityMailService identityMailService;
/** . */
- private Session session;
-
- /** . */
private static final Logger log = Logger.getLogger(LostPasswordAction.class);
- /**
- public LostPasswordAction()
- {
- SessionFactory sessionFactory = (SessionFactory) new InitialContext()
- .lookup("java:/portal/IdentitySessionFactory");
- session = sessionFactory.getCurrentSession();
- } */
-
public String getUsername()
{
return username;
@@ -107,14 +93,14 @@
this.identityUserBean = identityUserBean;
}
- public SendMailBean getSendMailBean()
+ public IdentityMailService getIdentityMailService()
{
- return sendMailBean;
+ return identityMailService;
}
- public void setSendMailBean(SendMailBean sendMailBean)
+ public void setIdentityMailService(IdentityMailService identityMailService)
{
- this.sendMailBean = sendMailBean;
+ this.identityMailService = identityMailService;
}
public String getPasswordCharacters()
@@ -184,7 +170,8 @@
{
// TODO enable update Password
// identityUserBean.updatePassword(user.getUserName(), newPassword);
- sendMailBean.sendMail("lostPassword", mailMap);
+ // TODO set Locale
+ identityMailService.sendMail("lostPassword", mailMap, new Locale("en"));
}
catch (Exception e)
{
Modified: trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/admin/RoleManagementBean.java
===================================================================
--- trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/admin/RoleManagementBean.java 2007-08-27 19:09:00 UTC (rev 8050)
+++ trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/admin/RoleManagementBean.java 2007-08-27 19:20:51 UTC (rev 8051)
@@ -168,7 +168,8 @@
try
{
int offset = page > 0 ? ((page -1 ) * limit) : 0;
- members = identityRoleBean.getMembershipModule().findRoleMembers(this.currentRole, offset, limit, userNameFilter);
+ int limit1 = limit + 1;
+ members = identityRoleBean.getMembershipModule().findRoleMembers(this.currentRole, offset, limit1, userNameFilter);
}
catch (Exception e)
{
@@ -228,4 +229,16 @@
}
return "roleAdmin";
}
+
+ public String nextPage()
+ {
+ this.page++;
+ return "viewMembers";
+ }
+
+ public String prevPage()
+ {
+ this.page--;
+ return "viewMembers";
+ }
}
\ No newline at end of file
Modified: trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/admin/UserAdministrationBean.java
===================================================================
--- trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/admin/UserAdministrationBean.java 2007-08-27 19:09:00 UTC (rev 8050)
+++ trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/admin/UserAdministrationBean.java 2007-08-27 19:20:51 UTC (rev 8051)
@@ -34,6 +34,7 @@
import javax.faces.model.ListDataModel;
import org.jboss.logging.Logger;
+import org.jboss.portal.core.identity.services.workflow.RegistrationService;
import org.jboss.portal.core.identity.ui.IdentityUIUser;
import org.jboss.portal.core.identity.ui.common.IdentityRoleBean;
import org.jboss.portal.core.identity.ui.common.IdentityUserBean;
@@ -77,6 +78,9 @@
/** . */
private IdentityRoleBean identityRoleBean;
+
+ /** . */
+ private RegistrationService registrationService;
/** . */
private static final Logger log = Logger.getLogger(UserAdministrationBean.class);
@@ -161,6 +165,16 @@
this.identityRoleBean = identityRoleBean;
}
+ public RegistrationService getRegistrationService()
+ {
+ return registrationService;
+ }
+
+ public void setRegistrationService(RegistrationService registrationService)
+ {
+ this.registrationService = registrationService;
+ }
+
public String searchUsers()
{
if (this.searchString != null)
@@ -168,7 +182,8 @@
try
{
int offset = page > 0 ? ((page - 1) * limit) : 0;
- this.userList = new ListDataModel(identityUserBean.findUsersFilteredByUserName(searchString, offset, limit));
+ int limit1 = limit + 1;
+ this.userList = new ListDataModel(identityUserBean.findUsersFilteredByUserName(searchString, offset, limit1));
}
catch (IllegalArgumentException e)
{
@@ -228,6 +243,14 @@
}
return "userAdmin";
}
+
+ public List getPendingUsers()
+ {
+ List list = new ArrayList();
+ if ( this.registrationService != null)
+ list = this.registrationService.getPendingUsers();
+ return list;
+ }
public String deleteUser()
{
@@ -249,6 +272,7 @@
{
User user = identityUserBean.findUserByUserName(this.uiUser.getUsername());
identityUserBean.getUserModule().removeUser(user.getId());
+ return this.searchUsers();
}
catch (Exception e)
{
@@ -256,5 +280,39 @@
}
return "userAdmin";
}
+
+ public String nextPage()
+ {
+ this.page++;
+ this.searchUsers();
+ return "userAdmin";
+ }
+
+ public String prevPage()
+ {
+ this.page--;
+ this.searchUsers();
+ return "userAdmin";
+ }
+
+ public String approveRegistration()
+ {
+ ExternalContext ectx = FacesContext.getCurrentInstance().getExternalContext();
+ Map params = ectx.getRequestParameterMap();
+ String processId = (String) params.get("processId");
+ String action = (String) params.get("action");
+ if (processId != null && action != null)
+ {
+ if (action.equals("approve"))
+ {
+ this.registrationService.approve(processId, true);
+ }
+ else if (action.equals("reject"))
+ {
+ this.registrationService.approve(processId, false);
+ }
+ }
+ return "pendingUsers";
+ }
}
Modified: trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/common/IdentityUserBean.java
===================================================================
--- trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/common/IdentityUserBean.java 2007-08-27 19:09:00 UTC (rev 8050)
+++ trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/common/IdentityUserBean.java 2007-08-27 19:20:51 UTC (rev 8051)
@@ -22,26 +22,19 @@
******************************************************************************/
package org.jboss.portal.core.identity.ui.common;
-import java.security.NoSuchAlgorithmException;
-import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import org.jboss.logging.Logger;
-import org.jboss.portal.common.util.Tools;
-import org.jboss.portal.core.identity.ui.IdentityConstants;
import org.jboss.portal.core.identity.ui.IdentityUIUser;
import org.jboss.portal.core.identity.ui.UIAttribute;
-import org.jboss.portal.core.identity.ui.UIRole;
import org.jboss.portal.identity.IdentityException;
-import org.jboss.portal.identity.MembershipModule;
import org.jboss.portal.identity.NoSuchUserException;
-import org.jboss.portal.identity.Role;
-import org.jboss.portal.identity.RoleModule;
import org.jboss.portal.identity.User;
import org.jboss.portal.identity.UserModule;
import org.jboss.portal.identity.UserProfileModule;
@@ -60,9 +53,6 @@
private UserProfileModule userProfileModule;
/** . */
- private IdentityRoleBean identityRoleBean;
-
- /** . */
private MetaDataServiceBean metaDataService;
/** . */
@@ -98,46 +88,45 @@
this.metaDataService = metaDataService;
}
- public IdentityRoleBean getIdentityRoleBean()
+ /*
+ * converts the dynamic attribute Map to a map concerning the identity service - UserProfileModule
+ */
+ public Map getProfileMap(Map attributeMap)
{
- return identityRoleBean;
+ Map profileMap = new HashMap();
+ Set attributeSet = attributeMap.keySet();
+ Iterator i = attributeSet.iterator();
+
+ while(i.hasNext())
+ {
+ String key = (String) i.next();
+ Object value = attributeMap.get(key);
+ UIAttribute uiAttribute = (UIAttribute) this.metaDataService.getValue(key).getObject();
+ if ( uiAttribute != null)
+ {
+ profileMap.put(uiAttribute.getIdentifier(), value);
+ }
+ }
+ return profileMap;
}
-
- public void setIdentityRoleBean(IdentityRoleBean identityRoleBean)
+
+ public void updateProfile(User user, Map attributeMap)
{
- this.identityRoleBean = identityRoleBean;
- }
-
- public User createUser(String username, String password, List roles) throws RuntimeException, IdentityException
- {
- // Create user
- User user = userModule.createUser(username, password);
- // Set membership
- identityRoleBean.assignRoles(user, roles);
- return user;
- }
-
- public void updateProfile(User user, HashMap profileMap)
- {
- Set profileSet = profileMap.keySet();
- Iterator i = profileSet.iterator();
-
- while (i.hasNext())
+ Map profileMap = this.getProfileMap(attributeMap);
+ Iterator i = profileMap.keySet().iterator();
+
+ while(i.hasNext())
{
String key = (String) i.next();
Object value = profileMap.get(key);
- UIAttribute uiAttribute = (UIAttribute) this.metaDataService.getValue(key).getObject();
- if (uiAttribute != null)
+ try
{
- try
- {
- userProfileModule.setProperty(user, uiAttribute.getIdentifier(), value);
- }
- catch (IdentityException e)
- {
- e.printStackTrace();
- }
+ this.userProfileModule.setProperty(user, key, value);
}
+ catch (Exception e)
+ {
+ log.error("updateProfile failed", e);
+ }
}
}
@@ -184,43 +173,4 @@
UIAttribute uiAttribute = (UIAttribute) this.metaDataService.getValue(propertyName).getObject();
return this.userProfileModule.getProperty(user, uiAttribute.getIdentifier());
}
-
-
- // Used to save the hash into the properties of the user
- public void setPropertyHash(User user, String hash) throws IllegalArgumentException, IdentityException
- {
- this.userProfileModule.setProperty(user, IdentityConstants.USER_PROFILE_GENERATED_HASH, hash);
- }
-
- // Stores the new email address until it is validated
- public void setPropertyNewEmail(User user, String email) throws IllegalArgumentException, IdentityException
- {
- this.userProfileModule.setProperty(user, IdentityConstants.USER_PROFILE_NEW_EMAIL_ADDRESS, email);
- }
-
- // generating a random hash
- public String hashGen() {
- try {
- SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG");
-
- byte[] bytes = new byte[512];
- secureRandom.nextBytes(bytes);
-
- double rand = secureRandom.nextDouble();
- long time = System.currentTimeMillis();
- String salt = IdentityConstants.HASH_SALT;
-
- StringBuffer buffer = new StringBuffer();
- buffer.append(rand);
- buffer.append(salt);
- buffer.append(time);
-
-
- return Tools.md5AsHexString(buffer.toString());
- } catch (NoSuchAlgorithmException e)
- {
- log.error("No Such Algorithm exists " + e);
- }
- return null;
- }
}
Modified: trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/common/MetaDataServiceBean.java
===================================================================
--- trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/common/MetaDataServiceBean.java 2007-08-27 19:09:00 UTC (rev 8050)
+++ trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/common/MetaDataServiceBean.java 2007-08-27 19:20:51 UTC (rev 8051)
@@ -23,10 +23,8 @@
package org.jboss.portal.core.identity.ui.common;
import java.util.HashMap;
-import java.util.Set;
import org.jboss.portal.common.p3p.P3PConstants;
-import org.jboss.portal.core.identity.ui.IdentityConstants;
import org.jboss.portal.core.identity.ui.UIAttribute;
import org.jboss.portal.faces.el.PropertyValue;
import org.jboss.portal.faces.el.dynamic.DynamicBean;
@@ -48,10 +46,6 @@
uiEmail.setValidator("EmailValidator");
uiEmail.setRequired(true);
- // Required
- UIAttribute uiHash = new UIAttribute(IdentityConstants.USER_PROFILE_GENERATED_HASH, "org_jboss_identity_hash");
- UIAttribute uiNewEmail = new UIAttribute(IdentityConstants.USER_PROFILE_NEW_EMAIL_ADDRESS, "org_jboss_identity_new_email");
-
UIAttribute uiGivenName = new UIAttribute(P3PConstants.INFO_USER_NAME_GIVEN, "givenname");
UIAttribute uiFamilyName = new UIAttribute(P3PConstants.INFO_USER_NAME_FAMILY, "familyname");
UIAttribute uiSkype = new UIAttribute(User.INFO_USER_IM_SKYPE, "skype");
@@ -76,8 +70,6 @@
UIAttribute uiEnabled = new UIAttribute(User.INFO_USER_ENABLED, "enabled");
this.addToMap(uiEmail);
- this.addToMap(uiHash);
- this.addToMap(uiNewEmail);
this.addToMap(uiGivenName);
this.addToMap(uiFamilyName);
Deleted: trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/common/SendMailBean.java
===================================================================
--- trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/common/SendMailBean.java 2007-08-27 19:09:00 UTC (rev 8050)
+++ trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/common/SendMailBean.java 2007-08-27 19:20:51 UTC (rev 8051)
@@ -1,166 +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.core.identity.ui.common;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.StringWriter;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-import java.util.ResourceBundle;
-
-import javax.faces.context.FacesContext;
-
-import org.jboss.logging.Logger;
-import org.jboss.portal.core.identity.ui.IdentityConstants;
-import org.jboss.portal.core.modules.MailModule;
-
-import freemarker.template.Configuration;
-import freemarker.template.Template;
-import freemarker.template.TemplateException;
-
-/**
- * @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class SendMailBean
-{
-
- /** . */
- private Map mailData = new HashMap();
-
- /** . */
- private Locale locale;
-
- /** . */
- private String emailText = null;
-
- /** . */
- private String emailDomain;
-
- /** . */
- private String emailFrom;
-
- /** . */
- private String templateLocation;
-
- /** . */
- private MailModule mailModule;
-
- /** . */
- private static final Logger log = Logger.getLogger(SendMailBean.class);
-
- public String getEmailDomain()
- {
- return emailDomain;
- }
-
- public void setEmailDomain(String emailDomain)
- {
- this.emailDomain = emailDomain;
- }
-
- public String getEmailFrom()
- {
- return emailFrom;
- }
-
- public void setEmailFrom(String emailFrom)
- {
- this.emailFrom = emailFrom;
- }
-
- public MailModule getMailModule()
- {
- return mailModule;
- }
-
- public void setMailModule(MailModule mailModule)
- {
- this.mailModule = mailModule;
- }
-
- public void sendMail(String templateLocation, Map mailData) throws IOException, TemplateException
- {
- this.templateLocation = templateLocation;
- this.mailData = mailData;
- this.locale = FacesContext.getCurrentInstance().getViewRoot().getLocale();
- this.mailData.put("emailDomain", emailDomain);
-
- ResourceBundle bundle = ResourceBundle.getBundle("Identity", locale);
-
- String subject = null;
- String to = (String) mailData.get("to");
-
- if (IdentityConstants.TEMPLATE_REGISTER_USER.equals(templateLocation))
- {
- subject = bundle.getString("IDENTITY_MAIL_SUBJECT_REGISTER");
- } else if (IdentityConstants.TEMPLATE_CHANGE_EMAIL.equals(templateLocation))
- {
- subject = bundle.getString("IDENTITY_MAIL_SUBJECT_CHANGE_EMAIL");
- } else if (IdentityConstants.TEMPLATE_LOST_PASSWORD.equals(templateLocation))
- {
- subject = bundle.getString("IDENTITY_MAIL_SUBJECT_LOST_PASSWORD");
- } else
- {
- throw new IllegalArgumentException("unknown template.");
- }
-
- // Generating message
- this.generateEmailText();
-
- // Sending mail
- // mailModule.send(emailFrom, to , subject, emailText);
- log.debug(this.emailText);
- }
-
- private void generateEmailText() throws IOException, TemplateException
- {
- ClassLoader tcl = Thread.currentThread().getContextClassLoader();
- URL config = tcl.getResource("templates/" + this.templateLocation + "/emailTemplate_" + locale.getLanguage() + "_" + locale.getCountry() + ".tpl");
- if (config == null)
- {
- config = tcl.getResource("templates/" + this.templateLocation + "/emailTemplate_" + locale.getLanguage() + ".tpl");
- }
- if (config == null)
- {
- config = tcl.getResource("templates/" + this.templateLocation + "/emailTemplate.tpl");
- }
- if (config == null)
- {
- throw new FileNotFoundException("Cannot load a suitable emailTemplate.tpl in templates/"
- + this.templateLocation);
- }
- InputStream in = config.openStream();
- Template tpl = new Template("emailTemplate", new InputStreamReader(in), new Configuration());
- StringWriter out = new StringWriter();
- tpl.process(this.mailData, out);
- out.close();
-
- this.emailText = out.toString();
- }
-}
Added: trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/faces/PortletDelegatingPropertyResolver.java
===================================================================
--- trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/faces/PortletDelegatingPropertyResolver.java (rev 0)
+++ trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/faces/PortletDelegatingPropertyResolver.java 2007-08-27 19:20:51 UTC (rev 8051)
@@ -0,0 +1,431 @@
+/******************************************************************************
+ * 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.ui.faces;
+
+import java.lang.reflect.Field;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+
+import javax.faces.el.EvaluationException;
+import javax.faces.el.PropertyNotFoundException;
+import javax.faces.el.PropertyResolver;
+import javax.portlet.PortletPreferences;
+import javax.portlet.ReadOnlyException;
+
+import org.jboss.logging.Logger;
+import org.jboss.portal.common.reflect.Modifier;
+import org.jboss.portal.faces.el.PropertyValue;
+import org.jboss.portal.faces.el.decorator.BeanDecorator;
+import org.jboss.portal.faces.el.dynamic.DynamicBean;
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class PortletDelegatingPropertyResolver extends PropertyResolver
+{
+
+ /** . */
+ private PropertyResolver delegate;
+
+ /** . */
+ private volatile Map decoratorMap = new HashMap();
+
+ /** .*/
+ private static final Logger log = Logger.getLogger(PortletDelegatingPropertyResolver.class);
+
+ public PortletDelegatingPropertyResolver(PropertyResolver delegate)
+ {
+ this.delegate = delegate;
+ }
+
+ public Class getType(Object base, int index) throws EvaluationException, PropertyNotFoundException
+ {
+ if ( base instanceof PortletPreferences)
+ {
+ throw new PropertyNotFoundException("PortletPreferences can not be accessed via an index");
+ } else {
+ return delegate.getType(base, index);
+ }
+ }
+
+ public Class getType(Object base, Object property) throws EvaluationException, PropertyNotFoundException
+ {
+ if (base instanceof PortletPreferences)
+ {
+ return String.class;
+ }
+ else
+ // See if the object can handle itself the property
+ if (base instanceof DynamicBean)
+ {
+ DynamicBean dynamicBean = (DynamicBean)base;
+ Class type = dynamicBean.getType(property);
+ if (type != null)
+ {
+ return type;
+ }
+ }
+
+ //
+ GetTypeBeanAction beanAction = new GetTypeBeanAction(base, property);
+ if (resolveAction(base.getClass(), beanAction))
+ {
+ return beanAction.type;
+ }
+
+ //
+ if (property instanceof String)
+ {
+ try
+ {
+ Field f = base.getClass().getField((String)property);
+ if (Modifier.isReadableProperty(f))
+ {
+ return f.getType();
+ }
+ }
+ catch (NoSuchFieldException ignore)
+ {
+ }
+ }
+
+ //
+ if (delegate != null)
+ {
+ return delegate.getType(base, property);
+ }
+
+ //
+ throw createPNFE(base, property);
+ }
+
+ public Object getValue(Object base, int index) throws EvaluationException, PropertyNotFoundException
+ {
+ if (base instanceof PortletPreferences)
+ {
+ throw new PropertyNotFoundException("PortletPreferences can not be accessed via an index");
+ }
+ else
+ {
+ return delegate.getValue(base, index);
+ }
+ }
+
+ public Object getValue(Object base, Object property) throws EvaluationException, PropertyNotFoundException
+ {
+ if ( base instanceof PortletPreferences)
+ {
+ PortletPreferences preferences = (PortletPreferences) base;
+ return (preferences.getValue((String) property, null));
+ }
+ // See if the object can handle itself the property
+ if (base instanceof DynamicBean)
+ {
+ DynamicBean dynamicBean = (DynamicBean)base;
+ PropertyValue value = dynamicBean.getValue(property);
+ if (value != null)
+ {
+ return value.getObject();
+ }
+ }
+
+ //
+ GetValueBeanAction beanAction = new GetValueBeanAction(base, property);
+ if (resolveAction(base.getClass(), beanAction))
+ {
+ return beanAction.value.getObject();
+ }
+
+
+ //
+ if (property instanceof String)
+ {
+ try
+ {
+ String test = null;
+ if ( base instanceof HashSet)
+ {
+ test = "ok";
+ }
+ Field f = base.getClass().getField((String)property);
+ if (Modifier.isReadableProperty(f))
+ {
+ return f.get(base);
+ }
+ }
+ catch (NoSuchFieldException ignore)
+ {
+ }
+ catch (IllegalAccessException e)
+ {
+ log.error("Was not able to read the field " + property + " of object " + base + " with class " + base.getClass().getName());
+ }
+ }
+
+ //
+ if (delegate != null)
+ {
+ return delegate.getValue(base, property);
+ }
+
+ //
+ throw createPNFE(base, property);
+ }
+
+ public boolean isReadOnly(Object base, int index) throws EvaluationException, PropertyNotFoundException
+ {
+ if( base instanceof PortletPreferences)
+ {
+ throw new PropertyNotFoundException("PortletPreferences can not be accessed via an index");
+ }
+ else
+ {
+ return delegate.isReadOnly(base, index);
+ }
+ }
+
+ public boolean isReadOnly(Object base, Object property) throws EvaluationException, PropertyNotFoundException
+ {
+ if ( base instanceof PortletPreferences)
+ {
+ PortletPreferences preferences = (PortletPreferences) base;
+ return preferences.isReadOnly((String) property);
+ }
+ else
+ {
+ return delegate.isReadOnly(base, property);
+ }
+ }
+
+ public void setValue(Object base, int index, Object value) throws EvaluationException, PropertyNotFoundException
+ {
+ if (base instanceof PortletPreferences)
+ {
+ throw new PropertyNotFoundException("PortletPreferces can not be accessed via an index");
+ }
+ else
+ {
+ delegate.setValue(base, index, value);
+ }
+
+ }
+
+ public void setValue(Object base, Object property, Object value) throws EvaluationException, PropertyNotFoundException
+ {
+ if (base instanceof PortletPreferences)
+ {
+ // TODO handle string array
+ PortletPreferences preferences = (PortletPreferences) base;
+ try
+ {
+ preferences.setValue((String) property, (String) value);
+ }
+ catch (ReadOnlyException e)
+ {
+ log.error("PortletPreference "+ (String) property +" read only", e);
+ }
+ }
+ // See if the object can handle itself the property
+ if (base instanceof DynamicBean)
+ {
+ DynamicBean dynamic = (DynamicBean)base;
+ if (dynamic.setValue(property, value))
+ {
+ return;
+ }
+ }
+
+ //
+ SetValueBeanAction beanAction = new SetValueBeanAction(base, property, value);
+ if (resolveAction(base.getClass(), beanAction))
+ {
+ return;
+ }
+
+ //
+ if (property instanceof String)
+ {
+ try
+ {
+ Field f = base.getClass().getField((String)property);
+ if (Modifier.isWritableProperty(f))
+ {
+ f.set(base, value);
+ return;
+ }
+ }
+ catch (NoSuchFieldException ignore)
+ {
+ }
+ catch (IllegalAccessException e)
+ {
+ log.error("Was not able to write the field " + property + " of object " + base + " with class " + base.getClass().getName());
+ }
+ }
+
+ //
+ if (delegate != null)
+ {
+ delegate.setValue(base, property, value);
+ return;
+ }
+
+ //
+ throw createPNFE(base, property);
+
+ }
+
+ public final synchronized void registerDecorator(Class clazz, BeanDecorator decorator)
+ {
+ if (clazz == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (decorator == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ Map copy = new HashMap(decoratorMap);
+ copy.put(clazz.getName(), decorator);
+ decoratorMap = copy;
+ log.debug("Added bean decorator " + clazz.getName() + " in resolver map");
+ }
+
+ private static interface BeanAction
+ {
+ boolean execute(BeanDecorator decorator);
+ }
+
+ private abstract static class AbstractBeanAction implements BeanAction
+ {
+
+ /** . */
+ protected final Object base;
+
+ /** . */
+ protected final Object property;
+
+ public AbstractBeanAction(Object base, Object property)
+ {
+ this.base = base;
+ this.property = property;
+ }
+ }
+
+ private static class GetTypeBeanAction extends AbstractBeanAction
+ {
+
+ /** . */
+ private Class type;
+
+ public GetTypeBeanAction(Object base, Object property)
+ {
+ super(base, property);
+ }
+
+ public boolean execute(BeanDecorator decorator)
+ {
+ type = decorator.getType(base, property);
+ return type != null;
+ }
+ }
+
+ private static class GetValueBeanAction extends AbstractBeanAction
+ {
+
+ /** . */
+ private PropertyValue value;
+
+ public GetValueBeanAction(Object base, Object property)
+ {
+ super(base, property);
+ }
+
+ public boolean execute(BeanDecorator decorator)
+ {
+ value = decorator.getValue(base, property);
+ return value != null;
+ }
+ }
+
+ private static class SetValueBeanAction extends AbstractBeanAction
+ {
+
+ /** . */
+ private Object value;
+
+ public SetValueBeanAction(Object base, Object property, Object value)
+ {
+ super(base, property);
+ this.value = value;
+ }
+
+ public boolean execute(BeanDecorator decorator)
+ {
+ return decorator.setValue(base, property, value);
+ }
+ }
+
+ private boolean resolveAction(Class clazz, BeanAction action)
+ {
+ BeanDecorator decorator = (BeanDecorator)decoratorMap.get(clazz.getName());
+ if (decorator != null)
+ {
+ if (action.execute(decorator))
+ {
+ return true;
+ }
+ }
+ Class[] itfs = clazz.getInterfaces();
+ for (int i = 0; i < itfs.length; i++)
+ {
+ Class itf = clazz.getInterfaces()[i];
+ if (resolveAction(itf, action))
+ {
+ return true;
+ }
+ }
+ Class superClass = clazz.getSuperclass();
+ if (superClass != null)
+ {
+ if (resolveAction(superClass, action))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ private PropertyNotFoundException createPNFE(Object base, int index)
+ {
+ return createPNFE(base, "[" + index + "]");
+ }
+
+ private PropertyNotFoundException createPNFE(Object base, Object propertyName)
+ {
+ return new PropertyNotFoundException("Property " + propertyName + " on object " + base + " was not found");
+ }
+}
\ No newline at end of file
Added: trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/faces/PortletVariableResolver.java
===================================================================
--- trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/faces/PortletVariableResolver.java (rev 0)
+++ trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/faces/PortletVariableResolver.java 2007-08-27 19:20:51 UTC (rev 8051)
@@ -0,0 +1,117 @@
+/******************************************************************************
+ * 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.ui.faces;
+
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.faces.el.EvaluationException;
+import javax.faces.el.VariableResolver;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletSession;
+
+
+import org.jboss.logging.Logger;
+
+
+/**
+ * @author <a href="mailto:emuckenh@redhat.com">Emanuel Muckenhuber</a>
+ * @version $Revision$
+ */
+public class PortletVariableResolver extends VariableResolver
+{
+ /** . */
+ private VariableResolver delegate;
+
+ /** . */
+ private final static String PORTLET_CONFIG = "portletConfig";
+
+ /** . */
+ private final static String PORTLET_SESSION_SCOPE = "sessionPortletScope";
+
+ /** . */
+ private final static String PORTLET_APPLICATION_SCOPE = "portletApplicationScope";
+
+ /** . */
+ private final static String PORTLET_PREFERENCE_VALUE = "portletPreferenceValue";
+
+ /** . */
+ private final static String PORTLET_PREFERENCE_VALUES = "portletPreferenceValues";
+
+ /** .*/
+ private static final Logger log = Logger.getLogger(PortletVariableResolver.class);
+
+ public PortletVariableResolver(VariableResolver delegate)
+ {
+ this.delegate = delegate;
+ }
+
+ public Object resolveVariable(FacesContext facesContext, String variable) throws EvaluationException
+ {
+ ExternalContext ectx = facesContext.getExternalContext();
+ /**
+ * TODO
+ * portletConfig and test if portletApplicationScope is resolved correctly
+ */
+ if (PORTLET_SESSION_SCOPE.equals(variable))
+ {
+ return ectx.getSessionMap();
+ }
+ else if (PORTLET_APPLICATION_SCOPE.equals(variable))
+ {
+ return ectx.getApplicationMap();
+ }
+ else if (PORTLET_PREFERENCE_VALUE.equals(variable))
+ {
+ return getValueMap(ectx);
+ }
+ else if (PORTLET_PREFERENCE_VALUES.equals(variable))
+ {
+ PortletRequest request = (PortletRequest) ectx.getRequest();
+ return request.getPreferences().getMap();
+ }
+ return delegate.resolveVariable(facesContext, variable);
+ }
+
+ private Map getValueMap(ExternalContext ectx)
+ {
+ Map map = new HashMap();
+ PortletRequest request = (PortletRequest) ectx.getRequest();
+ Enumeration en = request.getPreferences().getNames();
+
+ while (en.hasMoreElements())
+ {
+ String key = (String) en.nextElement();
+ String value = request.getPreferences().getValue(key, null);
+ if (value != null)
+ {
+ map.put(key, value);
+ }
+ }
+ return map;
+ }
+
+}
Modified: trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/CaptchaValidator.java
===================================================================
--- trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/CaptchaValidator.java 2007-08-27 19:09:00 UTC (rev 8050)
+++ trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/CaptchaValidator.java 2007-08-27 19:20:51 UTC (rev 8051)
@@ -42,14 +42,9 @@
Boolean tester = Boolean.FALSE;
PortletRequest portletRequest = (PortletRequest) context.getExternalContext().getRequest();
String captchaId = portletRequest.getRequestedSessionId();
- try
- {
- tester = JCaptchaService.getInstance().validateResponseForID(captchaId, (String) value);
- }
- catch (Exception e)
- {
- throw new ValidatorException(new FacesMessage("Error while validating."));
- }
+
+ tester = JCaptchaService.validateResponseForID(captchaId, (String) value);
+
if ( tester.equals(Boolean.FALSE))
{
throw new ValidatorException(new FacesMessage("captcha incorrect."));
Modified: trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/CurrentPasswordValidator.java
===================================================================
--- trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/CurrentPasswordValidator.java 2007-08-27 19:09:00 UTC (rev 8050)
+++ trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/CurrentPasswordValidator.java 2007-08-27 19:20:51 UTC (rev 8051)
@@ -29,7 +29,6 @@
import javax.faces.validator.ValidatorException;
import javax.portlet.PortletContext;
-import org.jboss.logging.Logger;
import org.jboss.portal.identity.User;
import org.jboss.portal.identity.UserModule;
@@ -49,9 +48,6 @@
/** . */
private User user;
- /** . */
- private static final Logger log = Logger.getLogger(CurrentPasswordValidator.class);
-
public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException
{
PortletContext portletContext = (PortletContext) context.getExternalContext().getContext();
Modified: trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/EmailValidator.java
===================================================================
--- trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/EmailValidator.java 2007-08-27 19:09:00 UTC (rev 8050)
+++ trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/EmailValidator.java 2007-08-27 19:20:51 UTC (rev 8051)
@@ -47,7 +47,7 @@
throw new IllegalArgumentException("The value must be a String");
}
- if (!Pattern.matches(this.EMAIL_VALIDATION, (String) value))
+ if (!Pattern.matches(EMAIL_VALIDATION, (String) value))
{
throw new ValidatorException(new FacesMessage("Invalid EMail Address"));
}
Modified: trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/UsernameValidator.java
===================================================================
--- trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/UsernameValidator.java 2007-08-27 19:09:00 UTC (rev 8050)
+++ trunk/core-identity/src/main/org/jboss/portal/core/identity/ui/validators/UsernameValidator.java 2007-08-27 19:20:51 UTC (rev 8051)
@@ -30,7 +30,6 @@
import javax.faces.validator.ValidatorException;
import javax.portlet.PortletContext;
-import org.jboss.logging.Logger;
import org.jboss.portal.identity.IdentityException;
import org.jboss.portal.identity.NoSuchUserException;
import org.jboss.portal.identity.User;
@@ -49,12 +48,8 @@
/** . */
private UserModule userModule;
- /** . */
- private static final Logger log = Logger.getLogger(UsernameValidator.class);
-
public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException
{
- User u = null;
String username = (String) value;
PortletContext portletContext = (PortletContext) context.getExternalContext().getContext();
userModule = (UserModule) portletContext.getAttribute("UserModule");
@@ -63,8 +58,8 @@
{
try
{
- u = userModule.findUserByUserName(username);
- throw new ValidatorException(new FacesMessage("This username is already in use."));
+ User u = userModule.findUserByUserName(username);
+ throw new ValidatorException(new FacesMessage("This username is already in use:"+ u.getUserName()));
}
catch (NoSuchUserException e)
{
Modified: trunk/core-identity/src/resources/portal-identity-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core-identity/src/resources/portal-identity-sar/META-INF/jboss-service.xml 2007-08-27 19:09:00 UTC (rev 8050)
+++ trunk/core-identity/src/resources/portal-identity-sar/META-INF/jboss-service.xml 2007-08-27 19:20:51 UTC (rev 8051)
@@ -31,8 +31,23 @@
<depends
optional-attribute-name="ServerConfig"
proxy-type="attribute">portal:service=ServerConfig</depends>
+ <depends
+ optional-attribute-name="RegistrationService"
+ proxy-type="attribute">portal:service=RegistrationService,type=Workflow</depends>
+ <depends
+ optional-attribute-name="ValidateEmailService"
+ proxy-type="attribute">portal:service=ValidateEmailService,type=Workflow</depends>
</mbean>
+ <mbean
+ code="org.jboss.portal.core.identity.services.IdentityMailServiceImpl"
+ name="portal:service=IdentityMailService,type=Mail"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ <attribute name="JNDIName">java:portal/IdentityMailService</attribute>
+ </mbean>
+
<mbean
code="org.jboss.portal.core.controller.command.mapper.CommandFactoryDelegate"
name="portal:commandFactory=Delegate,path=validateEmail"
@@ -47,6 +62,33 @@
optional-attribute-name="DelegateFactory"
proxy-type="attribute">portal:commandFactory=IdentityUI</depends>
</mbean>
+
+ <mbean
+ code="org.jboss.portal.core.identity.services.workflow.ApproveRegistration"
+ name="portal:service=RegistrationService,type=Workflow"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ <depends optional-attribute-name="WorkflowService" proxy-type="attribute">
+ portal:service=Workflow,type=WorkflowService
+ </depends>
+ <depends optional-attribute-name="ValidateEmailService"
+ proxy-type="attribute">portal:service=ValidateEmailService,type=Workflow</depends>
+ <attribute name="JNDIName">java:portal/RegistrationService</attribute>
+ </mbean>
+
+ <mbean
+ code="org.jboss.portal.core.identity.services.workflow.ValidateEmailServiceImpl"
+ name="portal:service=ValidateEmailService,type=Workflow"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ <depends optional-attribute-name="WorkflowService" proxy-type="attribute">
+ portal:service=Workflow,type=WorkflowService
+ </depends>
+ <attribute name="JNDIName">java:portal/ValidateEmailService</attribute>
+ </mbean>
+
<!--
<mbean
code="org.jboss.portal.core.identity.services.IdentityURLFactory"
Added: trunk/core-identity/src/resources/portal-identity-sar/conf/processes/jbp_identity_validate_email.xml
===================================================================
--- trunk/core-identity/src/resources/portal-identity-sar/conf/processes/jbp_identity_validate_email.xml (rev 0)
+++ trunk/core-identity/src/resources/portal-identity-sar/conf/processes/jbp_identity_validate_email.xml 2007-08-27 19:20:51 UTC (rev 8051)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE process-definition PUBLIC
+ "-//jBpm/jBpm Mapping DTD 2.0//EN"
+ "http://jbpm.org/dtd/processdefinition-2.0.dtd">
+
+<process-definition name="jbp_identity_validate_email">
+ <start-state>
+ <transition to="validate_email">
+ <action class="org.jboss.portal.core.identity.services.workflow.SendValidationMailAction"/>
+ </transition>
+ </start-state>
+ <state name="validate_email">
+ <create-timer name="time_to_expire" duedate="24 hours" transition="timedOut" />
+ <transition name="ok" to="validated"/>
+ <transition name="timedOut" to="expired"/>
+ <transition name="changeEmail" to="validated">
+ <!-- call action and update email -->
+ </transition>
+ </state>
+ <end-state name="validated"/>
+ <end-state name="expired"/>
+</process-definition>
\ No newline at end of file
Added: trunk/core-identity/src/resources/portal-identity-sar/conf/processes/jbp_identity_validation_approval_workflow.xml
===================================================================
--- trunk/core-identity/src/resources/portal-identity-sar/conf/processes/jbp_identity_validation_approval_workflow.xml (rev 0)
+++ trunk/core-identity/src/resources/portal-identity-sar/conf/processes/jbp_identity_validation_approval_workflow.xml 2007-08-27 19:20:51 UTC (rev 8051)
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE process-definition PUBLIC
+ "-//jBpm/jBpm Mapping DTD 2.0//EN"
+ "http://jbpm.org/dtd/processdefinition-2.0.dtd">
+
+<process-definition name="jbp_identity_validation_approval_workflow">
+ <start-state>
+ <transition to="emailValidation"/>
+ </start-state>
+ <process-state name="emailValidation">
+ <sub-process name="jbp_identity_validate_email"/>
+ <variable name="user" access="read" mapped-name="user"/>
+ <variable name="email" access="read" mapped-name="email"/>
+ <variable name="locale" access="read" mapped-name="locale"/>
+ <variable name="action" access="read" mapped-name="action"/>
+ <transition name="validated" to="adminApproval"/>
+ <transition name="expired" to="end"/>
+ </process-state>
+ <state name="adminApproval">
+ <transition name="validated" to="end">
+ <action class="org.jboss.portal.core.identity.services.workflow.CreateUserAction"/>
+ </transition>
+ <transition name="rejected" to="end"/>
+ </state>
+ <end-state name="end"/>
+</process-definition>
\ No newline at end of file
Copied: trunk/core-identity/src/resources/portal-identity-sar/conf/templates (from rev 8017, trunk/core-identity/src/resources/portal-identity-war/WEB-INF/classes/templates)
Modified: trunk/core-identity/src/resources/portal-identity-sar/conf/templates/changeEmail/emailTemplate.tpl
===================================================================
--- trunk/core-identity/src/resources/portal-identity-war/WEB-INF/classes/templates/changeEmail/emailTemplate.tpl 2007-08-21 16:55:37 UTC (rev 8017)
+++ trunk/core-identity/src/resources/portal-identity-sar/conf/templates/changeEmail/emailTemplate.tpl 2007-08-27 19:20:51 UTC (rev 8051)
@@ -1,4 +1,4 @@
-hello
+Hello,
you tried to change your email address on ${emailDomain}
Deleted: trunk/core-identity/src/resources/portal-identity-war/WEB-INF/classes/Identity.properties
===================================================================
--- trunk/core-identity/src/resources/portal-identity-war/WEB-INF/classes/Identity.properties 2007-08-27 19:09:00 UTC (rev 8050)
+++ trunk/core-identity/src/resources/portal-identity-war/WEB-INF/classes/Identity.properties 2007-08-27 19:20:51 UTC (rev 8051)
@@ -1,105 +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. #
-################################################################################
-
-IDENTITY_WELCOME=Welcome
-IDENTITY_REGISTER=Register
-IDENTITY_LOST_PASSWORD=Lost Password
-IDENTITY_NOT_LOGGED_IN=You are currently not logged in.
-IDENTITY_CREATE_ACCOUNT=You can create an account.
-IDENTITY_BUTTON_SUBMIT=Submit
-IDENTITY_BUTTON_EDIT=Edit
-IDENTITY_BUTTON_CANCEL=Cancel
-
-IDENTITY_REGISTER_TITLE=Basic user information
-IDENTITY_REGISTER_TITLE_CONFIRM=Confirmation
-IDENTITY_REGISTER_PASSWORD_CONFIRM=Confirm Password
-IDENTITY_REGISTER_SUCCESS_TITLE=Your account has been sucessfully created.
-
-IDENTITY_LOST_PASSWORD_TITLE=Forgot your login data?
-IDENTITY_LOST_PASSWORD_DESCRIPTION=Please enter your username to reset your password
-
-IDENTITY_EDIT_PASSWORD_TITLE=Change your password
-IDENTITY_EDIT_PASSWORD_CURRENT=Current password
-IDENTITY_EDIT_CHANGE_PASSWORD=Change password
-
-IDENTITY_EDIT_EMAIL_TITLE=Change your email address
-IDENTITY_EDIT_EMAIL_NEW=New email address
-IDENTITY_EDIT_CHANGE_EMAIL=Change email
-
-IDENTITY_EDIT_PROFILE_TITLE=Edit profile
-IDENTITY_VIEW_PROFILE_TITLE=View profile
-
-IDENTITY_USERNAME=Username
-IDENTITY_PASSWORD=Password
-IDENTITY_EMAIL=E-Mail
-IDENTITY_GIVENNAME=Firstname
-IDENTITY_FAMILYNAME=Lastname
-IDENTITY_SKYPE=Skype ID
-IDENTITY_LOCATION=Location
-IDENTITY_OCCUPATION=Occupation
-IDENTITY_EXTRA=Extra
-IDENTITY_SIGNATURE=Signature
-IDENTITY_INTERESTS=Interests
-IDENTITY_LOCALE=Locale
-IDENTITY_ICQ=Icq ID
-IDENTITY_AIM=Aim ID
-IDENTITY_MSNM= MSN messenger ID
-IDENTITY_YIM=Yahoo ID
-IDENTITY_XMMP=Xmmp ID
-IDENTITY_HOMEPAGE=Homepage
-IDENTITY_TIMEZONE=Time zone offset
-IDENTITY_THEME=Theme
-IDENTITY_SECURITY_QUESTION=Security Question
-IDENTITY_SECURITY_ANSWER=Security Answer
-IDENTITY_LAST_LOGIN=Last login
-IDENTITY_REIGSTRATION_DATE=Registration Date
-IDENTITY_ENABLED=Enabled
-
-IDENTITY_MANAGEMENT_ACTION=Actions
-IDENTITY_MANAGEMENT_ACTION_EDIT_PROFILE=Edit user
-IDENTITY_MANAGEMENT_ACTION_ROLES=Roles
-IDENTITY_MANAGEMENT_ACTION_DELETE=Delete
-IDENTITY_MANAGEMENT_USER_MANAGEMENT=User Management
-IDENTITY_MANAGEMENT_ROLE_MANAGEMENT=Role Management
-IDENTITY_MANAGEMENT_SEARCH_USER=Search users
-IDENTITY_MANAGEMENT_CREATE_USER=Create new user account
-IDENTITY_MANAGEMENT_ROLE=Role
-IDENTITY_MANAGEMENT_ROLE_DISPLAY=Display name
-IDENTITY_MANAGEMENT_ROLE_MEMBERS=Members
-IDENTITY_MANAGEMENT_ROLE_ASSIGNED=Assigned roles
-IDENTITY_MANAGEMENT_CREATE_ROLE=Create new role
-IDENTITY_MANAGEMENT_EDIT_ROLE=Edit role
-IDENTITY_MANAGEMENT_CREATE_ROLE=Create role
-IDENTITY_MANAGEMENT_DISABLE=Disable
-IDENTITY_MANAGEMENT_ENABLE=Enable
-IDENTITY_MANAGEMENT_RESET_PASSWORD=Reset password
-IDENTITY_MANAGEMENT_RESET_PASSWORD_DESCRIPTION=The user will get a random password sent by email.
-IDENTITY_REGISTER_VERIFY_CAPTCHA=Verify captcha
-
-IDENTITY_REGISTER_TITLE_CONFIRM_DELETE=Confirmation: Delete Object
-IDENTITY_REGISTER_CONFIRMATIONEMAIL=Confirm your subscription
-
-
-IDENTITY_MAIL_SUBJECT_LOST_PASSWORD=Reset your password
-IDENTITY_MAIL_SUBJECT_REGISTER=Confirm registration
-IDENTITY_MAIL_SUBJECT_CHANGE_EMAIL=Confirm email address
\ No newline at end of file
Deleted: trunk/core-identity/src/resources/portal-identity-war/WEB-INF/classes/Identity_de.properties
===================================================================
--- trunk/core-identity/src/resources/portal-identity-war/WEB-INF/classes/Identity_de.properties 2007-08-27 19:09:00 UTC (rev 8050)
+++ trunk/core-identity/src/resources/portal-identity-war/WEB-INF/classes/Identity_de.properties 2007-08-27 19:20:51 UTC (rev 8051)
@@ -1,25 +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. #
-################################################################################
-
-IDENTITY_WELCOME=Willkommen
-IDENTITY_VIEW_PROFILE_TITLE=Profilansicht
\ No newline at end of file
Modified: trunk/core-identity/src/resources/portal-identity-war/WEB-INF/faces-config.xml
===================================================================
--- trunk/core-identity/src/resources/portal-identity-war/WEB-INF/faces-config.xml 2007-08-27 19:09:00 UTC (rev 8050)
+++ trunk/core-identity/src/resources/portal-identity-war/WEB-INF/faces-config.xml 2007-08-27 19:20:51 UTC (rev 8051)
@@ -28,10 +28,9 @@
<faces-config>
<application>
- <variable-resolver>org.jboss.portal.core.identity.ui.faces.JBossPortletVariableResolver</variable-resolver>
- <property-resolver>org.jboss.portal.core.identity.ui.faces.JBossPortletPropertyResolver</property-resolver>
-<!-- <property-resolver>org.jboss.portal.faces.el.DelegatingPropertyResolver</property-resolver>
- -->
+ <variable-resolver>org.jboss.portal.core.identity.ui.faces.PortletVariableResolver</variable-resolver>
+ <property-resolver>org.jboss.portal.core.identity.ui.faces.PortletDelegatingPropertyResolver</property-resolver>
+<!-- <property-resolver>org.jboss.portal.faces.el.DelegatingPropertyResolver</property-resolver> -->
<view-handler>com.sun.facelets.FaceletPortletViewHandler</view-handler>
</application>
@@ -41,23 +40,6 @@
<managed-bean-scope>application</managed-bean-scope>
</managed-bean>
<managed-bean>
- <managed-bean-name>sendmailmgr</managed-bean-name>
- <managed-bean-class>org.jboss.portal.core.identity.ui.common.SendMailBean</managed-bean-class>
- <managed-bean-scope>application</managed-bean-scope>
- <!--
- Mail Preferences
- -->
- <managed-property>
- <property-name>emailDomain</property-name>
- <value>Portal.com</value>
- </managed-property>
- <managed-property>
- <property-name>emailFrom</property-name>
- <value>no-reply(a)portal.com</value>
- </managed-property>
- <!-- -->
- </managed-bean>
- <managed-bean>
<managed-bean-name>identityrolemgr</managed-bean-name>
<managed-bean-class>org.jboss.portal.core.identity.ui.common.IdentityRoleBean</managed-bean-class>
<managed-bean-scope>application</managed-bean-scope>
@@ -94,13 +76,8 @@
<property-name>metaDataService</property-name>
<value>#{metadataservice}</value>
</managed-property>
- <managed-property>
- <property-name>identityRoleBean</property-name>
- <value>#{identityrolemgr}</value>
- </managed-property>
</managed-bean>
-
<managed-bean>
<managed-bean-name>editprofilemgr</managed-bean-name>
<managed-bean-class>org.jboss.portal.core.identity.ui.actions.EditProfileAction</managed-bean-class>
@@ -110,29 +87,21 @@
<value>#{identityusermgr}</value>
</managed-property>
<managed-property>
- <property-name>sendMailBean</property-name>
- <value>#{sendmailmgr}</value>
+ <property-name>validateEmailService</property-name>
+ <value>#{applicationScope.ValidateEmailService}</value>
</managed-property>
</managed-bean>
<managed-bean>
<managed-bean-name>userregistermgr</managed-bean-name>
<managed-bean-class>org.jboss.portal.core.identity.ui.actions.CreateUserAction</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
- <!--
- subscriptionMode
- -->
<managed-property>
- <property-name>subscriptionMode</property-name>
- <value>emailVerification</value>
- </managed-property>
- <!-- -->
- <managed-property>
<property-name>identityUserBean</property-name>
<value>#{identityusermgr}</value>
</managed-property>
<managed-property>
- <property-name>sendMailBean</property-name>
- <value>#{sendmailmgr}</value>
+ <property-name>registrationService</property-name>
+ <value>#{applicationScope.RegistrationService}</value>
</managed-property>
</managed-bean>
<managed-bean>
@@ -160,6 +129,10 @@
<property-name>identityRoleBean</property-name>
<value>#{identityrolemgr}</value>
</managed-property>
+ <managed-property>
+ <property-name>registrationService</property-name>
+ <value>#{applicationScope.RegistrationService}</value>
+ </managed-property>
</managed-bean>
<managed-bean>
<managed-bean-name>rolemanagementbean</managed-bean-name>
@@ -190,13 +163,14 @@
<property-name>passwordCharacters</property-name>
<value>0123456789aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWyYzZ*#!+-/"</value>
</managed-property>
+ <!-- -->
<managed-property>
<property-name>identityUserBean</property-name>
<value>#{identityusermgr}</value>
</managed-property>
<managed-property>
- <property-name>sendMailBean</property-name>
- <value>#{sendmailmgr}</value>
+ <property-name>identityMailService</property-name>
+ <value>#{applicationScope.IdentityMailService}</value>
</managed-property>
</managed-bean>
<managed-bean>
@@ -328,6 +302,13 @@
<navigation-rule>
<from-view-id>/WEB-INF/jsf/admin/index.xhtml</from-view-id>
<navigation-case>
+ <from-outcome>showPendingUsers</from-outcome>
+ <to-view-id>/WEB-INF/jsf/admin/user/pendingUsers.xhtml</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+ <from-view-id>/WEB-INF/jsf/admin/index.xhtml</from-view-id>
+ <navigation-case>
<from-outcome>deleteUser</from-outcome>
<to-view-id>/WEB-INF/jsf/admin/user/deleteUser.xhtml</to-view-id>
</navigation-case>
Modified: trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jboss-portlet.xml
===================================================================
--- trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jboss-portlet.xml 2007-08-27 19:09:00 UTC (rev 8050)
+++ trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jboss-portlet.xml 2007-08-27 19:20:51 UTC (rev 8051)
@@ -73,8 +73,18 @@
<service-ref>:service=Module,type=Membership</service-ref>
</service>
<service>
- <service-name>MailModule</service-name>
- <service-class>org.jboss.portal.core.modules.MailModule</service-class>
- <service-ref>:service=Module,type=Mail</service-ref>
+ <service-name>IdentityMailService</service-name>
+ <service-class>org.jboss.portal.core.identity.services.IdentityMailService</service-class>
+ <service-ref>:service=IdentityMailService,type=Mail</service-ref>
</service>
+ <service>
+ <service-name>RegistrationService</service-name>
+ <service-class>org.jboss.portal.core.identity.services.workflow.RegistrationService</service-class>
+ <service-ref>:service=RegistrationService,type=Workflow</service-ref>
+ </service>
+ <service>
+ <service-name>ValidateEmailService</service-name>
+ <service-class>org.jboss.portal.core.identity.services.workflow.ValidateEmailService</service-class>
+ <service-ref>:service=ValidateEmailService,type=Workflow</service-ref>
+ </service>
</portlet-app>
\ No newline at end of file
Modified: trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/index.xhtml
===================================================================
--- trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/index.xhtml 2007-08-27 19:09:00 UTC (rev 8050)
+++ trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/index.xhtml 2007-08-27 19:20:51 UTC (rev 8051)
@@ -10,6 +10,8 @@
<ui:define name="title"><h:outputText value="#{bundle.IDENTITY_MANAGEMENT_SEARCH_USER}"/></ui:define>
<ui:define name="content">
+<h:commandLink value="show pending users" action="showPendingUsers"/>
+
<h:form>
<h:panelGrid columns="3">
<h:inputText id="searchString" value="#{useradministrationbean.searchString}" />
@@ -24,7 +26,7 @@
</h:form>
<hr/>
- <h:dataTable id="userlist" value="#{useradministrationbean.userList}" var="uiUser" rendered="#{useradministrationbean.userList.rowCount > 0}" rowClasses="portlet-section-body,portlet-section-alternate" headerClass="portlet-section-header" width="100%">
+ <h:dataTable id="userlist" value="#{useradministrationbean.userList}" var="uiUser" rendered="#{useradministrationbean.userList.rowCount > 0}" rows="#{useradministrationbean.limit}" rowClasses="portlet-section-body,portlet-section-alternate" headerClass="portlet-section-header" width="100%">
<h:column>
<f:facet name="header">
<h:outputText value="#{bundle.IDENTITY_USERNAME}"/>
@@ -72,7 +74,12 @@
</h:commandLink>
</h:column>
</h:dataTable>
-
+
+
+ <h:commandLink value=" < " action="#{useradministrationbean.prevPage}" rendered="#{useradministrationbean.page > 1}" styleClass="portlet-form-button"/>
+ <h:commandLink value=" > " action="#{useradministrationbean.nextPage}" rendered="#{useradministrationbean.userList.rowCount > useradministrationbean.limit}" styleClass="portlet-form-button"/>
+
+
<p style="text-align: right"><h:commandLink value="#{bundle.IDENTITY_MANAGEMENT_CREATE_USER}" action="createUser"/></p>
</ui:define>
Modified: trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/roles/roleMembers.xhtml
===================================================================
--- trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/roles/roleMembers.xhtml 2007-08-27 19:09:00 UTC (rev 8050)
+++ trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/roles/roleMembers.xhtml 2007-08-27 19:20:51 UTC (rev 8051)
@@ -15,7 +15,7 @@
<ui:define name="content">
<hr/>
<h:form>
- <h:dataTable value="#{rolemanagementbean.roleMembers}" var="uiUser" rowClasses="portlet-section-body,portlet-section-alternate" headerClass="portlet-section-header" width="100%">
+ <h:dataTable value="#{rolemanagementbean.roleMembers}" var="uiUser" rows="#{rolemanagementbean.limit}" rendered="#{rolemanagementbean.roleMembers.rowCount > 0}" rowClasses="portlet-section-body,portlet-section-alternate" headerClass="portlet-section-header" width="100%">
<h:column>
<f:facet name="header">
<h:outputText value="#{bundle.IDENTITY_USERNAME}"/>
@@ -55,6 +55,8 @@
</h:column>
</h:dataTable>
</h:form>
+<h:commandLink value=" < " action="#{rolemanagementbean.prevPage}" rendered="#{rolemanagementbean.page > 1}" styleClass="portlet-form-button"/>
+<h:commandLink value=" > " action="#{rolemanagementbean.nextPage}" rendered="#{rolemanagementbean.roleMembers.rowCount > rolemanagementbean.limit}" styleClass="portlet-form-button"/>
<br/>
<h:form>
<h4><h:outputText value="#{bundle.IDENTITY_MANAGEMENT_SEARCH_USER}"/></h4>
Added: trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/user/pendingUsers.xhtml
===================================================================
--- trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/user/pendingUsers.xhtml (rev 0)
+++ trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/admin/user/pendingUsers.xhtml 2007-08-27 19:20:51 UTC (rev 8051)
@@ -0,0 +1,60 @@
+<div
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:c="http://java.sun.com/jstl/core"
+ class="identity-ui">
+
+<ui:composition template="/WEB-INF/jsf/admin/user/userTemplate.xhtml">
+
+<ui:define name="title">title TODO pending users</ui:define>
+<ui:define name="content">
+<h:dataTable value="#{useradministrationbean.pendingUsers}" var="user">
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="processId"/>
+ </f:facet>
+ <h:outputText value="#{user.processId}"/>
+ </h:column>
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="username"/>
+ </f:facet>
+ <h:outputText value="#{user.username}"/>
+ </h:column>
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="email"/>
+ </f:facet>
+ <h:outputText value="#{user.email}"/>
+ </h:column>
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="registration date"/>
+ </f:facet>
+ <h:outputText value="#{user.registrationDate}"/>
+ </h:column>
+ <h:column>
+ <f:facet name="header">
+ <h:outputText value="status"/>
+ </f:facet>
+ <h:outputText value="Pending" rendered="#{user.currentNode == 'emailValidation'}"/>
+ <c:if test="#{user.currentNode == 'adminApproval'}">
+ <h:commandLink action="#{useradministrationbean.approveRegistration}">
+ <h:outputText value="approve"/>
+ <f:param name="processId" value="#{user.processId}" />
+ <f:param name="action" value="approve" />
+ </h:commandLink> |
+ <h:commandLink action="#{useradministrationbean.approveRegistration}">
+ <h:outputText value="reject"/>
+ <f:param name="processId" value="#{user.processId}" />
+ <f:param name="action" value="reject" />
+ </h:commandLink>
+ </c:if>
+ </h:column>
+</h:dataTable>
+
+</ui:define>
+</ui:composition>
+</div>
\ No newline at end of file
Modified: trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/common/register.xhtml
===================================================================
--- trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/common/register.xhtml 2007-08-27 19:09:00 UTC (rev 8050)
+++ trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/common/register.xhtml 2007-08-27 19:20:51 UTC (rev 8051)
@@ -32,7 +32,8 @@
</h:inputSecret>
<h:message for="passwordCheck"/>
</h:panelGrid>
- <c:if test="#{showCaptcha == true}">
+ <c:if test="#{portletPreferenceValue.captcha == true}">
+ <hr/>
<h:graphicImage id="captchaimage" url="/jcaptcha" />
<h:panelGrid columns="3">
<h:outputText value="#{bundle.IDENTITY_REGISTER_VERIFY_CAPTCHA}" />
Modified: trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/index.xhtml
===================================================================
--- trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/index.xhtml 2007-08-27 19:09:00 UTC (rev 8050)
+++ trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/index.xhtml 2007-08-27 19:20:51 UTC (rev 8051)
@@ -5,8 +5,6 @@
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jstl/core">
-
-#{portletPreferenceValues}
<c:choose>
<c:when test="#{facesContext.externalContext.remoteUser != null}">
<ui:include src="/WEB-INF/jsf/profile/viewProfile.xhtml"/>
Modified: trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/lostPassword/lost.xhtml
===================================================================
--- trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/lostPassword/lost.xhtml 2007-08-27 19:09:00 UTC (rev 8050)
+++ trunk/core-identity/src/resources/portal-identity-war/WEB-INF/jsf/lostPassword/lost.xhtml 2007-08-27 19:20:51 UTC (rev 8051)
@@ -19,6 +19,8 @@
<h:inputText id="username" value="#{lostpasswordmgr.username}" />
<h:message for="username" />
</h:panelGrid>
+ <c:if test="#{portletPreferenceValue.captcha == true}">
+ <hr/>
<h:graphicImage id="captchaimage" url="/jcaptcha" />
<h:panelGrid columns="3">
<h:outputText value="#{bundle.IDENTITY_REGISTER_VERIFY_CAPTCHA}" />
@@ -27,6 +29,7 @@
</h:inputText>
<h:message for="validateCaptcha" />
</h:panelGrid>
+ </c:if>
<hr/>
<h:commandButton value="#{bundle.IDENTITY_BUTTON_SUBMIT}" action="#{lostpasswordmgr.doomed}" styleClass="portlet-form-button"/>
</h:form>
Modified: trunk/core-identity/src/resources/portal-identity-war/WEB-INF/portlet.xml
===================================================================
--- trunk/core-identity/src/resources/portal-identity-war/WEB-INF/portlet.xml 2007-08-27 19:09:00 UTC (rev 8050)
+++ trunk/core-identity/src/resources/portal-identity-war/WEB-INF/portlet.xml 2007-08-27 19:20:51 UTC (rev 8051)
@@ -59,6 +59,13 @@
<title>User portlet</title>
<keywords>management,user</keywords>
</portlet-info>
+ <portlet-preferences>
+ <preference>
+ <!-- Use captcha verification -->
+ <name>captcha</name>
+ <value>false</value>
+ </preference>
+ </portlet-preferences>
</portlet>
<portlet>
Copied: trunk/core-identity/src/resources/resource-bundles/Identity.properties (from rev 8017, trunk/core-identity/src/resources/portal-identity-war/WEB-INF/classes/Identity.properties)
===================================================================
--- trunk/core-identity/src/resources/resource-bundles/Identity.properties (rev 0)
+++ trunk/core-identity/src/resources/resource-bundles/Identity.properties 2007-08-27 19:20:51 UTC (rev 8051)
@@ -0,0 +1,105 @@
+################################################################################
+# 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. #
+################################################################################
+
+IDENTITY_WELCOME=Welcome
+IDENTITY_REGISTER=Register
+IDENTITY_LOST_PASSWORD=Lost Password
+IDENTITY_NOT_LOGGED_IN=You are currently not logged in.
+IDENTITY_CREATE_ACCOUNT=You can create an account.
+IDENTITY_BUTTON_SUBMIT=Submit
+IDENTITY_BUTTON_EDIT=Edit
+IDENTITY_BUTTON_CANCEL=Cancel
+
+IDENTITY_REGISTER_TITLE=Basic user information
+IDENTITY_REGISTER_TITLE_CONFIRM=Confirmation
+IDENTITY_REGISTER_PASSWORD_CONFIRM=Confirm Password
+IDENTITY_REGISTER_SUCCESS_TITLE=Your account has been sucessfully created.
+
+IDENTITY_LOST_PASSWORD_TITLE=Forgot your login data?
+IDENTITY_LOST_PASSWORD_DESCRIPTION=Please enter your username to reset your password
+
+IDENTITY_EDIT_PASSWORD_TITLE=Change your password
+IDENTITY_EDIT_PASSWORD_CURRENT=Current password
+IDENTITY_EDIT_CHANGE_PASSWORD=Change password
+
+IDENTITY_EDIT_EMAIL_TITLE=Change your email address
+IDENTITY_EDIT_EMAIL_NEW=New email address
+IDENTITY_EDIT_CHANGE_EMAIL=Change email
+
+IDENTITY_EDIT_PROFILE_TITLE=Edit profile
+IDENTITY_VIEW_PROFILE_TITLE=View profile
+
+IDENTITY_USERNAME=Username
+IDENTITY_PASSWORD=Password
+IDENTITY_EMAIL=E-Mail
+IDENTITY_GIVENNAME=Firstname
+IDENTITY_FAMILYNAME=Lastname
+IDENTITY_SKYPE=Skype ID
+IDENTITY_LOCATION=Location
+IDENTITY_OCCUPATION=Occupation
+IDENTITY_EXTRA=Extra
+IDENTITY_SIGNATURE=Signature
+IDENTITY_INTERESTS=Interests
+IDENTITY_LOCALE=Locale
+IDENTITY_ICQ=Icq ID
+IDENTITY_AIM=Aim ID
+IDENTITY_MSNM= MSN messenger ID
+IDENTITY_YIM=Yahoo ID
+IDENTITY_XMMP=Xmmp ID
+IDENTITY_HOMEPAGE=Homepage
+IDENTITY_TIMEZONE=Time zone offset
+IDENTITY_THEME=Theme
+IDENTITY_SECURITY_QUESTION=Security Question
+IDENTITY_SECURITY_ANSWER=Security Answer
+IDENTITY_LAST_LOGIN=Last login
+IDENTITY_REIGSTRATION_DATE=Registration Date
+IDENTITY_ENABLED=Enabled
+
+IDENTITY_MANAGEMENT_ACTION=Actions
+IDENTITY_MANAGEMENT_ACTION_EDIT_PROFILE=Edit user
+IDENTITY_MANAGEMENT_ACTION_ROLES=Roles
+IDENTITY_MANAGEMENT_ACTION_DELETE=Delete
+IDENTITY_MANAGEMENT_USER_MANAGEMENT=User Management
+IDENTITY_MANAGEMENT_ROLE_MANAGEMENT=Role Management
+IDENTITY_MANAGEMENT_SEARCH_USER=Search users
+IDENTITY_MANAGEMENT_CREATE_USER=Create new user account
+IDENTITY_MANAGEMENT_ROLE=Role
+IDENTITY_MANAGEMENT_ROLE_DISPLAY=Display name
+IDENTITY_MANAGEMENT_ROLE_MEMBERS=Members
+IDENTITY_MANAGEMENT_ROLE_ASSIGNED=Assigned roles
+IDENTITY_MANAGEMENT_CREATE_ROLE=Create new role
+IDENTITY_MANAGEMENT_EDIT_ROLE=Edit role
+IDENTITY_MANAGEMENT_CREATE_ROLE=Create role
+IDENTITY_MANAGEMENT_DISABLE=Disable
+IDENTITY_MANAGEMENT_ENABLE=Enable
+IDENTITY_MANAGEMENT_RESET_PASSWORD=Reset password
+IDENTITY_MANAGEMENT_RESET_PASSWORD_DESCRIPTION=The user will get a random password sent by email.
+IDENTITY_REGISTER_VERIFY_CAPTCHA=Verify captcha
+
+IDENTITY_REGISTER_TITLE_CONFIRM_DELETE=Confirmation: Delete Object
+IDENTITY_REGISTER_CONFIRMATIONEMAIL=Confirm your subscription
+
+
+IDENTITY_MAIL_SUBJECT_LOST_PASSWORD=Reset your password
+IDENTITY_MAIL_SUBJECT_REGISTER=Confirm registration
+IDENTITY_MAIL_SUBJECT_CHANGE_EMAIL=Confirm email address
\ No newline at end of file
Copied: trunk/core-identity/src/resources/resource-bundles/Identity_de.properties (from rev 8017, trunk/core-identity/src/resources/portal-identity-war/WEB-INF/classes/Identity_de.properties)
===================================================================
--- trunk/core-identity/src/resources/resource-bundles/Identity_de.properties (rev 0)
+++ trunk/core-identity/src/resources/resource-bundles/Identity_de.properties 2007-08-27 19:20:51 UTC (rev 8051)
@@ -0,0 +1,25 @@
+################################################################################
+# 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. #
+################################################################################
+
+IDENTITY_WELCOME=Willkommen
+IDENTITY_VIEW_PROFILE_TITLE=Profilansicht
\ No newline at end of file
18 years, 8 months
JBoss Portal SVN: r8049 - in trunk/core/src/main/org/jboss/portal: test/core/model/portal and 1 other directory.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-08-27 11:15:24 -0400 (Mon, 27 Aug 2007)
New Revision: 8049
Modified:
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectPath.java
trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectPathTestCase.java
Log:
JBPORTAL-1614: Cannot access dashboard if logged in as user that has a "." (dot) in the username
Fixed and rollbacked again.
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectPath.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectPath.java 2007-08-27 15:11:39 UTC (rev 8048)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectPath.java 2007-08-27 15:15:24 UTC (rev 8049)
@@ -34,6 +34,7 @@
* A path for a portal object.
*
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
* @version $Revision: 1.1 $
*/
public class PortalObjectPath implements Comparable, Serializable
@@ -365,7 +366,10 @@
{
break;
}
- length++;
+ if (next > 0 && value.charAt(next-1) != '\\')
+ {
+ length++;
+ }
previous = next + 1;
}
@@ -373,17 +377,26 @@
String[] names = new String[length];
length = 0;
previous = 1;
+ int next = 1;
while (true)
{
- int next = value.indexOf(PATH_SEPARATOR, previous);
+ next = value.indexOf(PATH_SEPARATOR, next);
if (next == -1)
{
break;
}
- names[length++] = value.substring(previous, next);
- previous = next + 1;
+ if (next > 0 && value.charAt(next-1) != '\\')
+ {
+ String name = value.substring(previous, next);
+ name = decodeName(name);
+ names[length++] = name;
+ previous = next + 1;
+ }
+ next++;
}
- names[length] = value.substring(previous);
+ String name = value.substring(previous);
+ name = decodeName(name);
+ names[length] = name;
//
return names;
@@ -406,11 +419,23 @@
{
throw new IllegalArgumentException("No null name expected in the name string array");
}
+ name = encodeName(name);
tmp.append(PATH_SEPARATOR).append(name);
}
return tmp.toString();
}
}
+
+ protected String decodeName(String name)
+ {
+ return name.replaceAll("\\/", "/");
+ }
+
+ protected String encodeName(String name)
+ {
+ return name.replaceAll("/", "\\/");
+ }
+
}
;
@@ -438,18 +463,25 @@
int length = 1;
for (int next = value.indexOf('.'); next != -1; next = value.indexOf('.', next + 1))
{
- length++;
+ if (next > 0 && value.charAt(next-1) != '\\')
+ {
+ length++;
+ }
}
//
String[] names = new String[length];
length = 0;
int previous = 0;
- for (int next = value.indexOf('.'); next != -1; previous = next + 1, next = value.indexOf('.', next + 1))
+ for (int next = value.indexOf('.'); next != -1; next = value.indexOf('.', next + 1))
{
- String name = value.substring(previous, next);
- name = decodeName(name);
- names[length++] = name;
+ if (next > 0 && value.charAt(next-1) != '\\')
+ {
+ String name = value.substring(previous, next);
+ name = decodeName(name);
+ names[length++] = name;
+ previous = next + 1;
+ }
}
String name = value.substring(previous);
name = decodeName(name);
@@ -490,13 +522,14 @@
protected String decodeName(String name)
{
- return name;
+ return name.replaceAll("\\\\\\.", ".");
}
protected String encodeName(String name)
{
- return name;
+ return name.replaceAll("\\.", "\\\\\\.");
}
+
}
public static final PortalObjectPath.Format LEGACY_BASE64_FORMAT = new PortalObjectPath.LegacyFormat()
Modified: trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectPathTestCase.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectPathTestCase.java 2007-08-27 15:11:39 UTC (rev 8048)
+++ trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectPathTestCase.java 2007-08-27 15:15:24 UTC (rev 8049)
@@ -141,11 +141,30 @@
assertEquals(new PortalObjectPath(new String[]{}), PortalObjectPath.parse("/", PortalObjectPath.CANONICAL_FORMAT));
assertEquals(new PortalObjectPath(new String[]{"a"}), PortalObjectPath.parse("/a", PortalObjectPath.CANONICAL_FORMAT));
assertEquals(new PortalObjectPath(new String[]{"a","b"}), PortalObjectPath.parse("/a/b", PortalObjectPath.CANONICAL_FORMAT));
- assertEquals(new PortalObjectPath(new String[]{"a.b", "c"}), PortalObjectPath.parse(new PortalObjectPath(new String[]{"a.b", "c"}).toString(PortalObjectPath.CANONICAL_FORMAT), PortalObjectPath.CANONICAL_FORMAT));
- assertEquals(new PortalObjectPath(new String[]{".a.b", "c"}), PortalObjectPath.parse(new PortalObjectPath(new String[]{".a.b", "c"}).toString(PortalObjectPath.CANONICAL_FORMAT), PortalObjectPath.CANONICAL_FORMAT));
- assertEquals(new PortalObjectPath(new String[]{"\\.a.b/", "\\c"}), PortalObjectPath.parse(new PortalObjectPath(new String[]{"\\.a.b/", "\\c"}).toString(PortalObjectPath.CANONICAL_FORMAT), PortalObjectPath.CANONICAL_FORMAT));
- assertEquals(new PortalObjectPath(new String[]{"/"}), PortalObjectPath.parse(new PortalObjectPath(new String[]{"/"}).toString(PortalObjectPath.CANONICAL_FORMAT), PortalObjectPath.CANONICAL_FORMAT));
+ String a = "a.b";
+ String b = "c";
+ PortalObjectPath pop1 = new PortalObjectPath(new String[]{a, b});
+ PortalObjectPath pop2 = PortalObjectPath.parse(new PortalObjectPath(new String[]{a, b}).toString(PortalObjectPath.CANONICAL_FORMAT), PortalObjectPath.CANONICAL_FORMAT);
+ assertEquals(pop1.toString(PortalObjectPath.CANONICAL_FORMAT), pop2.toString(PortalObjectPath.CANONICAL_FORMAT));
+
+ a = ".a.b";
+ b = "c";
+ pop1 = new PortalObjectPath(new String[]{a, b});
+ pop2 = PortalObjectPath.parse(new PortalObjectPath(new String[]{a, b}).toString(PortalObjectPath.CANONICAL_FORMAT), PortalObjectPath.CANONICAL_FORMAT);
+ assertEquals(pop1.toString(PortalObjectPath.CANONICAL_FORMAT), pop2.toString(PortalObjectPath.CANONICAL_FORMAT));
+
+ a = "\\.a.b/";
+ b = "\\c";
+ pop1 = new PortalObjectPath(new String[]{a, b});
+ pop2 = PortalObjectPath.parse(new PortalObjectPath(new String[]{a, b}).toString(PortalObjectPath.CANONICAL_FORMAT), PortalObjectPath.CANONICAL_FORMAT);
+ assertEquals(pop1.toString(PortalObjectPath.CANONICAL_FORMAT), pop2.toString(PortalObjectPath.CANONICAL_FORMAT));
+
+ a = "/";
+ pop1 = new PortalObjectPath(new String[]{a});
+ pop2 = PortalObjectPath.parse(new PortalObjectPath(new String[]{a}).toString(PortalObjectPath.CANONICAL_FORMAT), PortalObjectPath.CANONICAL_FORMAT);
+ assertEquals(pop1.toString(PortalObjectPath.CANONICAL_FORMAT), pop2.toString(PortalObjectPath.CANONICAL_FORMAT));
+
//
try
{
@@ -171,10 +190,23 @@
assertEquals(new PortalObjectPath(new String[]{"a"}), PortalObjectPath.parse("a", PortalObjectPath.LEGACY_FORMAT));
assertEquals(new PortalObjectPath(new String[]{"a","b"}), PortalObjectPath.parse("a.b", PortalObjectPath.LEGACY_FORMAT));
+ String a = "a.b";
+ String b = "c";
+ PortalObjectPath pop1 = new PortalObjectPath(new String[]{a, b});
+ PortalObjectPath pop2 = PortalObjectPath.parse(new PortalObjectPath(new String[]{a, b}).toString(PortalObjectPath.LEGACY_FORMAT), PortalObjectPath.LEGACY_FORMAT);
+ assertEquals(pop1.toString(PortalObjectPath.LEGACY_FORMAT), pop2.toString(PortalObjectPath.LEGACY_FORMAT));
- assertEquals(new PortalObjectPath(new String[]{"a.b", "c"}), PortalObjectPath.parse(new PortalObjectPath(new String[]{"a.b", "c"}).toString(PortalObjectPath.LEGACY_FORMAT), PortalObjectPath.LEGACY_FORMAT));
- assertEquals(new PortalObjectPath(new String[]{".a.b", "c"}), PortalObjectPath.parse(new PortalObjectPath(new String[]{".a.b", "c"}).toString(PortalObjectPath.LEGACY_FORMAT), PortalObjectPath.LEGACY_FORMAT));
- assertEquals(new PortalObjectPath(new String[]{"\\.a.b/", "\\c"}), PortalObjectPath.parse(new PortalObjectPath(new String[]{"\\.a.b/", "\\c"}).toString(PortalObjectPath.LEGACY_FORMAT), PortalObjectPath.LEGACY_FORMAT));
+ a = ".a.b";
+ b = "c";
+ pop1 = new PortalObjectPath(new String[]{a, b});
+ pop2 = PortalObjectPath.parse(new PortalObjectPath(new String[]{a, b}).toString(PortalObjectPath.LEGACY_FORMAT), PortalObjectPath.LEGACY_FORMAT);
+ assertEquals(pop1.toString(PortalObjectPath.LEGACY_FORMAT), pop2.toString(PortalObjectPath.LEGACY_FORMAT));
+
+ a = "\\.a.b/";
+ b = "\\c";
+ pop1 = new PortalObjectPath(new String[]{a, b});
+ pop2 = PortalObjectPath.parse(new PortalObjectPath(new String[]{a, b}).toString(PortalObjectPath.LEGACY_FORMAT), PortalObjectPath.LEGACY_FORMAT);
+ assertEquals(pop1.toString(PortalObjectPath.LEGACY_FORMAT), pop2.toString(PortalObjectPath.LEGACY_FORMAT));
}
public void testEquals()
18 years, 8 months
JBoss Portal SVN: r8048 - in branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal: test/core/model/portal and 1 other directory.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-08-27 11:11:39 -0400 (Mon, 27 Aug 2007)
New Revision: 8048
Modified:
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/model/portal/PortalObjectPath.java
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectPathTestCase.java
Log:
JBPORTAL-1614: Cannot access dashboard if logged in as user that has a "." (dot) in the username
Fixed and rollbacked again.
Modified: branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/model/portal/PortalObjectPath.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/model/portal/PortalObjectPath.java 2007-08-24 20:52:39 UTC (rev 8047)
+++ branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/model/portal/PortalObjectPath.java 2007-08-27 15:11:39 UTC (rev 8048)
@@ -34,6 +34,7 @@
* A path for a portal object.
*
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
* @version $Revision: 1.1 $
*/
public class PortalObjectPath implements Comparable, Serializable
@@ -365,7 +366,10 @@
{
break;
}
- length++;
+ if (next > 0 && value.charAt(next-1) != '\\')
+ {
+ length++;
+ }
previous = next + 1;
}
@@ -373,17 +377,26 @@
String[] names = new String[length];
length = 0;
previous = 1;
+ int next = 1;
while (true)
{
- int next = value.indexOf(PATH_SEPARATOR, previous);
+ next = value.indexOf(PATH_SEPARATOR, next);
if (next == -1)
{
break;
}
- names[length++] = value.substring(previous, next);
- previous = next + 1;
+ if (next > 0 && value.charAt(next-1) != '\\')
+ {
+ String name = value.substring(previous, next);
+ name = decodeName(name);
+ names[length++] = name;
+ previous = next + 1;
+ }
+ next++;
}
- names[length] = value.substring(previous);
+ String name = value.substring(previous);
+ name = decodeName(name);
+ names[length] = name;
//
return names;
@@ -406,11 +419,23 @@
{
throw new IllegalArgumentException("No null name expected in the name string array");
}
+ name = encodeName(name);
tmp.append(PATH_SEPARATOR).append(name);
}
return tmp.toString();
}
}
+
+ protected String decodeName(String name)
+ {
+ return name.replaceAll("\\/", "/");
+ }
+
+ protected String encodeName(String name)
+ {
+ return name.replaceAll("/", "\\/");
+ }
+
}
;
@@ -438,18 +463,25 @@
int length = 1;
for (int next = value.indexOf('.'); next != -1; next = value.indexOf('.', next + 1))
{
- length++;
+ if (next > 0 && value.charAt(next-1) != '\\')
+ {
+ length++;
+ }
}
//
String[] names = new String[length];
length = 0;
int previous = 0;
- for (int next = value.indexOf('.'); next != -1; previous = next + 1, next = value.indexOf('.', next + 1))
+ for (int next = value.indexOf('.'); next != -1; next = value.indexOf('.', next + 1))
{
- String name = value.substring(previous, next);
- name = decodeName(name);
- names[length++] = name;
+ if (next > 0 && value.charAt(next-1) != '\\')
+ {
+ String name = value.substring(previous, next);
+ name = decodeName(name);
+ names[length++] = name;
+ previous = next + 1;
+ }
}
String name = value.substring(previous);
name = decodeName(name);
@@ -490,13 +522,14 @@
protected String decodeName(String name)
{
- return name;
+ return name.replaceAll("\\\\\\.", ".");
}
protected String encodeName(String name)
{
- return name;
+ return name.replaceAll("\\.", "\\\\\\.");
}
+
}
public static final PortalObjectPath.Format LEGACY_BASE64_FORMAT = new PortalObjectPath.LegacyFormat()
Modified: branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectPathTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectPathTestCase.java 2007-08-24 20:52:39 UTC (rev 8047)
+++ branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectPathTestCase.java 2007-08-27 15:11:39 UTC (rev 8048)
@@ -141,11 +141,30 @@
assertEquals(new PortalObjectPath(new String[]{}), PortalObjectPath.parse("/", PortalObjectPath.CANONICAL_FORMAT));
assertEquals(new PortalObjectPath(new String[]{"a"}), PortalObjectPath.parse("/a", PortalObjectPath.CANONICAL_FORMAT));
assertEquals(new PortalObjectPath(new String[]{"a","b"}), PortalObjectPath.parse("/a/b", PortalObjectPath.CANONICAL_FORMAT));
- assertEquals(new PortalObjectPath(new String[]{"a.b", "c"}), PortalObjectPath.parse(new PortalObjectPath(new String[]{"a.b", "c"}).toString(PortalObjectPath.CANONICAL_FORMAT), PortalObjectPath.CANONICAL_FORMAT));
- assertEquals(new PortalObjectPath(new String[]{".a.b", "c"}), PortalObjectPath.parse(new PortalObjectPath(new String[]{".a.b", "c"}).toString(PortalObjectPath.CANONICAL_FORMAT), PortalObjectPath.CANONICAL_FORMAT));
- assertEquals(new PortalObjectPath(new String[]{"\\.a.b/", "\\c"}), PortalObjectPath.parse(new PortalObjectPath(new String[]{"\\.a.b/", "\\c"}).toString(PortalObjectPath.CANONICAL_FORMAT), PortalObjectPath.CANONICAL_FORMAT));
- assertEquals(new PortalObjectPath(new String[]{"/"}), PortalObjectPath.parse(new PortalObjectPath(new String[]{"/"}).toString(PortalObjectPath.CANONICAL_FORMAT), PortalObjectPath.CANONICAL_FORMAT));
+ String a = "a.b";
+ String b = "c";
+ PortalObjectPath pop1 = new PortalObjectPath(new String[]{a, b});
+ PortalObjectPath pop2 = PortalObjectPath.parse(new PortalObjectPath(new String[]{a, b}).toString(PortalObjectPath.CANONICAL_FORMAT), PortalObjectPath.CANONICAL_FORMAT);
+ assertEquals(pop1.toString(PortalObjectPath.CANONICAL_FORMAT), pop2.toString(PortalObjectPath.CANONICAL_FORMAT));
+
+ a = ".a.b";
+ b = "c";
+ pop1 = new PortalObjectPath(new String[]{a, b});
+ pop2 = PortalObjectPath.parse(new PortalObjectPath(new String[]{a, b}).toString(PortalObjectPath.CANONICAL_FORMAT), PortalObjectPath.CANONICAL_FORMAT);
+ assertEquals(pop1.toString(PortalObjectPath.CANONICAL_FORMAT), pop2.toString(PortalObjectPath.CANONICAL_FORMAT));
+
+ a = "\\.a.b/";
+ b = "\\c";
+ pop1 = new PortalObjectPath(new String[]{a, b});
+ pop2 = PortalObjectPath.parse(new PortalObjectPath(new String[]{a, b}).toString(PortalObjectPath.CANONICAL_FORMAT), PortalObjectPath.CANONICAL_FORMAT);
+ assertEquals(pop1.toString(PortalObjectPath.CANONICAL_FORMAT), pop2.toString(PortalObjectPath.CANONICAL_FORMAT));
+
+ a = "/";
+ pop1 = new PortalObjectPath(new String[]{a});
+ pop2 = PortalObjectPath.parse(new PortalObjectPath(new String[]{a}).toString(PortalObjectPath.CANONICAL_FORMAT), PortalObjectPath.CANONICAL_FORMAT);
+ assertEquals(pop1.toString(PortalObjectPath.CANONICAL_FORMAT), pop2.toString(PortalObjectPath.CANONICAL_FORMAT));
+
//
try
{
@@ -171,10 +190,23 @@
assertEquals(new PortalObjectPath(new String[]{"a"}), PortalObjectPath.parse("a", PortalObjectPath.LEGACY_FORMAT));
assertEquals(new PortalObjectPath(new String[]{"a","b"}), PortalObjectPath.parse("a.b", PortalObjectPath.LEGACY_FORMAT));
+ String a = "a.b";
+ String b = "c";
+ PortalObjectPath pop1 = new PortalObjectPath(new String[]{a, b});
+ PortalObjectPath pop2 = PortalObjectPath.parse(new PortalObjectPath(new String[]{a, b}).toString(PortalObjectPath.LEGACY_FORMAT), PortalObjectPath.LEGACY_FORMAT);
+ assertEquals(pop1.toString(PortalObjectPath.LEGACY_FORMAT), pop2.toString(PortalObjectPath.LEGACY_FORMAT));
- assertEquals(new PortalObjectPath(new String[]{"a.b", "c"}), PortalObjectPath.parse(new PortalObjectPath(new String[]{"a.b", "c"}).toString(PortalObjectPath.LEGACY_FORMAT), PortalObjectPath.LEGACY_FORMAT));
- assertEquals(new PortalObjectPath(new String[]{".a.b", "c"}), PortalObjectPath.parse(new PortalObjectPath(new String[]{".a.b", "c"}).toString(PortalObjectPath.LEGACY_FORMAT), PortalObjectPath.LEGACY_FORMAT));
- assertEquals(new PortalObjectPath(new String[]{"\\.a.b/", "\\c"}), PortalObjectPath.parse(new PortalObjectPath(new String[]{"\\.a.b/", "\\c"}).toString(PortalObjectPath.LEGACY_FORMAT), PortalObjectPath.LEGACY_FORMAT));
+ a = ".a.b";
+ b = "c";
+ pop1 = new PortalObjectPath(new String[]{a, b});
+ pop2 = PortalObjectPath.parse(new PortalObjectPath(new String[]{a, b}).toString(PortalObjectPath.LEGACY_FORMAT), PortalObjectPath.LEGACY_FORMAT);
+ assertEquals(pop1.toString(PortalObjectPath.LEGACY_FORMAT), pop2.toString(PortalObjectPath.LEGACY_FORMAT));
+
+ a = "\\.a.b/";
+ b = "\\c";
+ pop1 = new PortalObjectPath(new String[]{a, b});
+ pop2 = PortalObjectPath.parse(new PortalObjectPath(new String[]{a, b}).toString(PortalObjectPath.LEGACY_FORMAT), PortalObjectPath.LEGACY_FORMAT);
+ assertEquals(pop1.toString(PortalObjectPath.LEGACY_FORMAT), pop2.toString(PortalObjectPath.LEGACY_FORMAT));
}
public void testEquals()
18 years, 8 months
JBoss Portal SVN: r8047 - in trunk: core/src/main/org/jboss/portal/core/model/portal and 2 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-08-24 16:52:39 -0400 (Fri, 24 Aug 2007)
New Revision: 8047
Modified:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/AdminPropertyResolver.java
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/Refresher.java
trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/objectNavigation.xhtml
trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObject.java
Log:
- JBPORTAL-1644: Works only partially as I haven't been able to refresh the current page without causing instability in the functionality (i.e. after a while, clicking on Make default links results in seemingly random behavior with the id request parameter passed to PortalObjectManagerBean not corresponding to the clicked link).
- Added default property on PortalObject via AdminPropertyResolver.
- Made PortalObject comparable to support for children ordering.
Modified: trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java 2007-08-23 08:04:55 UTC (rev 8046)
+++ trunk/core/src/main/org/jboss/portal/core/impl/model/portal/PortalObjectImpl.java 2007-08-24 20:52:39 UTC (rev 8047)
@@ -33,11 +33,13 @@
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeMap;
+import java.util.TreeSet;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -71,7 +73,7 @@
private Map childrenMap;
private Map properties;
private Map unmodifiableProperties;
- private Set accessedChildren;
+ private SortedSet accessedChildren;
public PortalObjectImpl()
{
@@ -117,6 +119,13 @@
return objectNode.getPath();
}
+ public int compareTo(Object o)
+ {
+ PortalObject po = (PortalObject)o;
+
+ return getId().compareTo(po.getId());
+ }
+
public void destroyChild(String name) throws NoSuchPortalObjectException
{
objectNode.removeChild(name);
@@ -262,7 +271,8 @@
public ChildrenIterator()
{
- Map childrenMap = objectNode.getChildren();
+ // Make sure the children are sorted for consistent ordering downstream
+ Map childrenMap = new TreeMap(objectNode.getChildren());
Collection children = childrenMap.values();
iterator = children.iterator();
}
@@ -390,7 +400,7 @@
{
if (accessedChildren == null)
{
- accessedChildren = new HashSet();
+ accessedChildren = new TreeSet();
}
return accessedChildren;
}
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObject.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObject.java 2007-08-23 08:04:55 UTC (rev 8046)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObject.java 2007-08-24 20:52:39 UTC (rev 8047)
@@ -31,7 +31,7 @@
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
-public interface PortalObject
+public interface PortalObject extends Comparable
{
/** Portal property name that indicates the name of the default portal to lookup. */
@@ -95,7 +95,7 @@
/**
* Set a listener id.
*
- * @param listener the listener id
+ * @param listener the listener id
*/
void setListener(String listener);
@@ -132,7 +132,7 @@
*
* @param name the child name
* @throws NoSuchPortalObjectException if the child does not exist
- * @throws IllegalArgumentException if the name argument is null
+ * @throws IllegalArgumentException if the name argument is null
*/
void destroyChild(String name) throws NoSuchPortalObjectException, IllegalArgumentException;
@@ -140,11 +140,11 @@
* Copy the portal object as a child of the specified object.
*
* @param parent the parent of the copy
- * @param name the name of the child
- * @param deep true copies recursively children
+ * @param name the name of the child
+ * @param deep true copies recursively children
* @return the newly created node child of the specified parent
* @throws DuplicatePortalObjectException if the specified parent has already a node with such a name
- * @throws IllegalArgumentException if the specified parent is null
+ * @throws IllegalArgumentException if the specified parent is null
*/
PortalObject copy(PortalObject parent, String name, boolean deep) throws DuplicatePortalObjectException, IllegalArgumentException;
@@ -159,7 +159,7 @@
/**
* Returns a read only map that contains the object properties.
*
- * @return a map of the object properties
+ * @return a map of the object properties
*/
Map getProperties();
@@ -174,7 +174,7 @@
/**
* Update a property declared on that object.
*
- * @param name the property name
+ * @param name the property name
* @param value the property value
* @throws IllegalArgumentException if the name argument is null
*/
@@ -183,7 +183,7 @@
/**
* Return a map that contains the object declared properties.
*
- * @return a map of the properties declared by the object
+ * @return a map of the properties declared by the object
*/
Map getDeclaredProperties();
Modified: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/AdminPropertyResolver.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/AdminPropertyResolver.java 2007-08-23 08:04:55 UTC (rev 8046)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/AdminPropertyResolver.java 2007-08-24 20:52:39 UTC (rev 8047)
@@ -22,48 +22,48 @@
******************************************************************************/
package org.jboss.portal.core.admin.ui;
-import org.jboss.portal.faces.el.decorator.SimpleBeanDecorator;
+import org.jboss.portal.common.i18n.LocalizedString;
+import org.jboss.portal.common.util.IteratorStatus;
+import org.jboss.portal.common.util.MediaType;
+import org.jboss.portal.core.impl.model.content.ContentProviderRegistryService;
+import org.jboss.portal.core.model.content.ContentType;
+import org.jboss.portal.core.model.content.spi.portlet.ContentPortlet;
+import org.jboss.portal.core.model.instance.Instance;
+import org.jboss.portal.core.model.portal.PortalObject;
+import org.jboss.portal.core.model.portal.PortalObjectId;
+import org.jboss.portal.core.model.portal.PortalObjectPath;
+import org.jboss.portal.faces.el.DelegatingPropertyResolver;
+import org.jboss.portal.faces.el.decorator.AbstractBeanDecorator;
import org.jboss.portal.faces.el.decorator.AbstractPropertyDecorator;
-import org.jboss.portal.faces.el.decorator.AbstractBeanDecorator;
import org.jboss.portal.faces.el.decorator.PropertyDecorator;
-import org.jboss.portal.faces.el.DelegatingPropertyResolver;
+import org.jboss.portal.faces.el.decorator.SimpleBeanDecorator;
+import org.jboss.portal.identity.IdentityException;
import org.jboss.portal.identity.RoleModule;
-import org.jboss.portal.identity.IdentityException;
-import org.jboss.portal.common.i18n.LocalizedString;
-import org.jboss.portal.common.util.IteratorStatus;
-import org.jboss.portal.common.util.MediaType;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.info.MetaInfo;
import org.jboss.portal.portlet.info.PortletInfo;
-import org.jboss.portal.core.model.instance.Instance;
-import org.jboss.portal.core.model.portal.PortalObject;
-import org.jboss.portal.core.model.portal.PortalObjectId;
-import org.jboss.portal.core.model.portal.PortalObjectPath;
-import org.jboss.portal.core.model.content.ContentType;
-import org.jboss.portal.core.model.content.spi.portlet.ContentPortlet;
-import org.jboss.portal.core.impl.model.content.ContentProviderRegistryService;
import org.jboss.portal.security.AuthorizationDomainRegistry;
import org.jboss.portal.security.spi.provider.AuthorizationDomain;
import org.jboss.portal.theme.LayoutService;
import org.jboss.portal.theme.PortalLayout;
-import org.jboss.portal.theme.ThemeService;
+import org.jboss.portal.theme.PortalRenderSet;
import org.jboss.portal.theme.PortalTheme;
import org.jboss.portal.theme.ServerRegistrationID;
-import org.jboss.portal.theme.PortalRenderSet;
+import org.jboss.portal.theme.ThemeService;
import javax.faces.context.FacesContext;
+import javax.faces.el.PropertyResolver;
import javax.faces.model.SelectItem;
-import javax.faces.el.PropertyResolver;
-import java.util.Set;
-import java.util.Locale;
import java.util.ArrayList;
-import java.util.List;
import java.util.Collection;
-import java.util.Map;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
-import java.util.Collections;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -216,6 +216,7 @@
{
return new ArrayList(object.getChildren(mask));
}
+
{
setProperty("portals", new AbstractPropertyDecorator(PortalObject.class)
{
@@ -262,6 +263,22 @@
return id.toString(PortalObjectPath.LEGACY_BASE64_FORMAT);
}
});
+ portalObjectDecorator.setProperty("default", new AbstractPropertyDecorator(PortalObject.class)
+ {
+ public Object getValue(Object bean)
+ {
+ PortalObject object = (PortalObject)bean;
+
+ // get the parent, if parent doesn't exist, consider the object as its own parent
+ PortalObject portalObject = object.getParent();
+ if (portalObject == null)
+ {
+ portalObject = object;
+ }
+
+ return Boolean.valueOf(object.getName().equals(portalObject.getDeclaredProperty(PortalObject.PORTAL_PROP_DEFAULT_OBJECT_NAME)));
+ }
+ });
registerDecorator(PortalObject.class, portalObjectDecorator);
//
@@ -305,7 +322,7 @@
LayoutService layoutService = (LayoutService)bean;
Collection layouts = layoutService.getLayouts();
SelectItem[] items = new SelectItem[layouts.size() + 1];
- for (IteratorStatus i = new IteratorStatus(layouts.iterator());i.hasNext();)
+ for (IteratorStatus i = new IteratorStatus(layouts.iterator()); i.hasNext();)
{
PortalLayout layout = (PortalLayout)i.next();
SelectItem item = new SelectItem();
@@ -355,7 +372,7 @@
ThemeService layoutService = (ThemeService)bean;
Collection themes = layoutService.getThemes();
SelectItem[] items = new SelectItem[themes.size() + 1];
- for (IteratorStatus i = new IteratorStatus(themes.iterator());i.hasNext();)
+ for (IteratorStatus i = new IteratorStatus(themes.iterator()); i.hasNext();)
{
PortalTheme name = (PortalTheme)i.next();
SelectItem item = new SelectItem();
Modified: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java 2007-08-23 08:04:55 UTC (rev 8046)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java 2007-08-24 20:52:39 UTC (rev 8047)
@@ -22,22 +22,6 @@
******************************************************************************/
package org.jboss.portal.core.admin.ui;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.faces.application.FacesMessage;
-import javax.faces.context.FacesContext;
-import javax.faces.event.ActionEvent;
-import javax.faces.model.SelectItem;
-
import org.jboss.portal.core.admin.ui.actions.AddPageAction;
import org.jboss.portal.core.admin.ui.actions.PropertyAction;
import org.jboss.portal.core.admin.ui.common.PageManagerBean;
@@ -64,13 +48,28 @@
import org.jboss.portal.theme.LayoutService;
import org.jboss.portal.theme.ThemeService;
+import javax.faces.application.FacesMessage;
+import javax.faces.context.FacesContext;
+import javax.faces.event.ActionEvent;
+import javax.faces.model.SelectItem;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
/** The portal object manager bean. */
public class PortalObjectManagerBean implements Serializable, AddPageAction.Listener
{
/** The serialVersionUID */
private static final long serialVersionUID = -8923517554726982622L;
-
+
/** . */
private static final String CONTENT_URI = "content.uri";
@@ -363,7 +362,14 @@
public void selectObject(PortalObject po)
{
- selectObject(po.getId());
+ if (po != null)
+ {
+ selectObject(po.getId());
+ }
+ else
+ {
+ selectObject((PortalObjectId)null);
+ }
}
private void selectObject(PortalObjectId id)
@@ -389,16 +395,54 @@
selectObject();
}
+ public String makeObjectDefault()
+ {
+ PortalObjectId poid = getSelectedPortalObjectId();
+ PortalObject object = portalObjectContainer.getObject(poid);
+ if (object != null)
+ {
+ String typeName;
+ int type = object.getType();
+ if (type == PortalObject.TYPE_PORTAL || type == PortalObject.TYPE_CONTEXT)
+ {
+ typeName = "portal";
+ }
+ else if (type == PortalObject.TYPE_PAGE)
+ {
+ typeName = "page";
+ }
+ else
+ {
+ throw new IllegalArgumentException("Invalid object type to set as default");
+ }
+
+ // select the object for now as trying to re-display the page results in apparently random behavior
+ // i.e. id parameter don't correspond to what they should be based on the clicked link
+ // comment the next line to try it out for yourself...
+ selectObject(poid);
+
+ PortalObject parent = object.getParent();
+ if (parent != null)
+ {
+ String name = object.getName();
+ parent.setDeclaredProperty(PortalObject.PORTAL_PROP_DEFAULT_OBJECT_NAME, name);
+
+
+ FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, "Success",
+ "'" + name + "'" + typeName + " was successfully set as default " + typeName);
+ FacesContext.getCurrentInstance().addMessage("status", message);
+ }
+ }
+
+ return null;
+ }
+
public String selectObject()
{
try
{
- // Get id
- Map pmap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
- String id = (String)pmap.get("id");
+ PortalObjectId poid = getSelectedPortalObjectId();
- // Set the state from the id
- PortalObjectId poid = PortalObjectId.parse(id, PortalObjectPath.LEGACY_BASE64_FORMAT);
PortalObject object = portalObjectContainer.getObject(poid);
// Update state if possible
@@ -437,10 +481,20 @@
return "objects";
}
- public void selectPlugin()
+ private PortalObjectId getSelectedPortalObjectId()
{
// Get id
Map pmap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
+ String id = (String)pmap.get("id");
+
+ // Set the state from the id
+ return PortalObjectId.parse(id, PortalObjectPath.LEGACY_BASE64_FORMAT);
+ }
+
+ public void selectPlugin()
+ {
+ // Get plugin
+ Map pmap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
selectedPlugin = (String)pmap.get("plugin");
}
@@ -709,6 +763,7 @@
/**
* Helper method to recognize object type in EL easily
+ *
* @return
*/
public String getSelectedObjectType()
@@ -716,7 +771,7 @@
PortalObject object = getSelectedObject();
if (object != null)
{
- switch(object.getType())
+ switch (object.getType())
{
case PortalObject.TYPE_CONTEXT:
return "context";
Modified: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/Refresher.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/Refresher.java 2007-08-23 08:04:55 UTC (rev 8046)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/Refresher.java 2007-08-24 20:52:39 UTC (rev 8047)
@@ -47,54 +47,43 @@
public void beforePhase(PhaseEvent phaseEvent)
{
+ FacesContext ctx = phaseEvent.getFacesContext();
+
if (phaseEvent.getPhaseId() == PhaseId.RESTORE_VIEW)
{
- FacesContext ctx = phaseEvent.getFacesContext();
+ refreshFrom(ctx);
//
- PortalObjectManagerBean pomgr = (PortalObjectManagerBean)ctx.getApplication().createValueBinding("#{portalobjectmgr}").getValue(ctx);
- pomgr.refresh();
-
- //
- PortalObjectManagerBean dashboardmgr = (PortalObjectManagerBean)ctx.getApplication().createValueBinding("#{dashboardmgr}").getValue(ctx);
- dashboardmgr.refresh();
-
- //
- InstanceManagerBean instancemgr = (InstanceManagerBean)ctx.getApplication().createValueBinding("#{instancemgr}").getValue(ctx);
- instancemgr.refresh();
-
- //
- PortletManagerBean portletmgr = (PortletManagerBean)ctx.getApplication().createValueBinding("#{portletmgr}").getValue(ctx);
- portletmgr.refresh();
-
- //
DashboardBean dashboard = (DashboardBean)ctx.getApplication().createValueBinding("#{dashboard}").getValue(ctx);
dashboard.actionRefresh();
}
else if (phaseEvent.getPhaseId() == PhaseId.RENDER_RESPONSE)
{
- FacesContext ctx = phaseEvent.getFacesContext();
+ refreshFrom(ctx);
//
- PortalObjectManagerBean pomgr = (PortalObjectManagerBean)ctx.getApplication().createValueBinding("#{portalobjectmgr}").getValue(ctx);
- pomgr.refresh();
+ DashboardBean dashboard = (DashboardBean)ctx.getApplication().createValueBinding("#{dashboard}").getValue(ctx);
+ dashboard.renderRefresh();
+ }
+ }
- //
- PortalObjectManagerBean dashboardmgr = (PortalObjectManagerBean)ctx.getApplication().createValueBinding("#{dashboardmgr}").getValue(ctx);
- dashboardmgr.refresh();
+ private void refreshFrom(FacesContext ctx)
+ {
+ //
+ PortalObjectManagerBean pomgr = (PortalObjectManagerBean)ctx.getApplication().createValueBinding("#{portalobjectmgr}").getValue(ctx);
+ pomgr.refresh();
- //
- InstanceManagerBean instancemgr = (InstanceManagerBean)ctx.getApplication().createValueBinding("#{instancemgr}").getValue(ctx);
- instancemgr.refresh();
+ //
+ PortalObjectManagerBean dashboardmgr = (PortalObjectManagerBean)ctx.getApplication().createValueBinding("#{dashboardmgr}").getValue(ctx);
+ dashboardmgr.refresh();
- //
- PortletManagerBean portletmgr = (PortletManagerBean)ctx.getApplication().createValueBinding("#{portletmgr}").getValue(ctx);
- portletmgr.refresh();
+ //
+ InstanceManagerBean instancemgr = (InstanceManagerBean)ctx.getApplication().createValueBinding("#{instancemgr}").getValue(ctx);
+ instancemgr.refresh();
- //
- DashboardBean dashboard = (DashboardBean)ctx.getApplication().createValueBinding("#{dashboard}").getValue(ctx);
- dashboard.renderRefresh();
- }
+ //
+ PortletManagerBean portletmgr = (PortletManagerBean)ctx.getApplication().createValueBinding("#{portletmgr}").getValue(ctx);
+ portletmgr.refresh();
}
public PhaseId getPhaseId()
Modified: trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/objectNavigation.xhtml
===================================================================
--- trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/objectNavigation.xhtml 2007-08-23 08:04:55 UTC (rev 8046)
+++ trunk/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/objectNavigation.xhtml 2007-08-24 20:52:39 UTC (rev 8047)
@@ -34,20 +34,29 @@
actionListener="#{portalobjectmgr.selectObject}">
<h:outputText value="Properties"/>
<f:param name="id" value="#{object.id}"/>
- </h:commandLink> | <h:commandLink action="editPortalTheme"
- actionListener="#{portalobjectmgr.selectObject}">
+ </h:commandLink> | <h:commandLink action="editPortalTheme" actionListener="#{portalobjectmgr.selectObject}">
<h:outputText value="Theme"/>
<f:param name="id" value="#{object.id}"/>
- </h:commandLink><h:panelGroup
- rendered="#{(object.name != 'admin') and (object.name != 'template') and (object.name != 'default')}"> |
- <h:commandLink action="renameObject" actionListener="#{portalobjectmgr.selectObject}">
+ </h:commandLink>
+ <h:panelGroup
+ rendered="#{(object.name != 'admin') and (object.name != 'template') and (object.name != 'default')}">
+ | <h:commandLink action="renameObject" actionListener="#{portalobjectmgr.selectObject}">
<h:outputText value="Rename"/>
<f:param name="id" value="#{object.id}"/>
- </h:commandLink></h:panelGroup> | <h:commandLink action="confirm"
- actionListener="#{portalobjectmgr.selectObject}">
+ </h:commandLink>
+ </h:panelGroup> | <h:commandLink action="confirm" actionListener="#{portalobjectmgr.selectObject}">
<h:outputText value="Delete"/>
<f:param name="id" value="#{object.id}"/>
</h:commandLink>
+ <c:choose>
+ <c:when test="#{not object.default}"> | <h:commandLink action="#{portalobjectmgr.makeObjectDefault}">
+ <h:outputText value="Make Default"/>
+ <f:param name="id" value="#{object.id}"/>
+ </h:commandLink>
+ </c:when>
+ <c:otherwise> | <h:outputText value="Default"/>
+ </c:otherwise>
+ </c:choose>
</td>
</tr>
</c:forEach>
@@ -91,6 +100,15 @@
<h:outputText value="Delete"/>
<f:param name="id" value="#{object.id}"/>
</h:commandLink>
+ <c:choose>
+ <c:when test="#{not object.default}"> | <h:commandLink action="#{portalobjectmgr.makeObjectDefault}">
+ <h:outputText value="Make Default"/>
+ <f:param name="id" value="#{object.id}"/>
+ </h:commandLink>
+ </c:when>
+ <c:otherwise> | <h:outputText value="Default"/>
+ </c:otherwise>
+ </c:choose>
</td>
</tr>
</c:forEach>
18 years, 8 months
JBoss Portal SVN: r8046 - in branches/JBoss_Portal_Branch_2_6: identity/src/main/org/jboss/portal/identity and 1 other directory.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-08-23 04:04:55 -0400 (Thu, 23 Aug 2007)
New Revision: 8046
Removed:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/IdentityServiceControllerImpl.java
Modified:
branches/JBoss_Portal_Branch_2_6/core/build.xml
Log:
outps... fix the build
Modified: branches/JBoss_Portal_Branch_2_6/core/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/build.xml 2007-08-23 06:49:51 UTC (rev 8045)
+++ branches/JBoss_Portal_Branch_2_6/core/build.xml 2007-08-23 08:04:55 UTC (rev 8046)
@@ -133,6 +133,7 @@
<path refid="jboss.portal-jems.classpath"/>
<path refid="jboss.portal-portlet-federation.classpath"/>
<path refid="jboss.portal-identity.classpath"/>
+ <path refid="jboss.portal-jems.classpath"/>
<path refid="jboss.portlet-api.classpath"/>
<path refid="jboss.portal-theme.classpath"/>
<path refid="jboss.portal-security.classpath"/>
Deleted: branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/IdentityServiceControllerImpl.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/IdentityServiceControllerImpl.java 2007-08-23 06:49:51 UTC (rev 8045)
+++ branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/IdentityServiceControllerImpl.java 2007-08-23 08:04:55 UTC (rev 8046)
@@ -1,619 +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;
-
-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.event.IdentityEventBroadcaster;
-import org.jboss.portal.identity.event.IdentityEvent;
-import org.jboss.portal.identity.config.metadata.IdentityConfigurationMetaData;
-import org.jboss.portal.identity.config.metadata.ModuleMetaData;
-import org.jboss.portal.identity.config.metadata.ConfigOptionMetaData;
-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.config.metadata.DatasourceMetaData;
-import org.jboss.portal.identity.config.metadata.ConfigurationParser;
-import org.jboss.portal.identity.service.IdentityModuleService;
-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 org.jboss.beans.metadata.plugins.AbstractPropertyMetaData;
-
-import javax.management.ObjectName;
-import java.util.Map;
-import java.util.Iterator;
-import java.util.HashMap;
-import java.util.List;
-import java.util.ArrayList;
-
-/**
- * @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 List beans;
-
-
-
- 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();
- beans = new ArrayList();
- }
- catch (Exception e)
- {
- throw new IdentityException(e);
- }
-
- ClassLoader tcl = Thread.currentThread().getContextClassLoader();
-
- //parse config files
- IdentityConfigurationMetaData meta = ConfigurationParser.parseIdentityConfiguration(configFile);
- IdentityConfigurationMetaData defaultMeta = ConfigurationParser.parseIdentityConfiguration(defaultConfigFile);
-
- KernelControllerContext identityKernelContext;
- try
- {
- AbstractBeanMetaData contextBMD = new AbstractBeanMetaData(
- "portal:identity=IdentityContext",
- IdentityContextImpl.class.getName());
- beans.add(contextBMD);
- identityKernelContext = kernel.getController().install(contextBMD);
- identityContext = (IdentityContext)identityKernelContext.getTarget();
-
- }
- catch (Throwable throwable)
- {
- throw new IdentityException("Unable to install IdentityContext",throwable);
- }
-
-
- // 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);
- }
-
-
- //create detault modules set
-
- //Map[implementation] --> Map[Type] --> ModuleMetaData
- Map defaultImplementations = new HashMap();
-
- //update modules data with defaults
- try
- {
- List defaultModules = defaultMeta.getModules().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);
- }
-
- //map default datasources by name
- Map defaultDatasources = new HashMap();
- for (Iterator iterator = defaultMeta.getDatasources().getDatasources().iterator(); iterator.hasNext();)
- {
- DatasourceMetaData ds = (DatasourceMetaData)iterator.next();
- defaultDatasources.put(ds.getName(), ds);
-
- }
-
- //process the list of modules, instantiate them, configure them, tide them
- try
- {
- List datasources = meta.getDatasources().getDatasources();
- List modules = meta.getModules().getModules();
-
- //inject configuration service
- IdentityConfigurationService configuration = new IdentityConfigurationService(meta.getOptions());
- configuration.setIdentityContext(identityContext);
-
- //TODO:set proper jndiName and serviceName
- configuration.start();
-
- //update options with defaults
- updateOptionsWithDefaults(configuration, defaultMeta.getOptions());
-
- //process datasources
- for (Iterator iterator = datasources.iterator(); iterator.hasNext();)
- {
- DatasourceMetaData ds = (DatasourceMetaData)iterator.next();
- if (log.isDebugEnabled()) log.debug("processing datasource: " + ds.getName() + "/" + ds.getClassName());
- log.info("Installing datasourc: " + ds.getName());
- 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());
- }
-
- //instantiate the module
- //IdentityModuleService moduleService = null;
-
-
- if (ds.getClassName() == null)
- {
- throw new IdentityException("Class name not found for datasource type: " + ds.getName() + " wrong configuration");
- }
-
- /*try
- {
- moduleService = (IdentityModuleService)tcl.loadClass(module.getClassName()).newInstance();
- }
- catch (Exception e)
- {
- throw new IdentityException("Unable to instantiate the class: " + module.getClassName() );
- }*/
-
- //instantiate datasource using MC
- String entryName = "portal:identity=Datasource,type=" + ds.getName();
- AbstractBeanMetaData dsBMD = new AbstractBeanMetaData(entryName,
- ds.getClassName());
- //AbstractPropertyMetaData propertyBMD = new AbstractPropertyMetaData("identityContext", identityContext);
- //moduleBMD.addProperty(propertyBMD);
-
- //initiate parameters from <config>
- for (Iterator iterator1 = optionMap.keySet().iterator(); iterator1.hasNext();)
- {
- String propertyKey = (String)iterator1.next();
- String propertyValue = (String)optionMap.get(propertyKey);
- if (log.isDebugEnabled()) log.debug("adding parameter: " + propertyKey + " ; " + propertyValue);
- AbstractPropertyMetaData propertyBMD = new AbstractPropertyMetaData(propertyKey, propertyValue);
- dsBMD.addProperty(propertyBMD);
- }
-
- // Installation
- beans.add(dsBMD);
- KernelControllerContext controllerContext = kernel.getController().install(dsBMD);
- Object datasource = controllerContext.getTarget();
-
- //make a part of identityContext
- //moduleService.setIdentityContext(identityContext);
-
- //register as an mbean
- if (isRegisterMBeans() && (ds.getServiceName() != null))
- {
- //getServer().registerMBean(moduleService, new ObjectName(module.getServiceName()));
- JBossServiceModelMBean mbean = new JBossServiceModelMBean(datasource);
- //serviceName = new ObjectName("portal:container=WebApp,id=" + portletAppMD.getId());
- //mbeanServer.registerMBean(mbean, serviceName);
- getServer().registerMBean(mbean, new ObjectName(ds.getServiceName()));
-
- }
-
-
- }
-
-
-
- //process modules for instantiation
- for (Iterator iterator = modules.iterator(); iterator.hasNext();)
- {
-
- ModuleMetaData module = (ModuleMetaData)iterator.next();
- log.info("Processing module: " + module.getType() + "/" + module.getImplementation());// + "/" + module.getClassName());
-
- 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");
- }
-
- /*try
- {
- moduleService = (IdentityModuleService)tcl.loadClass(module.getClassName()).newInstance();
- }
- catch (Exception e)
- {
- throw new IdentityException("Unable to instantiate the class: " + module.getClassName() );
- }*/
-
- //instantiate module using MC
- String entryName = "portal:identity=Module,type=" + module.getType();
- AbstractBeanMetaData moduleBMD = new AbstractBeanMetaData(entryName,
- module.getClassName());
- AbstractPropertyMetaData propertyBMD = new AbstractPropertyMetaData("identityContext", identityContext);
- moduleBMD.addProperty(propertyBMD);
-
- //initiate parameters from <config>
- for (Iterator iterator1 = optionMap.keySet().iterator(); iterator1.hasNext();)
- {
- String propertyKey = (String)iterator1.next();
- String propertyValue = (String)optionMap.get(propertyKey);
- if (log.isDebugEnabled()) log.debug("adding parameter: " + propertyKey + " ; " + propertyValue);
- propertyBMD = new AbstractPropertyMetaData(propertyKey, propertyValue);
- moduleBMD.addProperty(propertyBMD);
- }
-
- //make the type from name
- propertyBMD = new AbstractPropertyMetaData("moduleType", module.getType());
- moduleBMD.addProperty(propertyBMD);
-
-
- // Installation
- beans.add(moduleBMD);
- KernelControllerContext controllerContext = kernel.getController().install(moduleBMD);
- Object moduleService = (IdentityModuleService)controllerContext.getTarget();
-
- //make a part of identityContext
- //moduleService.setIdentityContext(identityContext);
-
- //register as an mbean
- if (isRegisterMBeans() && (module.getServiceName() != null))
- {
- //getServer().registerMBean(moduleService, new ObjectName(module.getServiceName()));
- JBossServiceModelMBean mbean = new JBossServiceModelMBean(moduleService);
- //serviceName = new ObjectName("portal:container=WebApp,id=" + portletAppMD.getId());
- //mbeanServer.registerMBean(mbean, serviceName);
- getServer().registerMBean(mbean, new ObjectName(module.getServiceName()));
-
- }
- }
-
-
- }
- catch (Throwable e)
- {
- throw new IdentityException("Cannot initiate identity modules: ", e);
- }
- }
-
-
- protected void stopService() throws Exception
- {
- if (jndiBinding != null)
- {
- jndiBinding.unbind();
- jndiBinding = null;
- }
-
- }
-
-
-
-
- /**
- * updates module with proper defaults
- *
- * @param module
- * @param defaultModules
- */
- private 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
- */
- private void updateDatasourceWithDefaults(DatasourceMetaData ds, Map defaultDS)
- {
- if (ds.getName() == null)
- {
- return;
- }
- if (!defaultDS.containsKey(ds.getName()))
- {
- return;
- }
- DatasourceMetaData def = (DatasourceMetaData)defaultDS.get(ds.getName());
- if (ds.getClassName() == null)
- {
- ds.setClassName(def.getClassName());
- }
- if (ds.getServiceName() == null)
- {
- ds.setServiceName(def.getServiceName());
- }
-
- //now check if config options are overwritten
- if (ds.getConfig() == null)
- {
- ds.setConfig(def.getConfig());
- }
- else
- {
- Map dsOptions = ds.getConfig().getOptions();
- if (dsOptions == null)
- {
- return;
- }
- Map defOptions = def.getConfig().getOptions();
-
- for (Iterator iterator = defOptions.keySet().iterator(); iterator.hasNext();)
- {
- String key = (String)iterator.next();
- if (!dsOptions.containsKey(key))
- {
- ConfigOptionMetaData o = (ConfigOptionMetaData)defOptions.get(key);
- ds.getConfig().addOption(o);
- }
- }
- }
- }
-
- /**
- * Check current options and update them with defaults if not exists;
- *
- * @param config
- * @param defaults
- */
- private 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());
- }
-
-
- }
- }
-
- }
-
- 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;
- }
-}
18 years, 8 months
JBoss Portal SVN: r8045 - in branches/2_6_CAS_Integration/identity: josso/config and 2 other directories.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2007-08-23 02:49:51 -0400 (Thu, 23 Aug 2007)
New Revision: 8045
Added:
branches/2_6_CAS_Integration/identity/src/main/org/jboss/portal/test/identity/sso/JOSSOTestCase.java
Modified:
branches/2_6_CAS_Integration/identity/build.xml
branches/2_6_CAS_Integration/identity/josso/config/josso-agent-config.xml
branches/2_6_CAS_Integration/identity/src/main/org/jboss/portal/test/identity/sso/CASTestCase.java
branches/2_6_CAS_Integration/identity/src/resources/portal-identity-test-jar/org/jboss/portal/test/identity/sso-beans.xml
Log:
JOSSO Integration Testing
Modified: branches/2_6_CAS_Integration/identity/build.xml
===================================================================
--- branches/2_6_CAS_Integration/identity/build.xml 2007-08-23 00:14:43 UTC (rev 8044)
+++ branches/2_6_CAS_Integration/identity/build.xml 2007-08-23 06:49:51 UTC (rev 8045)
@@ -554,16 +554,17 @@
</target>
<target name="tests-sso" depends="init,package-tests">
- <execute-tests>
- <!--
+ <execute-tests>
+ <!--
<x-sysproperty>
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y"/>
</x-sysproperty>
- -->
+ -->
<x-test>
<test todir="${test.reports}" name="org.jboss.portal.test.identity.sso.CASTestCase"/>
+ <test todir="${test.reports}" name="org.jboss.portal.test.identity.sso.JOSSOTestCase"/>
</x-test>
<x-classpath>
Modified: branches/2_6_CAS_Integration/identity/josso/config/josso-agent-config.xml
===================================================================
--- branches/2_6_CAS_Integration/identity/josso/config/josso-agent-config.xml 2007-08-23 00:14:43 UTC (rev 8044)
+++ branches/2_6_CAS_Integration/identity/josso/config/josso-agent-config.xml 2007-08-23 06:49:51 UTC (rev 8045)
@@ -11,5 +11,9 @@
<partner-app>
<context>/portal</context>
</partner-app>
+ <!-- used for testing purposes -->
+ <partner-app>
+ <context>/portal2</context>
+ </partner-app>
</partner-apps>
</agent>
Modified: branches/2_6_CAS_Integration/identity/src/main/org/jboss/portal/test/identity/sso/CASTestCase.java
===================================================================
--- branches/2_6_CAS_Integration/identity/src/main/org/jboss/portal/test/identity/sso/CASTestCase.java 2007-08-23 00:14:43 UTC (rev 8044)
+++ branches/2_6_CAS_Integration/identity/src/main/org/jboss/portal/test/identity/sso/CASTestCase.java 2007-08-23 06:49:51 UTC (rev 8045)
@@ -69,6 +69,7 @@
this.runtimeContext = new TestRuntimeContext("org/jboss/portal/test/identity/sso-beans.xml");
this.runtimeContext.addBean("CASConfig", this);
+ this.runtimeContext.addBean("JOSSOConfig", new JOSSOTestCase());
this.runtimeContext.start();
Added: branches/2_6_CAS_Integration/identity/src/main/org/jboss/portal/test/identity/sso/JOSSOTestCase.java
===================================================================
--- branches/2_6_CAS_Integration/identity/src/main/org/jboss/portal/test/identity/sso/JOSSOTestCase.java (rev 0)
+++ branches/2_6_CAS_Integration/identity/src/main/org/jboss/portal/test/identity/sso/JOSSOTestCase.java 2007-08-23 06:49:51 UTC (rev 8045)
@@ -0,0 +1,620 @@
+/******************************************************************************
+ * 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.sso;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.Iterator;
+import java.util.HashMap;
+
+import org.jboss.portal.test.framework.TestRuntimeContext;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.Cookie;
+import org.apache.commons.httpclient.NameValuePair;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.apache.commons.httpclient.protocol.Protocol;
+
+import junit.framework.TestCase;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class JOSSOTestCase extends TestCase
+{
+ /**
+ *
+ */
+ private String portalServer = null;
+ private String firstPortalContext = null;
+ private String secondPortalContext = null;
+ private String userLoggedInIndicator = null;
+ private String username = null;
+ private String password = null;
+
+ /**
+ *
+ */
+ protected TestRuntimeContext runtimeContext = null;
+
+ /**
+ *
+ */
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ this.runtimeContext = new TestRuntimeContext("org/jboss/portal/test/identity/sso-beans.xml");
+
+ this.runtimeContext.addBean("JOSSOConfig", this);
+ this.runtimeContext.addBean("CASConfig", new CASTestCase());
+
+ this.runtimeContext.start();
+
+ //SSL setup
+ Protocol.registerProtocol("https",new Protocol("https", new EasySSLProtocolSocketFactory(), 443));
+ }
+
+ /**
+ *
+ */
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+
+ //Service stoppage
+ this.runtimeContext.stop();
+
+ //Data cleanup
+ this.runtimeContext = null;
+ this.portalServer = null;
+ this.firstPortalContext = null;
+ this.secondPortalContext = null;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getFirstPortalContext()
+ {
+ return firstPortalContext;
+ }
+
+ /**
+ *
+ * @param firstPortalContext
+ */
+ public void setFirstPortalContext(String firstPortalContext)
+ {
+ this.firstPortalContext = firstPortalContext;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getPortalServer()
+ {
+ return portalServer;
+ }
+
+ /**
+ *
+ * @param portalServer
+ */
+ public void setPortalServer(String portalServer)
+ {
+ this.portalServer = portalServer;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getSecondPortalContext()
+ {
+ return secondPortalContext;
+ }
+
+ /**
+ *
+ * @param secondPortalContext
+ */
+ public void setSecondPortalContext(String secondPortalContext)
+ {
+ this.secondPortalContext = secondPortalContext;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getUserLoggedInIndicator()
+ {
+ return userLoggedInIndicator;
+ }
+
+ /**
+ *
+ * @param userLoggedInIndicator
+ */
+ public void setUserLoggedInIndicator(String userLoggedInIndicator)
+ {
+ this.userLoggedInIndicator = userLoggedInIndicator;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getPassword()
+ {
+ return password;
+ }
+
+ /**
+ *
+ * @param password
+ */
+ public void setPassword(String password)
+ {
+ this.password = password;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getUsername()
+ {
+ return username;
+ }
+
+ /**
+ *
+ * @param username
+ */
+ public void setUsername(String username)
+ {
+ this.username = username;
+ }
+
+ /**
+ *
+ * @throws Exception
+ */
+ public void test() throws Exception
+ {
+ Cookie ssoCookie = null;
+ String firstPortalFinalResponse = null;
+ String secondPortalFinalResponse = null;
+
+ //Load the main portal page on firstPortalContext
+ String firstContextPortalUrl = "http://"+this.portalServer+"/"+this.firstPortalContext;
+ WebConversation portalConversation = this.startConversation(firstContextPortalUrl);
+ TestCase.assertFalse(this.isUserLoggedIn(portalConversation.getResponse()));
+
+ //Click the Login link on the firstPortalContext
+ String firstContextLoginUrl = firstContextPortalUrl + "/auth/portal/default/default";
+ this.sendGet(firstContextLoginUrl, portalConversation);
+
+ //Navigate to a secured resource on the portal
+ TestCase.assertNotNull(portalConversation.getRedirectLocation());
+ TestCase.assertEquals(portalConversation.getStatusCode(), 302);
+ String portalToJOSSO = portalConversation.getRedirectLocation();
+ this.sendGet(portalToJOSSO, portalConversation);
+
+ //When authentication is triggered, move over to the JOSSO server establishing an SSO session with JOSSO
+ String jossoLocation = portalConversation.getRedirectLocation();
+ WebConversation ssoConversation = this.startConversation(jossoLocation);
+ String response = ssoConversation.getResponse();
+
+ //Extract the josso post action value
+ int searchIndex = response.indexOf("action=\"")+9;
+ int endIndex = response.indexOf('"', searchIndex);
+ String action = response.substring(searchIndex,endIndex);
+
+ //Perform HTTP Post based authentication with the JOSSO Server
+ Map postParams = new HashMap();
+ postParams.put("josso_username", this.username);
+ postParams.put("josso_password", this.password);
+ postParams.put("josso_cmd", "login");
+ this.sendPost("http://"+this.portalServer+"/"+action,postParams, ssoConversation);
+
+ //Go back to the Portal since login has succeeded, starting with assertion on the JOSSO Agent installed on the Portal
+ String assertUrl = ssoConversation.getRedirectLocation();
+ this.sendGet(assertUrl, portalConversation);
+
+ //Now go back to the original Portal resource requested. This time user should have an authenticated session established
+ TestCase.assertNotNull(portalConversation.getRedirectLocation());
+ TestCase.assertEquals(portalConversation.getStatusCode(), 302);
+ TestCase.assertTrue(portalConversation.getRedirectLocation().indexOf(firstContextLoginUrl) != -1);
+ TestCase.assertNotNull(portalConversation.getSSOCookie());
+ String goBack = portalConversation.getRedirectLocation();
+ ssoCookie = ssoConversation.getSSOCookie();
+ this.sendGet(goBack, portalConversation);
+ firstPortalFinalResponse = portalConversation.getResponse();
+ TestCase.assertTrue(this.isUserLoggedIn(firstPortalFinalResponse));
+
+ //Load the main portal page on secondPortalContext
+ String secondContextPortalUrl = "http://"+this.portalServer+"/"+this.secondPortalContext;
+ portalConversation = this.startConversation(secondContextPortalUrl);
+
+ //Click the Login Link on the secondPortalContext
+ String secondContextLoginUrl = secondContextPortalUrl + "/auth/portal/default/default";
+ this.sendGet(secondContextLoginUrl, portalConversation);
+
+ //Perform re-direct to the JOSSO Server but this time sending in the JOSSO cookie
+ TestCase.assertNotNull(portalConversation.getRedirectLocation());
+ TestCase.assertEquals(portalConversation.getStatusCode(), 302);
+ portalToJOSSO = portalConversation.getRedirectLocation();
+ this.sendGet(portalToJOSSO, portalConversation);
+
+
+ //Assert the redirect and it should be to the JOSSO Server, but this time
+ //It should end up with an Authenticated session back to the secondPortalContext
+ jossoLocation = portalConversation.getRedirectLocation();
+ ssoConversation = this.startConversation(jossoLocation,ssoCookie);
+ secondPortalFinalResponse = ssoConversation.getResponse();
+ TestCase.assertTrue(this.isUserLoggedIn(secondPortalFinalResponse));
+
+ //Assert and make sure its the same user logged into both Portals
+ String firstPortalUser = this.extractLoggedInUser(firstPortalFinalResponse);
+ String secondPortalUser = this.extractLoggedInUser(secondPortalFinalResponse);
+ TestCase.assertEquals(firstPortalUser, this.username);
+ TestCase.assertEquals(secondPortalUser, this.username);
+ TestCase.assertEquals(firstPortalUser, secondPortalUser);
+ }
+
+ /**
+ *
+ * @param portalUrl
+ * @return
+ * @throws Exception
+ */
+ private WebConversation startConversation(String portalUrl) throws Exception
+ {
+ WebConversation conversation = null;
+
+ HttpClient httpClient = new HttpClient();
+ GetMethod getMethod = new GetMethod(portalUrl);
+ try
+ {
+ conversation = new WebConversation();
+
+ int statusCode = httpClient.executeMethod(getMethod);
+ String response = getMethod.getResponseBodyAsString();
+
+ Cookie[] cookies = httpClient.getState().getCookies();
+ for(int i=0;i<cookies.length;i++)
+ {
+ if(cookies[i].getName().equals("JSESSIONID"))
+ {
+ conversation.setSessionId(cookies[i].getValue());
+ }
+ }
+
+ conversation.setClient(httpClient);
+ conversation.setStatusCode(statusCode);
+ conversation.setResponse(response);
+ }
+ finally
+ {
+ if(getMethod != null)
+ {
+ getMethod.releaseConnection();
+ }
+ }
+
+ return conversation;
+ }
+
+ /**
+ *
+ * @param portalUrl
+ * @return
+ * @throws Exception
+ */
+ private WebConversation startConversation(String portalUrl, Cookie ssoCookie) throws Exception
+ {
+ WebConversation conversation = null;
+
+ HttpClient httpClient = new HttpClient();
+ GetMethod getMethod = new GetMethod(portalUrl);
+
+ //Set ssoCookie to be sent in
+ getMethod.setRequestHeader("Cookie",ssoCookie.getName()+"="+ssoCookie.getValue());
+
+ try
+ {
+ conversation = new WebConversation();
+
+ int statusCode = httpClient.executeMethod(getMethod);
+ String response = getMethod.getResponseBodyAsString();
+
+ Cookie[] cookies = httpClient.getState().getCookies();
+ for(int i=0;i<cookies.length;i++)
+ {
+ if(cookies[i].getName().equals("JSESSIONID"))
+ {
+ conversation.setSessionId(cookies[i].getValue());
+ }
+ }
+
+ conversation.setClient(httpClient);
+ conversation.setStatusCode(statusCode);
+ conversation.setResponse(response);
+ }
+ finally
+ {
+ if(getMethod != null)
+ {
+ getMethod.releaseConnection();
+ }
+ }
+
+ return conversation;
+ }
+
+ /**
+ *
+ * @param portalUrl
+ * @param conversation
+ * @throws Exception
+ */
+ private void sendGet(String portalUrl,WebConversation conversation) throws Exception
+ {
+ HttpClient httpClient = conversation.getClient();
+
+ GetMethod getMethod = new GetMethod(portalUrl);
+ getMethod.setFollowRedirects(false);
+ try
+ {
+ int statusCode = httpClient.executeMethod(getMethod);
+
+ String response = getMethod.getResponseBodyAsString();
+
+ Cookie[] cookies = httpClient.getState().getCookies();
+ for(int i=0;i<cookies.length;i++)
+ {
+ if(cookies[i].getName().equals("JSESSIONID"))
+ {
+ conversation.setSessionId(cookies[i].getValue());
+ }
+ if(cookies[i].getName().equals("JOSSO_SESSIONID"))
+ {
+ conversation.setSSOCookie(cookies[i]);
+ }
+ }
+
+ conversation.setStatusCode(statusCode);
+ conversation.setResponse(response);
+
+ if(statusCode == 302)
+ {
+ //Store the redirect location
+ String location = getMethod.getResponseHeader("Location").getValue();
+ conversation.setRedirectLocation(location);
+ }
+ }
+ finally
+ {
+ if(getMethod != null)
+ {
+ getMethod.releaseConnection();
+ }
+ }
+ }
+
+
+ /**
+ *
+ * @param url
+ * @param parameters
+ * @param conversation
+ * @throws Exception
+ */
+ private void sendPost(String url,Map parameters,WebConversation conversation) throws Exception
+ {
+ HttpClient httpClient = conversation.getClient();
+
+ PostMethod postMethod = new PostMethod(url);
+
+ //Add post parameters
+ Set keySet = parameters.keySet();
+ NameValuePair[] postdata = new NameValuePair[keySet.size()];
+ int index = 0;
+ for(Iterator itr=keySet.iterator();itr.hasNext();)
+ {
+ String name = (String)itr.next();
+ String value = (String)parameters.get(name);
+ postdata[index++] = new NameValuePair(name,value);
+ }
+ postMethod.setRequestBody(postdata);
+ try
+ {
+ int statusCode = httpClient.executeMethod(postMethod);
+
+ String response = postMethod.getResponseBodyAsString();
+
+ Cookie[] cookies = httpClient.getState().getCookies();
+ for(int i=0;i<cookies.length;i++)
+ {
+ if(cookies[i].getName().equals("JSESSIONID"))
+ {
+ conversation.setSessionId(cookies[i].getValue());
+ }
+ if(cookies[i].getName().equals("JOSSO_SESSIONID"))
+ {
+ conversation.setSSOCookie(cookies[i]);
+ }
+ }
+
+ conversation.setStatusCode(statusCode);
+ conversation.setResponse(response);
+
+ if(statusCode == 302)
+ {
+ //Store the redirect location
+ String location = postMethod.getResponseHeader("Location").getValue();
+ conversation.setRedirectLocation(location);
+ }
+ }
+ finally
+ {
+ if(postMethod != null)
+ {
+ postMethod.releaseConnection();
+ }
+ }
+ }
+
+ /**
+ *
+ * @param response
+ * @return
+ */
+ private boolean isUserLoggedIn(String response)
+ {
+ boolean isUserLoggedIn = false;
+
+ isUserLoggedIn = (response.indexOf(this.userLoggedInIndicator) != -1);
+
+ return isUserLoggedIn;
+ }
+
+ /**
+ *
+ * @param response
+ * @return
+ */
+ private String extractLoggedInUser(String response)
+ {
+ String loggedInUser = null;
+
+ int startIndex = response.indexOf(this.userLoggedInIndicator) + this.userLoggedInIndicator.length();
+ int endIndex = response.indexOf("<",startIndex);
+
+ loggedInUser = response.substring(startIndex,endIndex).trim();
+
+ return loggedInUser;
+ }
+
+ /**
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+ private static class WebConversation
+ {
+ /**
+ *
+ */
+ private HttpClient client = null;
+ private String sessionId = null;
+ private int statusCode = 0;
+ private String response = null;
+ private String redirectLocation = null;
+ private Cookie ssoCookie = null;
+
+ /**
+ *
+ *
+ */
+ public WebConversation()
+ {
+
+ }
+
+ /**
+ *
+ * @return
+ */
+ public HttpClient getClient()
+ {
+ return this.client;
+ }
+
+ /**
+ *
+ * @param client
+ */
+ public void setClient(HttpClient client)
+ {
+ this.client = client;
+ }
+
+ public String getResponse()
+ {
+ return response;
+ }
+
+ public void setResponse(String response)
+ {
+ this.response = response;
+ }
+
+ public int getStatusCode()
+ {
+ return statusCode;
+ }
+
+ public void setStatusCode(int statusCode)
+ {
+ this.statusCode = statusCode;
+ }
+
+ public String getSessionId()
+ {
+ return sessionId;
+ }
+
+ public void setSessionId(String sessionId)
+ {
+ this.sessionId = sessionId;
+ }
+
+ public String getRedirectLocation()
+ {
+ return redirectLocation;
+ }
+
+ public void setRedirectLocation(String redirectLocation)
+ {
+ this.redirectLocation = redirectLocation;
+ }
+
+ public Cookie getSSOCookie()
+ {
+ return ssoCookie;
+ }
+
+ public void setSSOCookie(Cookie ssoCookie)
+ {
+ this.ssoCookie = ssoCookie;
+ }
+ }
+}
Modified: branches/2_6_CAS_Integration/identity/src/resources/portal-identity-test-jar/org/jboss/portal/test/identity/sso-beans.xml
===================================================================
--- branches/2_6_CAS_Integration/identity/src/resources/portal-identity-test-jar/org/jboss/portal/test/identity/sso-beans.xml 2007-08-23 00:14:43 UTC (rev 8044)
+++ branches/2_6_CAS_Integration/identity/src/resources/portal-identity-test-jar/org/jboss/portal/test/identity/sso-beans.xml 2007-08-23 06:49:51 UTC (rev 8045)
@@ -25,7 +25,7 @@
<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
- xmlns="urn:jboss:bean-deployer">
+ xmlns="urn:jboss:bean-deployer">
<bean name="CASConfig" class="org.jboss.portal.test.identity.sso.CASTestCase">
<constructor factoryMethod="getBean">
<factory bean="BeanFactory"/>
@@ -38,4 +38,17 @@
<property name="username">user</property>
<property name="password">user</property>
</bean>
+
+ <bean name="JOSSOConfig" class="org.jboss.portal.test.identity.sso.JOSSOTestCase">
+ <constructor factoryMethod="getBean">
+ <factory bean="BeanFactory"/>
+ <parameter>JOSSOConfig</parameter>
+ </constructor>
+ <property name="portalServer">localhost</property>
+ <property name="firstPortalContext">portal</property>
+ <property name="secondPortalContext">portal2</property>
+ <property name="userLoggedInIndicator">Logged in as:</property>
+ <property name="username">user</property>
+ <property name="password">user</property>
+ </bean>
</deployment>
18 years, 8 months
JBoss Portal SVN: r8044 - in branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity: boot and 1 other directory.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-08-22 20:14:43 -0400 (Wed, 22 Aug 2007)
New Revision: 8044
Added:
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/boot/
branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/boot/IdentityServiceLoader.java
Log:
- Identity module refactoring to drop jems dependency
Added: branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/boot/IdentityServiceLoader.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/boot/IdentityServiceLoader.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_6/identity/src/main/org/jboss/portal/identity/boot/IdentityServiceLoader.java 2007-08-23 00:14:43 UTC (rev 8044)
@@ -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.boot;
+
+import org.jboss.portal.identity.ServiceJNDIBinder;
+import org.jboss.portal.identity.IdentityContext;
+import org.jboss.portal.identity.metadata.config.ModuleMetaData;
+import org.jboss.portal.identity.metadata.config.DatasourceMetaData;
+import org.jboss.portal.identity.metadata.service.ModuleServiceMetaData;
+import org.jboss.portal.identity.metadata.service.DatasourceServiceMetaData;
+import org.jboss.kernel.Kernel;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.plugins.AbstractPropertyMetaData;
+
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot com">Boleslaw Dawidowicz</a>
+ * @version $Revision: 0.1 $
+ */
+public class IdentityServiceLoader
+{
+ //private final ServiceJNDIBinder serviceJNDIBinder;
+
+ private final IdentityContext identityContext;
+
+ private final Kernel kernel;
+
+ private final boolean registerMBeans;
+
+
+ public IdentityServiceLoader(IdentityContext identityContext, Kernel kernel, boolean registerMBeans)
+ {
+ this.identityContext = identityContext;
+ this.kernel = kernel;
+ this.registerMBeans = registerMBeans;
+ }
+
+
+ public void bootstrapDatasource(List datasources) throws Throwable
+ {
+ for (Iterator iterator = datasources.iterator(); iterator.hasNext();)
+ {
+ DatasourceServiceMetaData datasourceService = (DatasourceServiceMetaData)iterator.next();
+
+ DatasourceMetaData ds = datasourceService.getDatasource();
+
+ //instantiate datasource using MC
+ String entryName = "portal:identity=Datasource,type=" + ds.getName();
+ AbstractBeanMetaData dsBMD = new AbstractBeanMetaData(entryName,
+ ds.getClassName());
+ AbstractPropertyMetaData propertyBMD = new AbstractPropertyMetaData("identityContext", identityContext);
+ dsBMD.addProperty(propertyBMD);
+ propertyBMD = new AbstractPropertyMetaData("jndiBinder", getServiceJNDIBinder());
+ dsBMD.addProperty(propertyBMD);
+
+ //initiate parameters from <config>
+ for (Iterator iterator1 = datasourceService.getOptions().keySet().iterator(); iterator1.hasNext();)
+ {
+ String propertyKey = (String)iterator1.next();
+ String propertyValue = (String)datasourceService.getOptions().get(propertyKey);
+ //if (log.isDebugEnabled()) log.debug("adding parameter: " + propertyKey + " ; " + propertyValue);
+ propertyBMD = new AbstractPropertyMetaData(propertyKey, propertyValue);
+ dsBMD.addProperty(propertyBMD);
+ }
+
+ // Installation
+ //beans.add(dsBMD);
+ KernelControllerContext controllerContext = kernel.getController().install(dsBMD);
+ Object datasource = controllerContext.getTarget();
+
+ //make a part of identityContext
+ //moduleService.setIdentityContext(identityContext);
+
+ //register as an mbean
+ if (isRegisterMBeans() && (ds.getServiceName() != null))
+ {
+
+ registerMBean(ds.getServiceName(), datasource);
+
+ }
+
+
+ }
+ }
+
+ public void bootstrapModules(List modules) throws Throwable
+ {
+
+ for (Iterator iterator = modules.iterator(); iterator.hasNext();)
+ {
+
+ ModuleServiceMetaData moduleService = (ModuleServiceMetaData)iterator.next();
+ ModuleMetaData module = moduleService.getModuleData();
+
+ String entryName = "portal:identity=Module,type=" + module.getType();
+ AbstractBeanMetaData moduleBMD = new AbstractBeanMetaData(entryName,
+ module.getClassName());
+ AbstractPropertyMetaData propertyBMD = new AbstractPropertyMetaData("identityContext", identityContext);
+ moduleBMD.addProperty(propertyBMD);
+ propertyBMD = new AbstractPropertyMetaData("jndiBinder", getServiceJNDIBinder());
+ moduleBMD.addProperty(propertyBMD);
+
+ //initiate parameters from <config>
+ for (Iterator iterator1 = moduleService.getModuleOptions().keySet().iterator(); iterator1.hasNext();)
+ {
+ String propertyKey = (String)iterator1.next();
+ String propertyValue = (String)moduleService.getModuleOptions().get(propertyKey);
+ //if (log.isDebugEnabled()) log.debug("adding parameter: " + propertyKey + " ; " + propertyValue);
+ propertyBMD = new AbstractPropertyMetaData(propertyKey, propertyValue);
+ moduleBMD.addProperty(propertyBMD);
+ }
+
+ //make the type from name
+ propertyBMD = new AbstractPropertyMetaData("moduleType", module.getType());
+ moduleBMD.addProperty(propertyBMD);
+
+
+ // Installation
+ //beans.add(moduleBMD);
+ KernelControllerContext controllerContext = kernel.getController().install(moduleBMD);
+ Object moduleServiceObject = controllerContext.getTarget();
+
+ //make a part of identityContext
+ //moduleService.setIdentityContext(identityContext);
+
+ //register as an mbean
+ if (isRegisterMBeans() && (module.getServiceName() != null))
+ {
+ registerMBean(module.getServiceName(), moduleServiceObject);
+
+ }
+ }
+
+ }
+
+ /**
+ * Should be extended to provide mbean registration
+ * @param serviceName
+ * @param serviceObject
+ */
+ protected void registerMBean(String serviceName, Object serviceObject) throws Exception
+ {
+ //does nothing
+ }
+
+ /**
+ * Should be extended to provide JNDI binder
+ * @return
+ */
+ protected ServiceJNDIBinder getServiceJNDIBinder() throws Exception
+ {
+ return null;
+ }
+
+ public IdentityContext getIdentityContext()
+ {
+ return identityContext;
+ }
+
+ public Kernel getKernel()
+ {
+ return kernel;
+ }
+
+ public boolean isRegisterMBeans()
+ {
+ return registerMBeans;
+ }
+}
18 years, 8 months
JBoss Portal SVN: r8043 - in branches/JBoss_Portal_Branch_2_6: build/ide/intellij/idea60/modules/identity and 26 other directories.
by portal-commits@lists.jboss.org
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
18 years, 8 months
JBoss Portal SVN: r8042 - in modules/portlet/trunk: test and 1 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-08-22 19:03:16 -0400 (Wed, 22 Aug 2007)
New Revision: 8042
Removed:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/TestDriverRegistryAccess.java
Modified:
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/PortletTest.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/PortletTestDriver.java
modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/PortletTestSuite.java
modules/portlet/trunk/test/build.xml
modules/portlet/trunk/test/src/resources/portlet-test-war/WEB-INF/jboss-beans.xml
Log:
improve singleton access to RemoteTestDriverServer
Modified: modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/PortletTest.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/PortletTest.java 2007-08-22 21:35:19 UTC (rev 8041)
+++ modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/PortletTest.java 2007-08-22 23:03:16 UTC (rev 8042)
@@ -46,8 +46,8 @@
public PortletTest()
{
- actionMap = new HashMap();
- parameters = new HashSet();
+ this.actionMap = new HashMap();
+ this.parameters = new HashSet();
}
public void addParameter(String parameterName)
@@ -142,4 +142,7 @@
return result;
}
}
+
+ //
+
}
Modified: modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/PortletTestDriver.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/PortletTestDriver.java 2007-08-22 21:35:19 UTC (rev 8041)
+++ modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/PortletTestDriver.java 2007-08-22 23:03:16 UTC (rev 8042)
@@ -23,19 +23,18 @@
package org.jboss.portal.test.framework.portlet;
import org.jboss.portal.test.framework.info.TestInfo;
-import org.jboss.portal.test.framework.info.TestContainerInfo;
import org.jboss.portal.test.framework.info.TestItemInfo;
import org.jboss.portal.test.framework.info.TestParameterInfo;
import org.jboss.portal.test.framework.driver.DriverResponse;
import org.jboss.portal.test.framework.driver.DriverCommand;
import org.jboss.portal.test.framework.driver.TestDriverException;
+import org.jboss.portal.test.framework.driver.TestSuite;
+import org.jboss.portal.test.framework.driver.TestDriver;
import org.jboss.portal.test.framework.driver.http.response.InvokeGetResponse;
-import org.jboss.portal.test.framework.driver.http.HTTPTestDriver;
import org.jboss.portal.test.framework.driver.remote.TestContext;
+import org.jboss.portal.test.framework.driver.remote.RemoteTestDriver;
+import org.jboss.portal.test.framework.driver.remote.RemoteTestDriverServer;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Collections;
import java.util.Iterator;
/**
@@ -44,24 +43,42 @@
* @author <a href="mailto:boleslaw.dawidowicz@jboss.org">Boleslaw Dawidowicz</a>
* @version $Revision: 6720 $
*/
-public class PortletTestDriver implements HTTPTestDriver
+public class PortletTestDriver implements RemoteTestDriver
{
/** . */
- private final Map entries;
+ private static PortletTestContext context;
/** . */
- protected final TestContainerInfo container;
+ private final RemoteTestDriverServer server = new RemoteTestDriverServer();
/** . */
- private static PortletTestContext context;
+ private TestSuite suite;
+ /** . */
+ private String path;
+
public PortletTestDriver(String name)
{
- entries = Collections.synchronizedMap(new HashMap());
- container = new TestContainerInfo(name);
+ this(name, "/test");
}
+ public PortletTestDriver(String name, String path)
+ {
+ this.suite = new TestSuite(name);
+ this.path = path;
+ }
+
+ public void start()
+ {
+ server.addDriver(this);
+ }
+
+ public void stop()
+ {
+ server.removeDriver(this);
+ }
+
/**
* Adding sequence to registry. Sequence can be null as this will clear the binding
*
@@ -78,27 +95,22 @@
{
throw new IllegalArgumentException("Portlet test can't be null");
}
- if (entries.containsKey(testName))
+ if (getSequence(testName) != null)
{
throw new IllegalArgumentException("Portlet test cannot be bound twice");
}
//
- TestInfo test = new TestInfo(testName);
- for (Iterator i = portletTest.parameters.iterator();i.hasNext();)
- {
- String parameterName = (String)i.next();
- test.addParameter(new TestParameterInfo(parameterName));
- }
+ Sequence sequence = new Sequence(testName, portletTest);
//
- entries.put(testName, portletTest);
- container.addChild(test);
+ suite.addDriver(sequence);
}
public void removeSequence(String testName)
{
- container.removeChild(testName);
+ TestDriver a = suite.getDriver(testName);
+ suite.removeDriver(a);
}
public PortletTest getSequence(String testName)
@@ -107,18 +119,18 @@
{
throw new IllegalArgumentException("Test name can't be null");
}
- return (PortletTest)entries.get(testName);
+ Sequence sequence = (Sequence)suite.getDriver(testName);
+ return sequence != null ? sequence.test : null;
}
public TestItemInfo getInfo()
{
- return container;
+ return suite.getInfo();
}
public DriverResponse invoke(String testId, DriverCommand command) throws TestDriverException
{
- TestInfo info = (TestInfo)getInfo().findItem(testId);
- return new InvokeGetResponse("/test/" + info.getName());
+ return suite.invoke(testId, command);
}
public void pushContext(String testId, TestContext testContext)
@@ -140,4 +152,42 @@
{
return context;
}
+
+ private class Sequence implements TestDriver
+ {
+
+ /** . */
+ private final String name;
+
+ /** . */
+ private final PortletTest test;
+
+ /** . */
+ private final TestItemInfo info;
+
+ public Sequence(String name, PortletTest test)
+ {
+ TestInfo info = new TestInfo(name);
+ for (Iterator i = info.getParameterNames().iterator();i.hasNext();)
+ {
+ String parameterName = (String)i.next();
+ info.addParameter(new TestParameterInfo(parameterName));
+ }
+
+ //
+ this.name = name;
+ this.test = test;
+ this.info = info;
+ }
+
+ public TestItemInfo getInfo()
+ {
+ return info;
+ }
+
+ public DriverResponse invoke(String string, DriverCommand driverCommand) throws TestDriverException
+ {
+ return new InvokeGetResponse(path + "/" + name);
+ }
+ }
}
Modified: modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/PortletTestSuite.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/PortletTestSuite.java 2007-08-22 21:35:19 UTC (rev 8041)
+++ modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/PortletTestSuite.java 2007-08-22 23:03:16 UTC (rev 8042)
@@ -93,13 +93,13 @@
//
sce.getServletContext().setAttribute("SequenceRegistry", driver);
- TestDriverRegistryAccess.getTestDriverRegistry().addDriver(driver);
+ driver.start();
}
public void contextDestroyed(ServletContextEvent sce)
{
+ driver.stop();
sce.getServletContext().removeAttribute("SequenceRegistry");
- TestDriverRegistryAccess.getTestDriverRegistry().removeDriver(driver);
}
/**
Deleted: modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/TestDriverRegistryAccess.java
===================================================================
--- modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/TestDriverRegistryAccess.java 2007-08-22 21:35:19 UTC (rev 8041)
+++ modules/portlet/trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/TestDriverRegistryAccess.java 2007-08-22 23:03:16 UTC (rev 8042)
@@ -1,42 +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.test.framework.portlet;
-
-import org.jboss.portal.test.framework.driver.TestDriverContainer;
-import org.jboss.portal.test.framework.driver.remote.RemoteTestDriverServer;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class TestDriverRegistryAccess
-{
-
- /** . */
- private static TestDriverContainer testDriverContainer = new RemoteTestDriverServer();
-
- public static TestDriverContainer getTestDriverRegistry()
- {
- return testDriverContainer;
- }
-}
Modified: modules/portlet/trunk/test/build.xml
===================================================================
--- modules/portlet/trunk/test/build.xml 2007-08-22 21:35:19 UTC (rev 8041)
+++ modules/portlet/trunk/test/build.xml 2007-08-22 23:03:16 UTC (rev 8042)
@@ -240,7 +240,11 @@
</x-test>
<x-sysproperty>
<sysproperty key="test.root" value="${jboss.portal-portlet.root}/lib"/>
- <sysproperty key="test.uri" value="/test/redirect/"/>
+ <sysproperty key="test.uri" value="/portlet-test/"/>
+<!--
+ <jvmarg value="-Xdebug"/>
+ <jvmarg value="-Xrunjdwp:transport=dt_socket,address=7878,server=y,suspend=y"/>
+-->
</x-sysproperty>
<x-classpath>
<path refid="oswego.concurrent.classpath"/>
Modified: modules/portlet/trunk/test/src/resources/portlet-test-war/WEB-INF/jboss-beans.xml
===================================================================
--- modules/portlet/trunk/test/src/resources/portlet-test-war/WEB-INF/jboss-beans.xml 2007-08-22 21:35:19 UTC (rev 8041)
+++ modules/portlet/trunk/test/src/resources/portlet-test-war/WEB-INF/jboss-beans.xml 2007-08-22 23:03:16 UTC (rev 8042)
@@ -4,15 +4,9 @@
xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_2_0.xsd"
xmlns="urn:jboss:bean-deployer:2.0">
-
-
<bean name="TestDriverServer" class="org.jboss.portal.test.framework.driver.remote.RemoteTestDriverServer">
-<!--
- <depends
- optional-attribute-name="Agent"
- proxy-type="attribute">portal.test:service=Agent</depends>
--->
</bean>
+
<bean name="TestDriverServerExporter" class="org.jboss.portal.test.framework.impl.generic.server.GenericServiceExporter">
<constructor>
<parameter>socket://localhost:5400</parameter>
@@ -21,10 +15,6 @@
</constructor>
</bean>
- <bean name="PortletTestDriver" class="org.jboss.portal.test.framework.portlet.TestDriverRegistryAccess">
- <property name="testDriverRegistry"><inject bean="TestDriverServer"/></property>
- </bean>
-
<!-- An application registry mainly for listeners -->
<bean name="PortletApplicationRegistry" class="org.jboss.portal.portlet.impl.container.PortletApplicationRegistryImpl">
</bean>
18 years, 8 months
JBoss Portal SVN: r8041 - in modules/portlet/trunk: build and 1 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-08-22 17:35:19 -0400 (Wed, 22 Aug 2007)
New Revision: 8041
Modified:
modules/portlet/trunk/build/build-thirdparty.xml
modules/portlet/trunk/jboss-portal-portlet.ipr
modules/portlet/trunk/jboss-portal-portlet.iws
modules/portlet/trunk/test/build.xml
Log:
update thirdparty for portlet tests
Modified: modules/portlet/trunk/build/build-thirdparty.xml
===================================================================
--- modules/portlet/trunk/build/build-thirdparty.xml 2007-08-22 20:01:52 UTC (rev 8040)
+++ modules/portlet/trunk/build/build-thirdparty.xml 2007-08-22 21:35:19 UTC (rev 8041)
@@ -52,6 +52,9 @@
<componentref name="jboss-portal/modules/test" version="1.0.0-SNAPSHOT"/>
<componentref name="sun-servlet" version="2.4"/>
+ <componentref name="apache-codec" version="1.3.0"/>
+ <componentref name="apache-httpclient" version="3.0.1"/>
+ <componentref name="apache-logging" version="1.1"/>
<componentref name="jboss/remoting" version="2.2.1.GA"/>
<!-- Based on http://anonsvn.jboss.org/repos/jbossas/tags/EMBEDDED_JBOSS_BETA_2/build/b... -->
Modified: modules/portlet/trunk/jboss-portal-portlet.ipr
===================================================================
--- modules/portlet/trunk/jboss-portal-portlet.ipr 2007-08-22 20:01:52 UTC (rev 8040)
+++ modules/portlet/trunk/jboss-portal-portlet.ipr 2007-08-22 21:35:19 UTC (rev 8041)
@@ -73,15 +73,15 @@
<used_levels>
<error>
<option name="myName" value="ERROR" />
- <option name="myVal" value="400" />
+ <option name="myVal" value="200" />
</error>
<warning>
<option name="myName" value="WARNING" />
- <option name="myVal" value="300" />
+ <option name="myVal" value="100" />
</warning>
<information>
<option name="myName" value="INFO" />
- <option name="myVal" value="200" />
+ <option name="myVal" value="100" />
</information>
<server>
<option name="myName" value="SERVER PROBLEM" />
Modified: modules/portlet/trunk/jboss-portal-portlet.iws
===================================================================
--- modules/portlet/trunk/jboss-portal-portlet.iws 2007-08-22 20:01:52 UTC (rev 8040)
+++ modules/portlet/trunk/jboss-portal-portlet.iws 2007-08-22 21:35:19 UTC (rev 8041)
@@ -18,7 +18,6 @@
<component name="ChangeListManager">
<list default="true" name="Default" comment="">
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/test/build.xml" afterPath="$PROJECT_DIR$/test/build.xml" />
- <change type="MODIFICATION" beforePath="$PROJECT_DIR$/tools/lib/junit.jar" afterPath="$PROJECT_DIR$/tools/lib/junit.jar" />
</list>
</component>
<component name="ChangeListSynchronizer" />
@@ -149,60 +148,15 @@
<component name="FavoritesProjectViewPane" />
<component name="FileEditorManager">
<leaf>
- <file leaf-file-name="PortalServlet.java" pinned="false" current="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/test/src/main/org/jboss/portal/portlet/test/PortalServlet.java">
- <provider selected="true" editor-type-id="text-editor">
- <state line="54" column="13" selection-start="3091" selection-end="3091" vertical-scroll-proportion="0.1356784">
- <folding />
- </state>
- </provider>
- </entry>
- </file>
- <file leaf-file-name="web.xml" pinned="false" current="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/test/src/resources/portlet-test-war/WEB-INF/web.xml">
- <provider selected="true" editor-type-id="text-editor">
- <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0">
- <folding />
- </state>
- </provider>
- </entry>
- </file>
- <file leaf-file-name="JBossApplicationMetaDataFactory.java" pinned="false" current="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/portlet/src/main/org/jboss/portal/portlet/deployment/JBossApplicationMetaDataFactory.java">
- <provider selected="true" editor-type-id="text-editor">
- <state line="43" column="26" selection-start="2605" selection-end="2605" vertical-scroll-proportion="-0.5427136">
- <folding />
- </state>
- </provider>
- </entry>
- </file>
- <file leaf-file-name="build.xml" pinned="false" current="false" current-in-tab="false">
+ <file leaf-file-name="build.xml" pinned="false" current="true" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/test/build.xml">
<provider selected="true" editor-type-id="text-editor">
- <state line="234" column="63" selection-start="11861" selection-end="11861" vertical-scroll-proportion="0.50308263">
+ <state line="253" column="37" selection-start="12848" selection-end="12848" vertical-scroll-proportion="0.7336621">
<folding />
</state>
</provider>
</entry>
</file>
- <file leaf-file-name="buildmagic.ent" pinned="false" current="false" current-in-tab="false">
- <entry file="file://$PROJECT_DIR$/tools/etc/buildfragments/buildmagic.ent">
- <provider selected="true" editor-type-id="text-editor">
- <state line="657" column="27" selection-start="24049" selection-end="24055" vertical-scroll-proportion="0.18216081">
- <folding />
- </state>
- </provider>
- </entry>
- </file>
- <file leaf-file-name="SessionTestCase.java" pinned="false" current="true" current-in-tab="true">
- <entry file="file://$PROJECT_DIR$/portlet/src/main/org/jboss/portal/test/portlet/ha/session/SessionTestCase.java">
- <provider selected="true" editor-type-id="text-editor">
- <state line="31" column="13" selection-start="2040" selection-end="2040" vertical-scroll-proportion="0.13316892">
- <folding />
- </state>
- </provider>
- </entry>
- </file>
</leaf>
</component>
<component name="FindManager">
@@ -1218,30 +1172,30 @@
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/portlet/src/main/org/jboss/portal/portlet/deployment/JBossApplicationMetaDataFactory.java">
+ <entry file="file://$PROJECT_DIR$/tools/etc/buildfragments/buildmagic.ent">
<provider selected="true" editor-type-id="text-editor">
- <state line="43" column="26" selection-start="2605" selection-end="2605" vertical-scroll-proportion="-0.5427136">
+ <state line="657" column="27" selection-start="24049" selection-end="24055" vertical-scroll-proportion="0.18216081">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/test/build.xml">
+ <entry file="file://$PROJECT_DIR$/portlet/src/main/org/jboss/portal/test/portlet/ha/session/SessionTestCase.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="234" column="63" selection-start="11861" selection-end="11861" vertical-scroll-proportion="0.50308263">
+ <state line="31" column="13" selection-start="2040" selection-end="2040" vertical-scroll-proportion="0.13316892">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/tools/etc/buildfragments/buildmagic.ent">
+ <entry file="file://$PROJECT_DIR$/portlet/src/main/org/jboss/portal/portlet/deployment/JBossApplicationMetaDataFactory.java">
<provider selected="true" editor-type-id="text-editor">
- <state line="657" column="27" selection-start="24049" selection-end="24055" vertical-scroll-proportion="0.18216081">
+ <state line="43" column="26" selection-start="2605" selection-end="2605" vertical-scroll-proportion="-0.5427136">
<folding />
</state>
</provider>
</entry>
- <entry file="file://$PROJECT_DIR$/portlet/src/main/org/jboss/portal/test/portlet/ha/session/SessionTestCase.java">
+ <entry file="file://$PROJECT_DIR$/test/build.xml">
<provider selected="true" editor-type-id="text-editor">
- <state line="31" column="13" selection-start="2040" selection-end="2040" vertical-scroll-proportion="0.13316892">
+ <state line="253" column="37" selection-start="12848" selection-end="12848" vertical-scroll-proportion="0.7336621">
<folding />
</state>
</provider>
Modified: modules/portlet/trunk/test/build.xml
===================================================================
--- modules/portlet/trunk/test/build.xml 2007-08-22 20:01:52 UTC (rev 8040)
+++ modules/portlet/trunk/test/build.xml 2007-08-22 21:35:19 UTC (rev 8041)
@@ -249,6 +249,9 @@
<path refid="jboss.aop.classpath"/>
<path refid="javassist.javassist.classpath"/>
<path refid="trove.trove.classpath"/>
+ <path refid="apache.httpclient.classpath"/>
+ <path refid="apache.logging.classpath"/>
+ <path refid="apache.codec.classpath"/>
<pathelement location="../tools/lib/cargo-core-uberjar-0.8.jar"/>
<path refid="jboss.jbossxb.classpath"/>
<path refid="apache.xerces.classpath"/>
18 years, 8 months