[jboss-svn-commits] JBoss Portal SVN: r5303 - in trunk: build build/ide/intellij/idea50/modules/identity build/ide/intellij/idea50/modules/test identity identity/src/main/org/jboss/portal identity/src/main/org/jboss/portal/identity2 identity/src/main/org/jboss/portal/identity2/db identity/src/main/org/jboss/portal/identity2/ldap identity/src/main/org/jboss/portal/test/identity identity/src/resources/portal-identity-test-jar/org/jboss/portal/test/identity test test/src/etc test/src/etc/ldap test/src/etc/ldap/ldif test/src/main/org/jboss/portal/test/framework/embedded test/src/main/org/jboss/portal/test/framework/embedded/apacheds test/src/main/org/jboss/portal/test/framework/embedded/opends
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Sat Sep 30 16:33:30 EDT 2006
Author: bdaw
Date: 2006-09-30 16:33:16 -0400 (Sat, 30 Sep 2006)
New Revision: 5303
Added:
trunk/identity/src/main/org/jboss/portal/identity2/
trunk/identity/src/main/org/jboss/portal/identity2/MembershipModule.java
trunk/identity/src/main/org/jboss/portal/identity2/ProfileMap.java
trunk/identity/src/main/org/jboss/portal/identity2/Role.java
trunk/identity/src/main/org/jboss/portal/identity2/RoleModule.java
trunk/identity/src/main/org/jboss/portal/identity2/User.java
trunk/identity/src/main/org/jboss/portal/identity2/UserModule.java
trunk/identity/src/main/org/jboss/portal/identity2/UserProfileModule.java
trunk/identity/src/main/org/jboss/portal/identity2/db/
trunk/identity/src/main/org/jboss/portal/identity2/db/HibernateUserProfileModuleImpl.java
trunk/identity/src/main/org/jboss/portal/identity2/ldap/
trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPExtRoleModuleImpl.java
trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPExtUserModuleImpl.java
trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPMembershipModuleImpl.java
trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPOperation.java
trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPRoleImpl.java
trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPRoleModuleImpl.java
trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPSession.java
trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPSessionService.java
trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPUserImpl.java
trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPUserModuleImpl.java
trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPUserProfileModuleImpl.java
trunk/test/src/etc/ldap/
trunk/test/src/etc/ldap/ldif/
trunk/test/src/etc/ldap/ldif/example1.ldif
trunk/test/src/main/org/jboss/portal/test/framework/embedded/apacheds/
trunk/test/src/main/org/jboss/portal/test/framework/embedded/apacheds/ApacheDSService.java
trunk/test/src/main/org/jboss/portal/test/framework/embedded/apacheds/ApacheDSServiceMBean.java
Modified:
trunk/build/build-thirdparty.xml
trunk/build/ide/intellij/idea50/modules/identity/identity.iml
trunk/build/ide/intellij/idea50/modules/test/test.iml
trunk/identity/build.xml
trunk/identity/src/main/org/jboss/portal/test/identity/LDAPUserTestCase.java
trunk/identity/src/resources/portal-identity-test-jar/org/jboss/portal/test/identity/ldap-beans.xml
trunk/test/build.xml
trunk/test/src/main/org/jboss/portal/test/framework/embedded/opends/OpenDSService.java
trunk/test/src/main/org/jboss/portal/test/framework/embedded/opends/OpenDSServiceMBean.java
trunk/test/src/main/org/jboss/portal/test/framework/embedded/opends/OpenDSUtil.java
Log:
- disabling OpenDS as it's not j2sdk 1.4 complient
- adding ApacheDS service into test framework
- some initial interfaces and classes for ldap support (skeletons only)
Modified: trunk/build/build-thirdparty.xml
===================================================================
--- trunk/build/build-thirdparty.xml 2006-09-30 14:28:35 UTC (rev 5302)
+++ trunk/build/build-thirdparty.xml 2006-09-30 20:33:16 UTC (rev 5303)
@@ -55,6 +55,7 @@
<componentref name="apache-myfaces" version="1.1.1"/>
<componentref name="apache-codec" version="1.3.0"/>
<componentref name="apache-collections" version="3.1"/>
+ <componentref name="apache-directory" version="mixed"/>
<componentref name="apache-fileupload" version="1.1.1"/>
<componentref name="apache-httpclient" version="3.0.1"/>
<componentref name="apache-lang" version="2.0"/>
@@ -107,7 +108,6 @@
<componentref name="sun-jaf" version="1.0.2"/>
<componentref name="sun-javacc" version="3.2-portal"/>
<componentref name="sun-javamail" version="1.3.1"/>
- <componentref name="sun-opends" version="snapshot"/>
<componentref name="sun-servlet" version="2.4"/>
<componentref name="xdoclet" version="1.2.3"/>
Modified: trunk/build/ide/intellij/idea50/modules/identity/identity.iml
===================================================================
--- trunk/build/ide/intellij/idea50/modules/identity/identity.iml 2006-09-30 14:28:35 UTC (rev 5302)
+++ trunk/build/ide/intellij/idea50/modules/identity/identity.iml 2006-09-30 20:33:16 UTC (rev 5303)
@@ -85,6 +85,159 @@
</library>
</orderEntry>
<orderEntry type="module" module-name="jems" />
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/apache-directory/lib/apacheds-core-1.0-RC4.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/apache-directory/lib/apacheds-core-shared-1.0-RC4.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/apache-directory/lib/apacheds-kerberos-shared-1.0-RC4.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/apache-directory/lib/apacheds-protocol-kerberos-1.0-RC4.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/apache-directory/lib/jdbm-1.0.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/apache-directory/lib/apacheds-server-tools-1.0-RC4.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/apache-directory/lib/mina-filter-codec-asn1-0.9.5.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/apache-directory/lib/apacheds-protocol-ldap-1.0-RC4.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/apache-directory/lib/mina-filter-ssl-0.9.5.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/apache-directory/lib/shared-ldap-0.9.5.2.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/apache-directory/lib/apacheds-server-jndi-1.0-RC4.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/apache-directory/lib/apacheds-protocol-changepw-1.0-RC4.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/apache-directory/lib/nlog4j-1.2.25.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/apache-directory/lib/mina-core-0.9.5.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/apache-directory/lib/apacheds-server-main-1.0-RC4.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/apache-directory/lib/shared-asn1-0.9.5.2.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/apache-directory/lib/apacheds-protocol-shared-1.0-RC4.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
<orderEntryProperties />
</component>
<component name="VcsManagerConfiguration">
Modified: trunk/build/ide/intellij/idea50/modules/test/test.iml
===================================================================
--- trunk/build/ide/intellij/idea50/modules/test/test.iml 2006-09-30 14:28:35 UTC (rev 5302)
+++ trunk/build/ide/intellij/idea50/modules/test/test.iml 2006-09-30 20:33:16 UTC (rev 5303)
@@ -281,6 +281,159 @@
<SOURCES />
</library>
</orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/apache-directory/lib/apacheds-core-1.0-RC4.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/apache-directory/lib/apacheds-core-shared-1.0-RC4.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/apache-directory/lib/apacheds-kerberos-shared-1.0-RC4.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/apache-directory/lib/apacheds-protocol-kerberos-1.0-RC4.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/apache-directory/lib/jdbm-1.0.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/apache-directory/lib/apacheds-server-tools-1.0-RC4.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/apache-directory/lib/mina-filter-codec-asn1-0.9.5.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/apache-directory/lib/apacheds-protocol-ldap-1.0-RC4.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/apache-directory/lib/mina-filter-ssl-0.9.5.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/apache-directory/lib/shared-ldap-0.9.5.2.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/apache-directory/lib/apacheds-server-jndi-1.0-RC4.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/apache-directory/lib/apacheds-protocol-changepw-1.0-RC4.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/apache-directory/lib/nlog4j-1.2.25.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/apache-directory/lib/mina-core-0.9.5.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/apache-directory/lib/apacheds-server-main-1.0-RC4.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/apache-directory/lib/shared-asn1-0.9.5.2.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/apache-directory/lib/apacheds-protocol-shared-1.0-RC4.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
<orderEntryProperties />
</component>
<component name="VcsManagerConfiguration">
Modified: trunk/identity/build.xml
===================================================================
--- trunk/identity/build.xml 2006-09-30 14:28:35 UTC (rev 5302)
+++ trunk/identity/build.xml 2006-09-30 20:33:16 UTC (rev 5303)
@@ -37,6 +37,9 @@
&tools;
&targets;
+
+
+
<!-- ================================================================== -->
<!-- Initialization -->
<!-- ================================================================== -->
@@ -71,9 +74,9 @@
<path refid="jbossas/core.libs.classpath"/>
<path refid="oswego.concurrent.classpath"/>
<path refid="hibernate.hibernate.classpath"/>
- <path refid="sun.opends.classpath"/>
<path refid="apache.log4j.classpath"/>
<path refid="junit.junit.classpath"/>
+ <path refid="apache.directory.classpath"/>
</path>
<path id="javac.classpath">
@@ -153,7 +156,8 @@
<!-- generates artifacts used for tests, requires output to be previously run
-->
- <target name="package-tests" depends="init">
+ <target name="package-tests" depends="init,
+ output">
<jar jarfile="${build.lib}/portal-identity-test-lib.jar">
<fileset dir="${build.classes}" includes="org/jboss/portal/test/**"/>
<fileset dir="${build.resources}/portal-identity-test-jar"/>
@@ -190,16 +194,24 @@
<target name="help" depends="_default:help"/>
<target name="tests" depends="init">
+
+ <property name="proto-libs" value="${project.root}/proto-libs"/>
+
<execute-tests>
<x-test>
<test todir="${test.reports}" name="org.jboss.portal.test.identity.DBUserTestCase"/>
- <!--<test todir="${test.reports}" name="org.jboss.portal.test.identity.LDAPUserTestCase"/>-->
+ <test todir="${test.reports}" name="org.jboss.portal.test.identity.LDAPUserTestCase"/>
</x-test>
<x-classpath>
<pathelement location="${build.lib}/portal-identity-lib.jar"/>
<pathelement location="${build.lib}/portal-identity-test-lib.jar"/>
<pathelement location="${jboss.portal-test.root}/etc"/>
<pathelement location="${build.resources}/hibernate"/>
+
+
+ <path refid="apache.directory.classpath"/>
+ <path refid="apache.commons.classpath"/>
+
<path refid="dom4j.dom4j.classpath"/>
<path refid="jboss.microcontainer.classpath"/>
<path refid="jboss.jbossxb.classpath"/>
@@ -219,7 +231,6 @@
<path refid="jboss.portal-test.classpath"/>
<path refid="jboss.portal-common.classpath"/>
<path refid="jboss.portal-jems.classpath"/>
- <path refid="sun.opends.classpath"/>
<path refid="sleepycat.sleepycat.classpath"/>
<path refid="sun.jaf.classpath"/>
</x-classpath>
Added: trunk/identity/src/main/org/jboss/portal/identity2/MembershipModule.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/MembershipModule.java 2006-09-30 14:28:35 UTC (rev 5302)
+++ trunk/identity/src/main/org/jboss/portal/identity2/MembershipModule.java 2006-09-30 20:33:16 UTC (rev 5303)
@@ -0,0 +1,59 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.identity2;
+
+
+import org.jboss.portal.identity.User;
+import org.jboss.portal.identity.IdentityException;
+
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public interface MembershipModule
+{
+
+ /**
+ * Return the set of role objects that a given user has.
+ *
+ * @param user the user
+ * @return the set of roles of the specified user
+ */
+ Set getRoles(User user) throws IdentityException;
+
+ Set getUsers(Role role) throws IdentityException;
+
+ void assignUsers(Role role, Set users) throws IdentityException;
+
+ void assignRoles(User user, Set roles) throws IdentityException;
+
+ /**
+ * Returns role members based on rolename
+ *
+ * @param roleName
+ * @param offset
+ * @param limit
+ */
+ Set findRoleMembers(String roleName, int offset, int limit, String userNameFilter) throws IdentityException;
+}
Added: trunk/identity/src/main/org/jboss/portal/identity2/ProfileMap.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/ProfileMap.java 2006-09-30 14:28:35 UTC (rev 5302)
+++ trunk/identity/src/main/org/jboss/portal/identity2/ProfileMap.java 2006-09-30 20:33:16 UTC (rev 5303)
@@ -0,0 +1,42 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.identity2;
+
+import java.util.Map;
+
+/**
+ * Extends <code>java.util.Map</code> to provide meta information about user profile.
+ *
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 5218 $
+ */
+public interface ProfileMap extends Map
+{
+ /**
+ * Return true if the profile value is read only.
+ *
+ * @param key
+ * @return true if the profile value is read only
+ * @throws ClassCastException if the key is not an instance of string
+ */
+ boolean isReadOnly(Object key);
+}
Added: trunk/identity/src/main/org/jboss/portal/identity2/Role.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/Role.java 2006-09-30 14:28:35 UTC (rev 5302)
+++ trunk/identity/src/main/org/jboss/portal/identity2/Role.java 2006-09-30 20:33:16 UTC (rev 5303)
@@ -0,0 +1,55 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.identity2;
+
+import java.util.Set;
+
+/**
+ * A role of users.
+ *
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @version $Revision: 2001 $
+ */
+public interface Role
+{
+ /**
+ * The role identifier.
+ */
+ Object getId();
+
+ /**
+ * The role name used in security rules. This name can not be modified
+ */
+ String getName();
+
+ /**
+ * The role display name used on screens. This name can be modified
+ */
+ String getDisplayName();
+
+ /**
+ *
+ */
+ void setDisplayName(String name);
+
+}
Added: trunk/identity/src/main/org/jboss/portal/identity2/RoleModule.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/RoleModule.java 2006-09-30 14:28:35 UTC (rev 5302)
+++ trunk/identity/src/main/org/jboss/portal/identity2/RoleModule.java 2006-09-30 20:33:16 UTC (rev 5303)
@@ -0,0 +1,101 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.identity2;
+
+import org.jboss.portal.identity.Role;
+import org.jboss.portal.identity.IdentityException;
+
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet </a>
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute </a>
+ * @author Roy Russo : roy at jboss dot org
+ * @version $Revision: 2001 $
+ */
+public interface RoleModule
+{
+ /**
+ * Retrieves a role by its name
+ *
+ * @param name the role name
+ * @return the role
+ */
+ Role findRoleByName(String name) throws IdentityException, IllegalArgumentException;
+
+ /**
+ * Retrieve a collection of role from the role names.
+ *
+ * @param names the role names
+ * @return a collection of roles
+ * @throws IllegalArgumentException
+ */
+ Set findRolesByNames(String[] names) throws IdentityException, IllegalArgumentException;
+
+ /**
+ * Retrieves a role by its id.
+ *
+ * @param id the role id
+ * @return the role
+ */
+ Role findRoleById(Object id) throws IdentityException, IllegalArgumentException;
+
+ /**
+ * Retrieves a role by its id.
+ *
+ * @param id the role id
+ * @return the role
+ */
+ Role findRoleById(String id) throws IdentityException, IllegalArgumentException;
+
+ /**
+ * Create a new role with the specified name.
+ *
+ * @param name the role name
+ * @param displayName the role display name
+ * @return the role
+ */
+ Role createRole(String name, String displayName) throws IdentityException, IllegalArgumentException;
+
+ /**
+ * Remove a role.
+ *
+ * @param id the role id
+ */
+ void removeRole(Object id) throws IdentityException, IllegalArgumentException;
+
+ /**
+ * Returns the number of roles.
+ *
+ * @return the number of roles
+ */
+ int getRolesCount() throws IdentityException;
+
+ /**
+ * Get all the roles
+ *
+ * @return the roles
+ */
+ Set findRoles() throws IdentityException;
+
+
+}
Added: trunk/identity/src/main/org/jboss/portal/identity2/User.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/User.java 2006-09-30 14:28:35 UTC (rev 5302)
+++ trunk/identity/src/main/org/jboss/portal/identity2/User.java 2006-09-30 20:33:16 UTC (rev 5303)
@@ -0,0 +1,196 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.identity2;
+
+import org.jboss.portal.identity.ProfileMap;
+
+import java.util.Date;
+import java.util.Locale;
+
+/**
+ * A user.
+ *
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @author <a href="mailto:mageshbk at jboss.com">Magesh Kumar Bojan </a>
+ * @version $Revision: 5218 $
+ */
+public interface User
+{
+
+ String INFO_USER_REGISTRATION_DATE = "portal.user.registration-date";
+ String INFO_USER_HOMEPAGE = "portal.user.homepage";
+ String INFO_USER_TIME_ZONE_OFFSET = "portal.user.time-zone-offset";
+ String INFO_USER_THEME = "portal.user.theme";
+ String INFO_USER_LOCATION = "portal.user.location";
+ String INFO_USER_OCCUPATION = "portal.user.occupation";
+ String INFO_USER_EXTRA = "portal.user.extra";
+ String INFO_USER_SIGNATURE = "portal.user.signature";
+ String INFO_USER_INTERESTS = "portal.user.interests";
+ String INFO_USER_LOCALE = "portal.user.locale";
+ String INFO_USER_IM_ICQ = "portal.user.im.icq";
+ String INFO_USER_IM_AIM = "portal.user.im.aim";
+ String INFO_USER_IM_MSNM = "portal.user.im.msnm";
+ String INFO_USER_IM_YIM = "portal.user.im.yim";
+ String INFO_USER_IM_SKYPE = "portal.user.im.skype";
+ String INFO_USER_SECURITY_QUESTION = "portal.user.security.question";
+ String INFO_USER_SECURITY_ANSWER = "portal.user.security.answer";
+ String INFO_USER_EMAIL_FAKE = "portal.user.email.fake";
+ String INFO_USER_VIEW_EMAIL_VIEW_REAL = "portal.user.email.view-real";
+ String INFO_USER_LAST_LOGIN_DATE = "portal.user.last-login-date";
+
+ /**
+ * The user identifier.
+ */
+ Object getId();
+
+ // User management **************************************************************************************************
+
+ /**
+ * Disable the user.
+ */
+ boolean getEnabled();
+
+ /**
+ * Enable the user.
+ */
+ void setEnabled(boolean enable);
+
+ /**
+ * Set the password.
+ */
+ void updatePassword(String password);
+
+ /**
+ * Return true if the password is valid.
+ */
+ boolean validatePassword(String password);
+
+ // Detyped access to properties *************************************************************************************
+
+ /**
+ * Returns the user properties.
+ */
+ ProfileMap getProfile();
+
+ // Properties declared in this interface for convenient access ******************************************************
+
+ /**
+ * The user name.
+ */
+ String getUserName();
+
+ /**
+ * The given name (firstname).
+ */
+ String getGivenName();
+
+ /**
+ *
+ */
+ void setGivenName(String givenName);
+
+ /**
+ * The family name.
+ */
+ String getFamilyName();
+
+ /**
+ *
+ */
+ void setFamilyName(String familyName);
+
+ /**
+ *
+ */
+ String getRealEmail();
+
+ /**
+ *
+ */
+ void setRealEmail(String realEmail);
+
+ /**
+ *
+ */
+ String getFakeEmail();
+
+ /**
+ *
+ */
+ void setFakeEmail(String fakeEmail);
+
+ /**
+ *
+ */
+ Date getRegistrationDate();
+
+ /**
+ *
+ */
+ boolean getViewRealEmail();
+
+ /**
+ *
+ */
+ void setViewRealEmail(boolean viewRealEmail);
+
+ /**
+ * Return the user preferred locale.
+ */
+ Locale getPreferredLocale();
+
+ /**
+ * Set the user preferred locale.
+ */
+ void setPreferredLocale(Locale locale);
+
+ /**
+ * Returns the signature.
+ */
+ String getSignature();
+
+ /**
+ * Set the signature.
+ */
+ void setSignature(String signature);
+
+ /**
+ * Return the last time the user logged in or null if this date is not known.
+ */
+ Date getLastVisitDate();
+
+ /**
+ * Set the last visit date on this user.
+ */
+ void setLastVisitDate(Date date);
+
+ /**
+ * Return the theme set for this user as the app id of the Theme.
+ */
+ String getTheme();
+
+ /**
+ * Set the theme for this user.
+ */
+ void setTheme(String themeId);
+}
Added: trunk/identity/src/main/org/jboss/portal/identity2/UserModule.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/UserModule.java 2006-09-30 14:28:35 UTC (rev 5302)
+++ trunk/identity/src/main/org/jboss/portal/identity2/UserModule.java 2006-09-30 20:33:16 UTC (rev 5303)
@@ -0,0 +1,102 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.identity2;
+
+import org.jboss.portal.identity.User;
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.NoSuchUserException;
+
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet </a>
+ * @version $Revision: 2001 $
+ */
+public interface UserModule
+{
+ /**
+ * Retrieve a user by its name.
+ *
+ * @param userName the user name
+ * @return the user
+ */
+ User findUserByUserName(String userName) throws IdentityException, IllegalArgumentException, NoSuchUserException;
+
+ /**
+ * Retrieve a user by its id.
+ *
+ * @param id the user id
+ * @return the user
+ * @throws IllegalArgumentException if the id is null
+ */
+ User findUserById(Object id) throws IdentityException, IllegalArgumentException, NoSuchUserException;
+
+ /**
+ * Retrieve a user by its id.
+ *
+ * @param id the user id
+ * @return the user
+ * @throws IllegalArgumentException if the id is null or not in the good format
+ */
+ User findUserById(String id) throws IdentityException, IllegalArgumentException, NoSuchUserException;
+
+ /**
+ * Creates a new user with the specified name.
+ *
+ * @param userName
+ * @return the user
+ */
+ User createUser(String userName, String password, String realEmail) throws IdentityException, IllegalArgumentException;
+
+ /**
+ * Remove a user.
+ *
+ * @param id the user id
+ */
+ void removeUser(Object id) throws IdentityException, IllegalArgumentException;
+
+ /**
+ * Get a range of users.
+ *
+ * @param offset the offset of the first result to retrieve
+ * @param limit the maximum number of users to retrieve
+ * @return the user set
+ */
+ Set findUsers(int offset, int limit) throws IdentityException, IllegalArgumentException;
+
+ /**
+ * Get a range of users.
+ *
+ * @param filter a string filter applied to the user name.
+ * @param offset the offset of the frist result to retrieve
+ * @param limit the maximum number of users to retrieve
+ * @return the user set
+ */
+ Set findUsersFilteredByUserName(String filter, int offset, int limit) throws IdentityException, IllegalArgumentException;
+
+ /**
+ * Returns the number of users.
+ *
+ * @return the number of users
+ */
+ int getUserCount() throws IdentityException, IllegalArgumentException;
+}
Added: trunk/identity/src/main/org/jboss/portal/identity2/UserProfileModule.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/UserProfileModule.java 2006-09-30 14:28:35 UTC (rev 5302)
+++ trunk/identity/src/main/org/jboss/portal/identity2/UserProfileModule.java 2006-09-30 20:33:16 UTC (rev 5303)
@@ -0,0 +1,39 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.identity2;
+
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public interface UserProfileModule
+{
+
+ public String getProperty(User user, String propertyName);
+
+ public void setProperty(User user, String name, Object property);
+
+ public Set getProperties(User user);
+
+}
Added: trunk/identity/src/main/org/jboss/portal/identity2/db/HibernateUserProfileModuleImpl.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/db/HibernateUserProfileModuleImpl.java 2006-09-30 14:28:35 UTC (rev 5302)
+++ trunk/identity/src/main/org/jboss/portal/identity2/db/HibernateUserProfileModuleImpl.java 2006-09-30 20:33:16 UTC (rev 5303)
@@ -0,0 +1,109 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.identity2.db;
+
+import org.jboss.portal.identity2.UserProfileModule;
+import org.jboss.portal.identity2.User;
+import org.jboss.portal.identity.db.UserImpl;
+
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class HibernateUserProfileModuleImpl implements UserProfileModule
+{
+ public String getProperty(User user, String propertyName)
+ {
+ if (user == null)
+ {
+ throw new IllegalArgumentException("User cannot be null");
+ }
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException("Property name need to have value");
+ }
+
+ UserImpl dbUser = null;
+
+ if (user instanceof UserImpl)
+ {
+ dbUser = (UserImpl)user;
+ }
+ else
+ {
+ throw new IllegalArgumentException("This UserProfileModule implementation support only DBUserImpl objects");
+ }
+
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public void setProperty(User user, String propertyName, Object propertyValue)
+ {
+ if (user == null)
+ {
+ throw new IllegalArgumentException("User cannot be null");
+ }
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException("Property name need to have value");
+ }
+
+ UserImpl dbUser = null;
+
+ if (user instanceof UserImpl)
+ {
+ dbUser = (UserImpl)user;
+ }
+ else
+ {
+ throw new IllegalArgumentException("This UserProfileModule implementation support only DBUserImpl objects");
+ }
+
+ //if value is null reset property
+
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public Set getProperties(User user)
+ {
+ if (user == null)
+ {
+ throw new IllegalArgumentException("User cannot be null");
+ }
+
+ UserImpl dbUser = null;
+
+ if (user instanceof UserImpl)
+ {
+ dbUser = (UserImpl)user;
+ }
+ else
+ {
+ throw new IllegalArgumentException("This UserProfileModule implementation support only DBUserImpl objects");
+ }
+
+
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+}
Added: trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPExtRoleModuleImpl.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPExtRoleModuleImpl.java 2006-09-30 14:28:35 UTC (rev 5302)
+++ trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPExtRoleModuleImpl.java 2006-09-30 20:33:16 UTC (rev 5303)
@@ -0,0 +1,75 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.identity2.ldap;
+
+import org.jboss.portal.identity2.RoleModule;
+import org.jboss.portal.identity.Role;
+import org.jboss.portal.identity.IdentityException;
+
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class LDAPExtRoleModuleImpl implements RoleModule
+{
+ public Role findRoleByName(String name) throws IdentityException, IllegalArgumentException
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public Set findRolesByNames(String[] names) throws IdentityException, IllegalArgumentException
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public Role findRoleById(Object id) throws IdentityException, IllegalArgumentException
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public Role findRoleById(String id) throws IdentityException, IllegalArgumentException
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public Role createRole(String name, String displayName) throws IdentityException, IllegalArgumentException
+ {
+ throw new UnsupportedOperationException("Role management is not supported in this implementation of RoleModule");
+ }
+
+ public void removeRole(Object id) throws IdentityException, IllegalArgumentException
+ {
+ throw new UnsupportedOperationException("Role management is not supported in this implementation of RoleModule");
+ }
+
+ public int getRolesCount() throws IdentityException
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public Set findRoles() throws IdentityException
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+}
Added: trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPExtUserModuleImpl.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPExtUserModuleImpl.java 2006-09-30 14:28:35 UTC (rev 5302)
+++ trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPExtUserModuleImpl.java 2006-09-30 20:33:16 UTC (rev 5303)
@@ -0,0 +1,76 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.identity2.ldap;
+
+import org.jboss.portal.identity2.UserModule;
+import org.jboss.portal.identity.User;
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.NoSuchUserException;
+
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class LDAPExtUserModuleImpl implements UserModule
+{
+ public User findUserByUserName(String userName) throws IdentityException, IllegalArgumentException, NoSuchUserException
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public User findUserById(Object id) throws IdentityException, IllegalArgumentException, NoSuchUserException
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public User findUserById(String id) throws IdentityException, IllegalArgumentException, NoSuchUserException
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public User createUser(String userName, String password, String realEmail) throws IdentityException, IllegalArgumentException
+ {
+ throw new UnsupportedOperationException("User management is not supported in this implementation of UserModule");
+ }
+
+ public void removeUser(Object id) throws IdentityException, IllegalArgumentException
+ {
+ throw new UnsupportedOperationException("User management is not supported in this implementation of UserModule");
+ }
+
+ public Set findUsers(int offset, int limit) throws IdentityException, IllegalArgumentException
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public Set findUsersFilteredByUserName(String filter, int offset, int limit) throws IdentityException, IllegalArgumentException
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public int getUserCount() throws IdentityException, IllegalArgumentException
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+}
Added: trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPMembershipModuleImpl.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPMembershipModuleImpl.java 2006-09-30 14:28:35 UTC (rev 5302)
+++ trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPMembershipModuleImpl.java 2006-09-30 20:33:16 UTC (rev 5303)
@@ -0,0 +1,62 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.identity2.ldap;
+
+import org.jboss.portal.identity2.MembershipModule;
+import org.jboss.portal.identity2.Role;
+import org.jboss.portal.identity.User;
+import org.jboss.portal.identity.IdentityException;
+
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class LDAPMembershipModuleImpl implements MembershipModule
+{
+
+ public Set getRoles(User user) throws IdentityException
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public Set getUsers(Role role) throws IdentityException
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public void assignUsers(Role role, Set users) throws IdentityException
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public void assignRoles(User user, Set roles) throws IdentityException
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public Set findRoleMembers(String roleName, int offset, int limit, String userNameFilter) throws IdentityException
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+}
Added: trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPOperation.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPOperation.java 2006-09-30 14:28:35 UTC (rev 5302)
+++ trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPOperation.java 2006-09-30 20:33:16 UTC (rev 5303)
@@ -0,0 +1,30 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.identity2.ldap;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class LDAPOperation
+{
+}
Added: trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPRoleImpl.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPRoleImpl.java 2006-09-30 14:28:35 UTC (rev 5302)
+++ trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPRoleImpl.java 2006-09-30 20:33:16 UTC (rev 5303)
@@ -0,0 +1,58 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.identity2.ldap;
+
+import org.jboss.portal.identity2.Role;
+
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class LDAPRoleImpl implements Role
+{
+ public Object getId()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String getName()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String getDisplayName()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void setDisplayName(String name)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public Set getUsers()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+}
Added: trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPRoleModuleImpl.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPRoleModuleImpl.java 2006-09-30 14:28:35 UTC (rev 5302)
+++ trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPRoleModuleImpl.java 2006-09-30 20:33:16 UTC (rev 5303)
@@ -0,0 +1,76 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.identity2.ldap;
+
+import org.jboss.portal.identity2.RoleModule;
+import org.jboss.portal.identity.Role;
+import org.jboss.portal.identity.IdentityException;
+
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class LDAPRoleModuleImpl implements RoleModule
+{
+
+ public Role findRoleByName(String name) throws IdentityException, IllegalArgumentException
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public Set findRolesByNames(String[] names) throws IdentityException, IllegalArgumentException
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public Role findRoleById(Object id) throws IdentityException, IllegalArgumentException
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public Role findRoleById(String id) throws IdentityException, IllegalArgumentException
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public Role createRole(String name, String displayName) throws IdentityException, IllegalArgumentException
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public void removeRole(Object id) throws IdentityException, IllegalArgumentException
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public int getRolesCount() throws IdentityException
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public Set findRoles() throws IdentityException
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+}
Added: trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPSession.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPSession.java 2006-09-30 14:28:35 UTC (rev 5302)
+++ trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPSession.java 2006-09-30 20:33:16 UTC (rev 5303)
@@ -0,0 +1,41 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.identity2.ldap;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public interface LDAPSession
+{
+
+ public void reset();
+
+ public void begin();
+
+ public void commit();
+
+ public void flush();
+
+ public void addOperation(LDAPOperation op);
+
+}
Added: trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPSessionService.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPSessionService.java 2006-09-30 14:28:35 UTC (rev 5302)
+++ trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPSessionService.java 2006-09-30 20:33:16 UTC (rev 5303)
@@ -0,0 +1,54 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.identity2.ldap;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class LDAPSessionService implements LDAPSession
+{
+ public void reset()
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public void begin()
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public void commit()
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public void flush()
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public void addOperation(LDAPOperation op)
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+}
Added: trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPUserImpl.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPUserImpl.java 2006-09-30 14:28:35 UTC (rev 5302)
+++ trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPUserImpl.java 2006-09-30 20:33:16 UTC (rev 5303)
@@ -0,0 +1,165 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.identity2.ldap;
+
+import org.jboss.portal.identity2.User;
+import org.jboss.portal.identity.ProfileMap;
+
+import java.util.Date;
+import java.util.Locale;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class LDAPUserImpl implements User
+{
+ public Object getId()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public boolean getEnabled()
+ {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void setEnabled(boolean enable)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void updatePassword(String password)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public boolean validatePassword(String password)
+ {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public ProfileMap getProfile()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String getUserName()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String getGivenName()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void setGivenName(String givenName)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String getFamilyName()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void setFamilyName(String familyName)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String getRealEmail()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void setRealEmail(String realEmail)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String getFakeEmail()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void setFakeEmail(String fakeEmail)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public Date getRegistrationDate()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public boolean getViewRealEmail()
+ {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void setViewRealEmail(boolean viewRealEmail)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public Locale getPreferredLocale()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void setPreferredLocale(Locale locale)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String getSignature()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void setSignature(String signature)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public Date getLastVisitDate()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void setLastVisitDate(Date date)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public String getTheme()
+ {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void setTheme(String themeId)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+}
Added: trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPUserModuleImpl.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPUserModuleImpl.java 2006-09-30 14:28:35 UTC (rev 5302)
+++ trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPUserModuleImpl.java 2006-09-30 20:33:16 UTC (rev 5303)
@@ -0,0 +1,76 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.identity2.ldap;
+
+import org.jboss.portal.identity2.UserModule;
+import org.jboss.portal.identity.User;
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.NoSuchUserException;
+
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class LDAPUserModuleImpl implements UserModule
+{
+ public User findUserByUserName(String userName) throws IdentityException, IllegalArgumentException, NoSuchUserException
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public User findUserById(Object id) throws IdentityException, IllegalArgumentException, NoSuchUserException
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public User findUserById(String id) throws IdentityException, IllegalArgumentException, NoSuchUserException
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public User createUser(String userName, String password, String realEmail) throws IdentityException, IllegalArgumentException
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public void removeUser(Object id) throws IdentityException, IllegalArgumentException
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public Set findUsers(int offset, int limit) throws IdentityException, IllegalArgumentException
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public Set findUsersFilteredByUserName(String filter, int offset, int limit) throws IdentityException, IllegalArgumentException
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public int getUserCount() throws IdentityException, IllegalArgumentException
+ {
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+}
Added: trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPUserProfileModuleImpl.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPUserProfileModuleImpl.java 2006-09-30 14:28:35 UTC (rev 5302)
+++ trunk/identity/src/main/org/jboss/portal/identity2/ldap/LDAPUserProfileModuleImpl.java 2006-09-30 20:33:16 UTC (rev 5303)
@@ -0,0 +1,109 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portal.identity2.ldap;
+
+import org.jboss.portal.identity2.UserProfileModule;
+import org.jboss.portal.identity2.User;
+
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class LDAPUserProfileModuleImpl implements UserProfileModule
+{
+
+ public String getProperty(User user, String propertyName)
+ {
+ if (user == null)
+ {
+ throw new IllegalArgumentException("User cannot be null");
+ }
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException("Property name need to have value");
+ }
+
+ LDAPUserImpl ldapUser = null;
+
+ if (user instanceof LDAPUserImpl)
+ {
+ ldapUser = (LDAPUserImpl)user;
+ }
+ else
+ {
+ throw new IllegalArgumentException("This UserProfileModule implementation supports only LDAPUserImpl objects");
+ }
+
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public void setProperty(User user, String propertyName, Object property)
+ {
+ if (user == null)
+ {
+ throw new IllegalArgumentException("User cannot be null");
+ }
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException("Property name need to have value");
+ }
+
+ LDAPUserImpl ldapUser = null;
+
+ if (user instanceof LDAPUserImpl)
+ {
+ ldapUser = (LDAPUserImpl)user;
+ }
+ else
+ {
+ throw new IllegalArgumentException("This UserProfileModule implementation support only LDAPUserImpl objects");
+ }
+
+ //if value is null reset property
+
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+
+ public Set getProperties(User user)
+ {
+ if (user == null)
+ {
+ throw new IllegalArgumentException("User cannot be null");
+ }
+
+ LDAPUserImpl ldapUser = null;
+
+ if (user instanceof LDAPUserImpl)
+ {
+ ldapUser = (LDAPUserImpl)user;
+ }
+ else
+ {
+ throw new IllegalArgumentException("This UserProfileModule implementation support only LDAPUserImpl objects");
+ }
+
+
+ throw new UnsupportedOperationException("Not yet implemented");
+ }
+}
Modified: trunk/identity/src/main/org/jboss/portal/test/identity/LDAPUserTestCase.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/test/identity/LDAPUserTestCase.java 2006-09-30 14:28:35 UTC (rev 5302)
+++ trunk/identity/src/main/org/jboss/portal/test/identity/LDAPUserTestCase.java 2006-09-30 20:33:16 UTC (rev 5303)
@@ -27,28 +27,22 @@
import java.util.Map;
import java.util.Date;
import java.util.Hashtable;
-import java.text.SimpleDateFormat;
-import java.io.File;
-import org.jboss.portal.test.framework.embedded.DataSourceSupport;
-import org.jboss.portal.test.framework.embedded.HibernateSupport;
-import org.jboss.portal.test.framework.embedded.opends.OpenDSUtil;
import org.jboss.portal.test.framework.TestRuntimeContext;
-import org.jboss.portal.identity.db.DBUserModuleImpl;
-import org.jboss.portal.identity.db.DBRoleModuleImpl;
-import org.jboss.portal.identity.User;
-import org.jboss.portal.identity.ProfileMap;
-import org.jboss.portal.common.p3p.P3PConstants;
+
import org.apache.log4j.Appender;
import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.SimpleLayout;
import org.apache.log4j.Logger;
import org.apache.log4j.Level;
-import org.opends.server.tools.LDAPModify;
+import org.apache.directory.server.protocol.shared.store.LdifFileLoader;
+
import javax.naming.directory.DirContext;
import javax.naming.directory.InitialDirContext;
import javax.naming.Context;
+import javax.naming.NamingEnumeration;
+import javax.naming.Binding;
/**
* @author <a href="mailto:julien at jboss.org">Julien Viet</a>
@@ -73,31 +67,34 @@
{
Appender appender = new ConsoleAppender(new SimpleLayout());
Logger.getRoot().addAppender(appender);
- Logger.getRoot().setLevel(Level.DEBUG);
- Logger.getLogger("org.hibernate").setLevel(Level.ERROR);
+ Logger.getRoot().setLevel(Level.INFO);
+ //Logger.getLogger("org.hibernate").setLevel(Level.ERROR);
}
public LDAPUserTestCase()
{
-
+
}
public LDAPUserTestCase(Map parametrization)
{
- //dsCfg = (DataSourceSupport.Config)parametrization.get("DataSourceConfig");
+ //dsCfg = (DataSourceSupport.Config)parametrization.get("DataSourceConfig");
}
-
+ //temporary
private String contextFactory = System.getProperty("jboss.security.ldap.ctxfactory",
- "com.sun.jndi.ldap.LdapCtxFactory");
- private OpenDSUtil util = new OpenDSUtil();
+ "com.sun.jndi.ldap.LdapCtxFactory");
private String serverHost = "localhost";
- private String port = "1389";
- private String adminDN = "cn=Directory Manager";
- private String adminPW = "password";
+ private String port = "10389";
+ //private String adminDN = "cn=Directory Manager";
+ private String adminDN = "uid=admin,ou=system";
+ //private String adminPW = "password";
+ private String adminPW = "secret";
private String dn = "dc=jboss,dc=org";
- /** . */
+ /**
+ * .
+ */
private TestRuntimeContext runtimeContext;
/** . */
@@ -106,11 +103,10 @@
/** . */
//private DBUserModuleImpl userModule;
- /** . */
+ /**
+ * .
+ */
//private DBRoleModuleImpl roleModule;
-
-
-
public String getName()
{
return super.getName(); // + "," + dsCfg.getDisplayName();
@@ -138,6 +134,24 @@
utc.setRoleModule(roleModule);
utc.setContext(this);
utc.populate();*/
+
+ try
+ {
+ //on start load the content into ldap
+
+ DirContext ctx = getDirContext();
+ ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+
+ URL ldif = tcl.getResource("ldap/ldif/example1.ldif");
+ log.info("ldif to load by loader: " + ldif.getPath());
+
+ LdifFileLoader loader = new LdifFileLoader(ctx, ldif.getPath());
+ loader.execute();
+ }
+ catch (Exception e)
+ {
+ log.info("fail to import initial ldif for tests", e);
+ }
}
protected void tearDown() throws Exception
@@ -155,6 +169,18 @@
userModule = null;*/
//
+ //on exit remove dc=jboss,dc=org
+ try
+ {
+ DirContext ctx = getDirContext();
+ DirContext org = (DirContext)ctx.lookup("dc=org");
+ removeContext(org, "dc=jboss");
+ }
+ catch (Exception e)
+ {
+ log.info("fail to unbind content from tests", e);
+ }
+
runtimeContext.stop();
}
@@ -164,47 +190,48 @@
}
+
public void commit()
{
+
}
public void testSimple() throws Exception
{
- getDirContext();
+ log.info("simple test");
+ DirContext ctx = getDirContext();
+ DirContext org = (DirContext)ctx.lookup("dc=org");
+ NamingEnumeration bindings = ctx.listBindings("dc=org");
+ log.info("listing before remove: ");
+ while (bindings.hasMore())
+ {
- if(util.existsDN(serverHost, port, dn))
- util.deleteDN(serverHost, port, adminDN, adminPW, dn, true);
+ Binding bd = (Binding)bindings.next();
+ //log.info("name enum element: " + bd.getClass().getName());
+ log.info(bd.getName() + ": " + bd.getObject());
+ }
- assertTrue("ldap add success?" , performLdifAdd());
- assertTrue("ldap search success?" , util.existsDN(serverHost, port, dn));
- assertTrue("ldap delete success?", util.deleteDN(serverHost, port, adminDN, adminPW, dn, true));
- assertFalse("ldap search should fail" , util.existsDN(serverHost, port, dn));
+ //removeContext(org,"dc=jboss");
+ bindings = ctx.listBindings("dc=org");
+ log.info("listing after remove: ");
+ while (bindings.hasMore())
+ {
+ Binding bd = (Binding)bindings.next();
+ log.info(bd.getName() + ": " + bd.getObject());
+ }
}
public void testSecondSimple() throws Exception
{
-
- if(util.existsDN(serverHost, port, dn))
- util.deleteDN(serverHost, port, adminDN, adminPW, dn, true);
-
- assertTrue("ldap add success?" , performLdifAdd());
- assertTrue("ldap search success?" , util.existsDN(serverHost, port, dn));
- assertTrue("ldap delete success?", util.deleteDN(serverHost, port, adminDN, adminPW, dn, true));
- assertFalse("ldap search should fail" , util.existsDN(serverHost, port, dn));
+ log.info("second test");
}
public void testThirdSimple() throws Exception
{
- if(util.existsDN(serverHost, port, dn))
- util.deleteDN(serverHost, port, adminDN, adminPW, dn, true);
-
- assertTrue("ldap add success?" , performLdifAdd());
- assertTrue("ldap search success?" , util.existsDN(serverHost, port, dn));
- assertTrue("ldap delete success?", util.deleteDN(serverHost, port, adminDN, adminPW, dn, true));
- assertFalse("ldap search should fail" , util.existsDN(serverHost, port, dn));
+ log.info("third test");
}
//
@@ -360,25 +387,9 @@
commit();
}*/
- //***************************************************************
- // PRIVATE METHODS
- //***************************************************************
- private boolean performLdifAdd() throws Exception
- {
- URL url = Thread.currentThread().getContextClassLoader().getResource("opends/ldif/example1.ldif");
- log.debug("ldap add ldif url="+url.getPath());
- File file = new File(url.getPath());
- String[] cmd = new String[] {"-h", serverHost, "-p",
- "1389", "-D", "cn=Directory Manager",
- "-w", "password",
- "-a", "-f",file.getPath()};
-
- return LDAPModify.mainModify(cmd, false, System.out, System.err) == 0;
- }
-
private DirContext getDirContext() throws Exception
{
- String url = "ldap://" + serverHost + ":1389";
+ String url = "ldap://" + serverHost + ":" + port;
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, contextFactory);
env.put(Context.PROVIDER_URL, url);
@@ -387,4 +398,21 @@
env.put(Context.SECURITY_CREDENTIALS, this.adminPW);
return new InitialDirContext(env);
}
+
+ //subsequent remove of javax.naming.Context
+ private void removeContext(Context mainCtx, String name) throws Exception
+ {
+ Context deleteCtx = (Context)mainCtx.lookup(name);
+ NamingEnumeration subDirs = mainCtx.listBindings(name);
+
+ while (subDirs.hasMoreElements())
+ {
+ Binding binding = (Binding)subDirs.nextElement();
+ String subName = binding.getName();
+
+ removeContext(deleteCtx, subName);
+ }
+
+ mainCtx.unbind(name);
+ }
}
Modified: trunk/identity/src/resources/portal-identity-test-jar/org/jboss/portal/test/identity/ldap-beans.xml
===================================================================
--- trunk/identity/src/resources/portal-identity-test-jar/org/jboss/portal/test/identity/ldap-beans.xml 2006-09-30 14:28:35 UTC (rev 5302)
+++ trunk/identity/src/resources/portal-identity-test-jar/org/jboss/portal/test/identity/ldap-beans.xml 2006-09-30 20:33:16 UTC (rev 5303)
@@ -4,7 +4,11 @@
xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
xmlns="urn:jboss:bean-deployer">
- <bean name="OpenDSService" class="org.jboss.portal.test.framework.embedded.opends.OpenDSService">
+ <!--<bean name="OpenDSService" class="org.jboss.portal.test.framework.embedded.opends.OpenDSService">
+ </bean>-->
+
+ <bean name="ApacheDSService" class="org.jboss.portal.test.framework.embedded.apacheds.ApacheDSService">
+ <property name="removeWorkingDir">true</property>
</bean>
@@ -17,7 +21,7 @@
<factory bean="BeanFactory"/>
<parameter>LDAPTestBean</parameter>
</constructor>
- <depends>OpenDSService</depends>
+ <depends>ApacheDSService</depends>
</bean>
Modified: trunk/test/build.xml
===================================================================
--- trunk/test/build.xml 2006-09-30 14:28:35 UTC (rev 5302)
+++ trunk/test/build.xml 2006-09-30 20:33:16 UTC (rev 5303)
@@ -37,6 +37,8 @@
&tools;
&targets;
+
+
<!-- ================================================================== -->
<!-- Initialization -->
<!-- ================================================================== -->
@@ -58,6 +60,7 @@
<target name="configure" unless="configure.disable">
+
<!-- Configure thirdparty libraries -->
&libraries;
<path id="library.classpath">
@@ -72,9 +75,13 @@
<path refid="apache.logging.classpath"/>
<path refid="junit.junit.classpath"/>
<path refid="sun.servlet.classpath"/>
- <path refid="sun.opends.classpath"/>
+ <path refid="apache.directory.classpath"/>
</path>
+
+
+
+
<!-- Configure modules -->
<call target="configure-modules"/>
<path id="dependentmodule.classpath">
@@ -143,7 +150,7 @@
<fileset dir="${build.resources}/portal-test-sar"/>
<fileset dir="${junit.junit.lib}" includes="junit.jar"/>
<fileset dir="${build.lib}" includes="portal-test-lib.jar"/>
- <fileset dir="${sun.opends.lib}" includes="OpenDS.jar"/>
+ <!--<fileset dir="${sun.opends.lib}" includes="OpenDS.jar"/>-->
<fileset dir="${sleepycat.sleepycat.lib}" includes="je.jar"/>
<fileset dir="${sun.jaf.lib}" includes="activation.jar"/>
</jar>
Added: trunk/test/src/etc/ldap/ldif/example1.ldif
===================================================================
--- trunk/test/src/etc/ldap/ldif/example1.ldif 2006-09-30 14:28:35 UTC (rev 5302)
+++ trunk/test/src/etc/ldap/ldif/example1.ldif 2006-09-30 20:33:16 UTC (rev 5303)
@@ -0,0 +1,40 @@
+
+dn: dc=jboss,dc=org
+objectclass: top
+objectclass: dcObject
+objectclass: organization
+dc: jboss
+o: JBoss
+
+dn: ou=People,dc=jboss,dc=org
+objectclass: top
+objectclass: organizationalUnit
+ou: People
+
+dn: uid=jduke,ou=People,dc=jboss,dc=org
+objectclass: top
+objectclass: uidObject
+objectclass: person
+uid: jduke
+cn: Java Duke
+sn: Duke
+userPassword: theduke
+
+dn: ou=Roles,dc=jboss,dc=org
+objectclass: top
+objectclass: organizationalUnit
+ou: Roles
+
+dn: cn=Echo,ou=Roles,dc=jboss,dc=org
+objectClass: top
+objectClass: groupOfNames
+cn: Echo
+description: the JBossAdmin group
+member: uid=jduke,ou=People,dc=jboss,dc=org
+
+dn: cn=TheDuke,ou=Roles,dc=jboss,dc=org
+objectClass: groupOfNames
+objectClass: top
+cn: TheDuke
+description: TheDuke role context
+member: uid=jduke,ou=People,dc=jboss,dc=org
Added: trunk/test/src/main/org/jboss/portal/test/framework/embedded/apacheds/ApacheDSService.java
===================================================================
--- trunk/test/src/main/org/jboss/portal/test/framework/embedded/apacheds/ApacheDSService.java 2006-09-30 14:28:35 UTC (rev 5302)
+++ trunk/test/src/main/org/jboss/portal/test/framework/embedded/apacheds/ApacheDSService.java 2006-09-30 20:33:16 UTC (rev 5303)
@@ -0,0 +1,331 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.embedded.apacheds;
+
+import org.jboss.system.ServiceMBeanSupport;
+import org.apache.directory.server.configuration.MutableServerStartupConfiguration;
+import org.apache.directory.server.core.configuration.MutablePartitionConfiguration;
+import org.apache.directory.server.core.configuration.Configuration;
+import org.apache.directory.server.core.configuration.ShutdownConfiguration;
+import org.apache.directory.server.protocol.shared.store.LdifFileLoader;
+
+import javax.naming.directory.BasicAttributes;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.InitialDirContext;
+import javax.naming.NamingException;
+import javax.naming.Context;
+import java.security.PrivilegedAction;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.Hashtable;
+import java.net.URL;
+import java.io.File;
+
+
+/**
+ * XMBean Service for ApacheDS integration
+ * <p/>
+ * based on code snippets taken from apache directory examples from
+ * http://docs.safehaus.org/display/APACHEDS/Embedding+ApacheDS
+ * https://svn.safehaus.org/repos/sandbox/apachecon/ by akarasulu at apache.org
+ *
+ * @author <a href="mailto:Boleslaw dot Dawidowicz at jboss dot com">Boleslaw Dawidowicz</a>
+ * @version $Revision$
+ * @since Sep 29, 2006
+ */
+public class ApacheDSService extends ServiceMBeanSupport implements ApacheDSServiceMBean
+{
+ public static String objectName = "portal.test:service=ApacheDSService";
+
+ private static final org.jboss.logging.Logger log = org.jboss.logging.Logger.getLogger(ApacheDSService.class);
+
+ private String workingDir = null;
+
+ private boolean removeWorkingDir = false;
+
+ private String importInitialLdif = null;
+
+ private String loadLdif = null;
+
+ private int port = 10389;
+
+
+ /**
+ * Print some information about the DS (eg: connections etc)
+ *
+ * @return String
+ */
+ public String printDiagnostics()
+ {
+ StringBuffer sb = new StringBuffer();
+ sb.append("staticstics not exposed yet");
+ return sb.toString();
+ }
+
+ public void startService() throws Exception
+ {
+ super.startService();
+
+ // Server start time
+ long startTime = System.currentTimeMillis();
+
+ MutableServerStartupConfiguration configuration = getConfiguration();
+
+ Hashtable env = createEnvironment();
+
+ // Put extended configuration into environment
+ env.put(Configuration.JNDI_KEY, configuration);
+
+
+ try
+ {
+ // Startup the server core by getting the first InitialDirContext.
+ InitialDirContext ictx = new InitialDirContext(env);
+ log.info("Embedded ApacheDS started in " + (System.currentTimeMillis() - startTime) + " milliseconds");
+
+ // Access the suffix for the new naming context
+ Attributes attrs = ictx.getAttributes("");
+ log.info("Attributes for ou=system: " + attrs.toString());
+
+ ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+
+ //load initial ldif
+ if (loadLdif != null)
+ {
+ try
+ {
+
+ URL ldif = tcl.getResource(loadLdif);
+ log.info("ldif to load by loader: " + ldif.getPath());
+
+ LdifFileLoader loader = new LdifFileLoader(ictx, ldif.getPath());
+ loader.execute();
+ }
+ catch (Exception e)
+ {
+ log.info("Unable to load ldif");
+ e.printStackTrace();
+ }
+ }
+ }
+ catch (NamingException e)
+ {
+ log.error("Failed to start the server.", e);
+ }
+
+ }
+
+ public void stopService() throws Exception
+ {
+ log.info("Stopping Embedded ApacheDS ...");
+
+ //Create a configuration instruction.
+ ShutdownConfiguration cfg = new ShutdownConfiguration();
+
+ //Build the properties from bean attributes
+ Hashtable env = createEnvironment();
+
+ // Put the configuration instruction to the environment variable.
+ env.putAll(cfg.toJndiEnvironment());
+
+ new InitialDirContext(env);
+
+ if (removeWorkingDir)
+ {
+ log.info("ApachDS working directory " + (deleteDir(new File(workingDir)) ? "removed" : "not removed") + " on exit");
+ }
+ }
+
+
+ private MutableServerStartupConfiguration getConfiguration() throws Exception
+ {
+
+ MutableServerStartupConfiguration configuration = new MutableServerStartupConfiguration();
+
+ // Enable networking but turn off every other service but LDAP on port 10389
+ configuration.setEnableNetworking(true);
+ configuration.setAccessControlEnabled(false);
+ configuration.setAllowAnonymousAccess(false);
+ configuration.setEnableChangePassword(false);
+ configuration.setEnableKerberos(false);
+ configuration.setEnableNtp(false);
+ configuration.setLdapPort(port);
+
+ workingDir = configuration.getWorkingDirectory().getAbsolutePath();
+
+ log.info("ApacheDS working dir: " + workingDir);
+
+ ClassLoader tcl = Thread.currentThread().getContextClassLoader();
+
+ if (importInitialLdif != null)
+ {
+
+ try
+ {
+
+ URL ldif = tcl.getResource(importInitialLdif);
+ log.info("ldif to load: " + ldif.getPath());
+ configuration.setLdifDirectory(new File(ldif.getPath()));
+ }
+ catch (Exception e)
+ {
+ log.info("Unable to load ldif for startup");
+ e.printStackTrace();
+ }
+ }
+
+
+ MutablePartitionConfiguration partition = new MutablePartitionConfiguration();
+
+ // Set the name of the partition
+ partition.setName("org");
+
+ // Set the suffix off of which this partition hangs in the DIT all entries stored
+ // within this partition will have this suffix in their distinguished names
+ partition.setSuffix("dc=org");
+
+ //Set indices
+ Set indices = new HashSet();
+ indices.add("objectClass");
+ indices.add("ou");
+ indices.add("dc");
+ partition.setIndexedAttributes(indices);
+
+ // Assemble the partition's suffix entry
+ Attributes suffixEntry = new BasicAttributes("objectClass", "top", true);
+ suffixEntry.get("objectClass").add("organizationalUnit");
+ suffixEntry.get("objectClass").add("dcObject");
+ suffixEntry.get("objectClass").add("domain");
+ suffixEntry.get("objectClass").add("extensibleObject");
+
+ suffixEntry.put("dc", "org");
+
+ partition.setContextEntry(suffixEntry);
+
+ // Add the new partition configuration to the configuration bean
+ Set partitions = new HashSet();
+ partitions.add(partition);
+ configuration.setContextPartitionConfigurations(partitions);
+
+ return configuration;
+ }
+
+ private Hashtable createEnvironment()
+ {
+ Hashtable env = new Hashtable();
+
+ // Notice that the provider URL is not really a URL but a DN
+ env.put(Context.PROVIDER_URL, "ou=system");
+
+ // User the ApacheDS server InitialContextFactory implementation
+ env.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.directory.server.jndi.ServerContextFactory");
+
+ // Fixed uber admin user is always present and initial password is set to "secret"
+ env.put(Context.SECURITY_PRINCIPAL, "uid=admin,ou=system");
+ env.put(Context.SECURITY_CREDENTIALS, "secret");
+ env.put(Context.SECURITY_AUTHENTICATION, "simple");
+
+ return env;
+ }
+
+ public static boolean deleteDir(File dir)
+ {
+ if (dir.isDirectory())
+ {
+ String[] children = dir.list();
+ for (int i = 0; i < children.length; i++)
+ {
+ boolean success = deleteDir(new File(dir, children[i]));
+ if (!success)
+ {
+ return false;
+ }
+ }
+ }
+
+ return dir.delete();
+ }
+
+
+ public boolean isRemoveWorkingDir()
+ {
+ return removeWorkingDir;
+ }
+
+ public void setRemoveWorkingDir(boolean removeWorkingDir)
+ {
+ this.removeWorkingDir = removeWorkingDir;
+ }
+
+ public String getLoadLdif()
+ {
+ return loadLdif;
+ }
+
+ public void setLoadLdif(String loadLdif)
+ {
+ this.loadLdif = loadLdif;
+ }
+
+ public int getPort()
+ {
+ return port;
+ }
+
+ public void setPort(int port)
+ {
+ this.port = port;
+ }
+
+ public String getImportInitialLdif()
+ {
+ return importInitialLdif;
+ }
+
+ public void setImportInitialLdif(String importInitialLdif)
+ {
+ this.importInitialLdif = importInitialLdif;
+ }
+
+
+ /**
+ * A GetSystemPropetyAction.
+ *
+ * @author <a href="anil.saldhana at jboss.com">Anil Saldhana</a>
+ * @version $Revision: 1.1 $
+ */
+ public class GetSystemPropertyAction implements PrivilegedAction
+ {
+ private String property;
+
+ public GetSystemPropertyAction(String prop)
+ {
+ this.property = prop;
+ }
+
+ public Object run()
+ {
+ return System.getProperty(property);
+ }
+ }
+
+}
Added: trunk/test/src/main/org/jboss/portal/test/framework/embedded/apacheds/ApacheDSServiceMBean.java
===================================================================
--- trunk/test/src/main/org/jboss/portal/test/framework/embedded/apacheds/ApacheDSServiceMBean.java 2006-09-30 14:28:35 UTC (rev 5302)
+++ trunk/test/src/main/org/jboss/portal/test/framework/embedded/apacheds/ApacheDSServiceMBean.java 2006-09-30 20:33:16 UTC (rev 5303)
@@ -0,0 +1,37 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., 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.embedded.apacheds;
+
+import org.jboss.system.ServiceMBean;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public interface ApacheDSServiceMBean extends ServiceMBean
+{
+
+ /* public String printDiagnostics();
+
+ public void restart();*/
+
+}
Modified: trunk/test/src/main/org/jboss/portal/test/framework/embedded/opends/OpenDSService.java
===================================================================
--- trunk/test/src/main/org/jboss/portal/test/framework/embedded/opends/OpenDSService.java 2006-09-30 14:28:35 UTC (rev 5302)
+++ trunk/test/src/main/org/jboss/portal/test/framework/embedded/opends/OpenDSService.java 2006-09-30 20:33:16 UTC (rev 5303)
@@ -26,7 +26,7 @@
import java.security.PrivilegedAction;
import org.jboss.system.ServiceMBeanSupport;
-import org.opends.server.core.DirectoryServer;
+//import org.opends.server.core.DirectoryServer;
/**
@@ -39,19 +39,19 @@
* @version $Revision$
* @since Sep 13, 2006
*/
-public class OpenDSService extends ServiceMBeanSupport implements OpenDSServiceMBean
+public class OpenDSService //extends ServiceMBeanSupport implements OpenDSServiceMBean
{
- public static String objectName = "portal.test:service=OpenDSService";
+ /*public static String objectName = "portal.test:service=OpenDSService";
private String newline = (String)
- AccessController.doPrivileged(new GetSystemPropertyAction("line.separator"));
+ AccessController.doPrivileged(new GetSystemPropertyAction("line.separator"));*/
/**
* Print some information about the DS (eg: connections etc)
* @return
*/
- public String printDiagnostics()
+ /*public String printDiagnostics()
{
StringBuffer sb = new StringBuffer();
sb.append("Maximum concurrent client connections allowed:");
@@ -59,12 +59,12 @@
sb.append(newline).append("# of client connections currently established:");
sb.append(DirectoryServer.getCurrentConnections());
return sb.toString();
- }
+ }*/
/**
* Restart the Directory Server
*/
- public void restart()
+ /*public void restart()
{
DirectoryServer.restart(getClass().getName(), "DS restart");
}
@@ -77,10 +77,7 @@
String confLoc = (String)AccessController.doPrivileged(
new GetSystemPropertyAction("jboss.server.config.url"));
- /**
- * There seems to be a need to maintain the opends directory
- * structure. We will create it under the conf dir
- */
+
ClassLoader tcl = Thread.currentThread().getContextClassLoader();
URL ldif = tcl.getResource("opends/config/config.ldif");
log.info("OpenDS config ldif = "+ldif.getPath());
@@ -100,7 +97,7 @@
{
log.debug("Asking DS to shutdown");
DirectoryServer.shutDown(getClass().getName(), "Shut down DS");
- }
+ }*/
@@ -111,7 +108,7 @@
* @author <a href="anil.saldhana at jboss.com">Anil Saldhana</a>
* @version $Revision: 1.1 $
*/
- public class GetSystemPropertyAction implements PrivilegedAction
+ /*public class GetSystemPropertyAction implements PrivilegedAction
{
private String property;
@@ -124,6 +121,6 @@
{
return System.getProperty(property);
}
- }
+ }*/
}
\ No newline at end of file
Modified: trunk/test/src/main/org/jboss/portal/test/framework/embedded/opends/OpenDSServiceMBean.java
===================================================================
--- trunk/test/src/main/org/jboss/portal/test/framework/embedded/opends/OpenDSServiceMBean.java 2006-09-30 14:28:35 UTC (rev 5302)
+++ trunk/test/src/main/org/jboss/portal/test/framework/embedded/opends/OpenDSServiceMBean.java 2006-09-30 20:33:16 UTC (rev 5303)
@@ -30,8 +30,24 @@
public interface OpenDSServiceMBean extends ServiceMBean
{
- public String printDiagnostics();
+ /* public String printDiagnostics();
- public void restart();
+ public void restart();*/
+ public boolean isRemoveWorkingDir();
+
+ public void setRemoveWorkingDir(boolean removeWorkingDir);
+
+ public String getLoadLdif();
+
+ public void setLoadLdif(String loadLdif);
+
+ public int getPort();
+
+ public void setPort(int port);
+
+ public String getImportInitialLdif();
+
+ public void setImportInitialLdif(String importInitialLdif);
+
}
Modified: trunk/test/src/main/org/jboss/portal/test/framework/embedded/opends/OpenDSUtil.java
===================================================================
--- trunk/test/src/main/org/jboss/portal/test/framework/embedded/opends/OpenDSUtil.java 2006-09-30 14:28:35 UTC (rev 5302)
+++ trunk/test/src/main/org/jboss/portal/test/framework/embedded/opends/OpenDSUtil.java 2006-09-30 20:33:16 UTC (rev 5303)
@@ -26,10 +26,10 @@
import java.util.StringTokenizer;
import org.jboss.logging.Logger;
-import org.opends.server.tools.LDAPCompare;
+/*import org.opends.server.tools.LDAPCompare;
import org.opends.server.tools.LDAPDelete;
import org.opends.server.tools.LDAPModify;
-import org.opends.server.tools.LDAPSearch;
+import org.opends.server.tools.LDAPSearch;*/
/**
* Class forked from JBoss Application Server testsuite:
@@ -57,7 +57,7 @@
* @param ldifURL (use getDeployURL of JBossTestxxx)
* @return whether the add was success
*/
- public boolean addLDIF(String serverHost, String port, String admin,
+ /*public boolean addLDIF(String serverHost, String port, String admin,
String adminpwd, URL ldifURL)
{
File ldifFile = new File(ldifURL.getPath());
@@ -69,7 +69,7 @@
log.debug("addLDIF:" + print(cmd));
//return LDAPModify.mainModify(cmd) == 0;
return LDAPModify.mainModify(cmd, false, System.out, System.err) == 0;
- }
+ }*/
/**
* Delete a DN in the Directory Server
@@ -81,7 +81,7 @@
* @param recursive should children also go?
* @return whether the delete op was success
*/
- public boolean deleteDN(String serverHost, String port, String admin,
+ /*public boolean deleteDN(String serverHost, String port, String admin,
String adminpwd, String dnToDelete, boolean recursive)
{
String rec = recursive ? "-x" : " ";
@@ -92,7 +92,7 @@
log.debug("deleteDN:" + print(cmd));
//return LDAPDelete.mainDelete(cmd) == 0;
return LDAPDelete.mainDelete(cmd, false, System.out, System.err) == 0;
- }
+ }*/
/**
* Check whether a DN exists. Typically before you do a ldap delete
@@ -101,14 +101,14 @@
* @param dn
* @return whether the DN exists?
*/
- public boolean existsDN(String serverHost, String port, String dn)
+ /*public boolean existsDN(String serverHost, String port, String dn)
{
String[] cmd = new String[] {"-h", serverHost, "-p",
port, "-b", dn ,"-s", "sub", "objectclass=*"};
log.debug("existsDN:" + print(cmd));
//return LDAPSearch.mainSearch(cmd) == 0;
return LDAPSearch.mainSearch(cmd, false, System.out, System.err) == 0;
- }
+ }*/
/**
* Issue a ldapCompare in the standard ldapCompare cmd line syntax
@@ -116,13 +116,13 @@
* @param cmdline
* @return whether ldapCompare was success
*/
- public boolean ldapCompare(String cmdline)
+ /* public boolean ldapCompare(String cmdline)
{
String[] strArr = getStringArr(cmdline);
log.debug("ldapCompare:"+print(strArr));
//return LDAPCompare.mainCompare(strArr) == 0;
return LDAPCompare.mainCompare(strArr, false, System.out, System.err) == 0;
- }
+ }*/
/**
* Issue a ldapdelete in the standard ldapdelete cmd line syntax
@@ -130,13 +130,13 @@
* @param cmdline
* @return whether ldapmodify was success
*/
- public boolean ldapDelete(String cmdline)
+ /*public boolean ldapDelete(String cmdline)
{
String[] strArr = getStringArr(cmdline);
log.debug("ldapDelete:"+print(strArr));
//return LDAPDelete.mainDelete(strArr) == 0;
return LDAPDelete.mainDelete(strArr, false, System.out, System.err) == 0;
- }
+ }*/
/**
* Issue a ldapmodify in the standard ldapmodify cmd line syntax
@@ -144,18 +144,18 @@
* @param cmdline
* @return whether ldapmodify was success
*/
- public boolean ldapModify(String cmdline)
+ /*public boolean ldapModify(String cmdline)
{
String[] strArr = getStringArr(cmdline);
log.debug("ldapModify:"+print(strArr));
//return LDAPModify.mainModify(strArr) == 0;
return LDAPModify.mainModify(strArr, false, System.out, System.err) == 0;
- }
+ }*/
//***************************************************************
// PRIVATE METHODS
//***************************************************************
- private String[] getStringArr(String str)
+ /*private String[] getStringArr(String str)
{
StringTokenizer st = new StringTokenizer(str);
int num = st.countTokens();
@@ -166,14 +166,14 @@
strarr[i++] = st.nextToken();
}
return strarr;
- }
+ }*/
- private String print(String[] arr)
+ /*private String print(String[] arr)
{
StringBuffer sb = new StringBuffer();
int len = arr != null ? arr.length : 0;
for(int i=0; i < len; i++)
sb.append(arr[i]);
return sb.toString();
- }
+ }*/
}
More information about the jboss-svn-commits
mailing list