JBoss Identity SVN: r932 - in identity-federation/trunk/jboss-identity-webapps: idp-sig/src/main/webapp/WEB-INF and 1 other directories.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2009-11-12 14:15:59 -0500 (Thu, 12 Nov 2009)
New Revision: 932
Added:
identity-federation/trunk/jboss-identity-webapps/idp-sig-no-val/src/main/webapp/WEB-INF/jbid-handlers.xml
identity-federation/trunk/jboss-identity-webapps/idp-sig/src/main/webapp/WEB-INF/jbid-handlers.xml
identity-federation/trunk/jboss-identity-webapps/idp/src/main/webapp/WEB-INF/jbid-handlers.xml
Log:
missing file
Added: identity-federation/trunk/jboss-identity-webapps/idp/src/main/webapp/WEB-INF/jbid-handlers.xml
===================================================================
--- identity-federation/trunk/jboss-identity-webapps/idp/src/main/webapp/WEB-INF/jbid-handlers.xml (rev 0)
+++ identity-federation/trunk/jboss-identity-webapps/idp/src/main/webapp/WEB-INF/jbid-handlers.xml 2009-11-12 19:15:59 UTC (rev 932)
@@ -0,0 +1,6 @@
+<Handlers xmlns="urn:jboss:identity-federation:handler:config:1.0">
+ <Handler class="org.jboss.identity.federation.web.handlers.saml2.SAML2IssuerTrustHandler"/>
+ <Handler class="org.jboss.identity.federation.web.handlers.saml2.SAML2LogOutHandler"/>
+ <Handler class="org.jboss.identity.federation.web.handlers.saml2.SAML2AuthenticationHandler"/>
+ <Handler class="org.jboss.identity.federation.web.handlers.saml2.RolesGenerationHandler"/>
+</Handlers>
Added: identity-federation/trunk/jboss-identity-webapps/idp-sig/src/main/webapp/WEB-INF/jbid-handlers.xml
===================================================================
--- identity-federation/trunk/jboss-identity-webapps/idp-sig/src/main/webapp/WEB-INF/jbid-handlers.xml (rev 0)
+++ identity-federation/trunk/jboss-identity-webapps/idp-sig/src/main/webapp/WEB-INF/jbid-handlers.xml 2009-11-12 19:15:59 UTC (rev 932)
@@ -0,0 +1,6 @@
+<Handlers xmlns="urn:jboss:identity-federation:handler:config:1.0">
+ <Handler class="org.jboss.identity.federation.web.handlers.saml2.SAML2IssuerTrustHandler"/>
+ <Handler class="org.jboss.identity.federation.web.handlers.saml2.SAML2LogOutHandler"/>
+ <Handler class="org.jboss.identity.federation.web.handlers.saml2.SAML2AuthenticationHandler"/>
+ <Handler class="org.jboss.identity.federation.web.handlers.saml2.RolesGenerationHandler"/>
+</Handlers>
Added: identity-federation/trunk/jboss-identity-webapps/idp-sig-no-val/src/main/webapp/WEB-INF/jbid-handlers.xml
===================================================================
--- identity-federation/trunk/jboss-identity-webapps/idp-sig-no-val/src/main/webapp/WEB-INF/jbid-handlers.xml (rev 0)
+++ identity-federation/trunk/jboss-identity-webapps/idp-sig-no-val/src/main/webapp/WEB-INF/jbid-handlers.xml 2009-11-12 19:15:59 UTC (rev 932)
@@ -0,0 +1,6 @@
+<Handlers xmlns="urn:jboss:identity-federation:handler:config:1.0">
+ <Handler class="org.jboss.identity.federation.web.handlers.saml2.SAML2IssuerTrustHandler"/>
+ <Handler class="org.jboss.identity.federation.web.handlers.saml2.SAML2LogOutHandler"/>
+ <Handler class="org.jboss.identity.federation.web.handlers.saml2.SAML2AuthenticationHandler"/>
+ <Handler class="org.jboss.identity.federation.web.handlers.saml2.RolesGenerationHandler"/>
+</Handlers>
16 years, 6 months
JBoss Identity SVN: r931 - identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/idp.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2009-11-12 14:11:45 -0500 (Thu, 12 Nov 2009)
New Revision: 931
Modified:
identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/idp/IDPWebBrowserSSOValve.java
Log:
remove commented out code
Modified: identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/idp/IDPWebBrowserSSOValve.java
===================================================================
--- identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/idp/IDPWebBrowserSSOValve.java 2009-11-12 15:30:33 UTC (rev 930)
+++ identity-federation/trunk/jboss-identity-bindings/src/main/java/org/jboss/identity/federation/bindings/tomcat/idp/IDPWebBrowserSSOValve.java 2009-11-12 19:11:45 UTC (rev 931)
@@ -384,30 +384,6 @@
destination = saml2HandlerResponse.getDestination();
-
-
-
- /*requestAbstractType = webRequestUtil.getSAMLRequest(samlRequestMessage);
- boolean isPost = webRequestUtil.hasSAMLRequestInPostProfile();
- boolean isValid = validate(request.getRemoteAddr(),
- request.getQueryString(),
- new SessionHolder(samlRequestMessage, signature, sigAlg), isPost);
- if(!isValid)
- throw new GeneralSecurityException("Validation check failed");
-
- webRequestUtil.isTrusted(requestAbstractType.getIssuer().getValue());
-
- List<String> roles = roleGenerator.generateRoles(userPrincipal);
-
- log.trace("Roles have been determined:Creating response");
-
- AuthnRequestType art = (AuthnRequestType) requestAbstractType;
- destination = art.getAssertionConsumerServiceURL();
-
- samlResponse =
- webRequestUtil.getResponse(destination,
- userPrincipal, roles,
- this.identityURL, this.assertionValidity, this.signOutgoingMessages); */
}
catch (IssuerNotTrustedException e)
{
16 years, 6 months
JBoss Identity SVN: r930 - in idm/trunk/assembly: scripts and 4 other directories.
by jboss-identity-commits@lists.jboss.org
Author: jeff.yuchang
Date: 2009-11-12 10:30:33 -0500 (Thu, 12 Nov 2009)
New Revision: 930
Added:
idm/trunk/assembly/src/main/files/jboss/hibernate.cfg/hsqldburl.hibernate.cfg.xml
Removed:
idm/trunk/assembly/src/main/config/
idm/trunk/assembly/src/main/files/db/hibernate.cfg/
idm/trunk/assembly/src/main/files/jboss/config.jboss5/
Modified:
idm/trunk/assembly/pom.xml
idm/trunk/assembly/scripts/antrun-schema.xml
idm/trunk/assembly/scripts/assembly-distro.xml
idm/trunk/assembly/src/main/build.properties
idm/trunk/assembly/src/main/files/db/build.xml
idm/trunk/assembly/src/main/files/jboss/build.xml
idm/trunk/assembly/src/main/files/jboss/hibernate.cfg/hsqldb.hibernate.cfg.xml
idm/trunk/assembly/src/main/files/jboss/hibernate.cfg/mssql.hibernate.cfg.xml
idm/trunk/assembly/src/main/files/jboss/hibernate.cfg/mysql.hibernate.cfg.xml
idm/trunk/assembly/src/main/files/jboss/hibernate.cfg/oracle.hibernate.cfg.xml
idm/trunk/assembly/src/main/files/jboss/hibernate.cfg/postgresql.hibernate.cfg.xml
idm/trunk/assembly/src/main/files/jboss/hibernate.cfg/sybase.hibernate.cfg.xml
Log:
* remove unnecessary files.
Modified: idm/trunk/assembly/pom.xml
===================================================================
--- idm/trunk/assembly/pom.xml 2009-11-12 13:37:28 UTC (rev 929)
+++ idm/trunk/assembly/pom.xml 2009-11-12 15:30:33 UTC (rev 930)
@@ -16,7 +16,7 @@
</parent>
<properties>
- <hibernate-commons-annotations>3.0.0.ga</hibernate-commons-annotations>
+ <hibernate-commons-annotations>3.1.0.GA</hibernate-commons-annotations>
<hibernate-tools-version>3.2.0.ga</hibernate-tools-version>
<hsqldb-version>1.8.0.7</hsqldb-version>
<idm.version>${project.version}</idm.version>
Modified: idm/trunk/assembly/scripts/antrun-schema.xml
===================================================================
--- idm/trunk/assembly/scripts/antrun-schema.xml 2009-11-12 13:37:28 UTC (rev 929)
+++ idm/trunk/assembly/scripts/antrun-schema.xml 2009-11-12 15:30:33 UTC (rev 930)
@@ -10,7 +10,7 @@
<project>
<property name="db.scripts.dir" value="target/db/schema.scripts" />
- <property name="config.dir" value="src/main/config"/>
+ <property name="config.dir" value="src/main/files/jboss/hibernate.cfg"/>
<path id="classpath">
<pathelement path="${maven.runtime.classpath}"/>
Modified: idm/trunk/assembly/scripts/assembly-distro.xml
===================================================================
--- idm/trunk/assembly/scripts/assembly-distro.xml 2009-11-12 13:37:28 UTC (rev 929)
+++ idm/trunk/assembly/scripts/assembly-distro.xml 2009-11-12 15:30:33 UTC (rev 930)
@@ -14,21 +14,8 @@
<!-- Dependency Sets -->
<dependencySets>
<dependencySet>
- <!--<outputFileNameMapping>${artifact.artifactId}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>-->
- <!-- useStrictFiltering>true</useStrictFiltering -->
<unpack>false</unpack>
<scope>test</scope>
- <!-- excludes>
- <exclude>org.jboss.identity.idm.integration:idm-jboss5</exclude>
- <exclude>org.jboss.identity.idm:idm-cache</exclude>
- <exclude>org.jboss.identity.idm:idm-ldap</exclude>
- <exclude>org.jboss.identity.idm:idm-hibernate</exclude>
- <exclude>org.jboss.identity.idm:idm-core</exclude>
- <exclude>org.jboss.identity.idm:idm-api</exclude>
- <exclude>org.jboss.identity.idm:idm-common</exclude>
- <exclude>org.jboss.identity.idm:idm-spi</exclude>
- <exclude>org.jboss.identity.idm:idm-assembly</exclude>
- </excludes-->
<outputDirectory>lib</outputDirectory>
</dependencySet>
Modified: idm/trunk/assembly/src/main/build.properties
===================================================================
--- idm/trunk/assembly/src/main/build.properties 2009-11-12 13:37:28 UTC (rev 929)
+++ idm/trunk/assembly/src/main/build.properties 2009-11-12 15:30:33 UTC (rev 930)
@@ -1,5 +1,4 @@
-jbossidm.home=..
+jbossidm.home=.
database=hsqldburl
-jbossidm.version=1.0.0-SANPSHOT
jboss.home=/local/deploy/jboss-5.0.1.GA
jboss.server.configuration=default
\ No newline at end of file
Modified: idm/trunk/assembly/src/main/files/db/build.xml
===================================================================
--- idm/trunk/assembly/src/main/files/db/build.xml 2009-11-12 13:37:28 UTC (rev 929)
+++ idm/trunk/assembly/src/main/files/db/build.xml 2009-11-12 15:30:33 UTC (rev 930)
@@ -67,6 +67,4 @@
</java>
</target>
-
-
</project>
Modified: idm/trunk/assembly/src/main/files/jboss/build.xml
===================================================================
--- idm/trunk/assembly/src/main/files/jboss/build.xml 2009-11-12 13:37:28 UTC (rev 929)
+++ idm/trunk/assembly/src/main/files/jboss/build.xml 2009-11-12 15:30:33 UTC (rev 930)
@@ -1,11 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project name="jbossidm.jboss.install" default="install.jbossidm.into.jboss">
+<project name="jbossidm.jboss.install" default="deploy">
<!-- DEVELOPER SPECIFIC CONFIGURATIONS -->
<property file="../build.properties" />
-
<!-- JDBC PROPERTIES -->
<property file="${jbossidm.home}/db/jdbc/${database}.properties" />
@@ -21,14 +20,14 @@
</target>
<!-- ### MAIN TARGET TO INSTALL jbossidm INTO JBOSS ######################### -->
- <target name="install.jbossidm.into.jboss"
+ <target name="deploy"
depends="log.properties"
description="installs jbossidm into jboss">
<antcall target="internal.install.jbossidm.into.jboss5" />
<antcall target="internal.install.jbossidm.into.jboss.db.${database}" />
</target>
- <target name="uninstall.jbossidm" description="uninstall jbossidm from jboss">
+ <target name="undeploy" description="uninstall jbossidm from jboss">
<delete dir="${jboss.server.config.dir}/deploy/idm" />
<delete dir="${jboss.server.config.dir}/deployers/idm-deployer" />
</target>
@@ -78,7 +77,9 @@
<!-- ### THE HSQLDB SPECIFIC PART ####################################### -->
<target name="internal.install.jbossidm.into.jboss.db.hsqldb" />
-
+
+ <target name="internal.install.jbossidm.into.jboss.db.hsqldburl" />
+
<!-- ### THE MYSQL SPECIFIC PART ####################################### -->
<target name="internal.install.jbossidm.into.jboss.db.mysql">
<copy todir="${jboss.server.config.dir}/deploy/idm/idm-service.sar" overwrite="true">
Modified: idm/trunk/assembly/src/main/files/jboss/hibernate.cfg/hsqldb.hibernate.cfg.xml
===================================================================
--- idm/trunk/assembly/src/main/files/jboss/hibernate.cfg/hsqldb.hibernate.cfg.xml 2009-11-12 13:37:28 UTC (rev 929)
+++ idm/trunk/assembly/src/main/files/jboss/hibernate.cfg/hsqldb.hibernate.cfg.xml 2009-11-12 15:30:33 UTC (rev 930)
@@ -30,6 +30,9 @@
<!-- ask hibernate to do the schema population -->
<!-- property name="hibernate.hbm2ddl.auto">create-drop</property-->
+
+ <property name="cache.use_second_level_cache">true</property>
+ <property name="cache.use_query_cache">true</property>
<property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
<property name="hibernate.connection.datasource">java:jbossidmDS</property>
Added: idm/trunk/assembly/src/main/files/jboss/hibernate.cfg/hsqldburl.hibernate.cfg.xml
===================================================================
--- idm/trunk/assembly/src/main/files/jboss/hibernate.cfg/hsqldburl.hibernate.cfg.xml (rev 0)
+++ idm/trunk/assembly/src/main/files/jboss/hibernate.cfg/hsqldburl.hibernate.cfg.xml 2009-11-12 15:30:33 UTC (rev 930)
@@ -0,0 +1,58 @@
+<?xml version='1.0' encoding='utf-8'?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE hibernate-configuration PUBLIC
+ "-//Hibernate/Hibernate Configuration DTD//EN"
+ "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
+<hibernate-configuration>
+ <session-factory>
+
+ <!-- ask hibernate to do the schema population -->
+ <!-- property name="hibernate.hbm2ddl.auto">create-drop</property-->
+
+ <property name="cache.use_second_level_cache">true</property>
+ <property name="cache.use_query_cache">true</property>
+
+ <property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
+ <property name="hibernate.connection.datasource">java:jbossidmDS</property>
+ <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
+ <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
+ <property name="jta.UserTransaction">UserTransaction</property>
+
+ <!-- Mapping classes -->
+ <!-- all nessesary mappings are added programatically to the configuration in the store-->
+ <!-- this is for manual SF creation or when 'addHibernateMappings' is set to false in the store configuration-->
+ <mapping resource="mappings/HibernateRealm.hbm.xml"/>
+ <mapping resource="mappings/HibernateIdentityObject.hbm.xml"/>
+ <mapping resource="mappings/HibernateIdentityObjectCredential.hbm.xml"/>
+ <mapping resource="mappings/HibernateIdentityObjectCredentialType.hbm.xml"/>
+ <mapping resource="mappings/HibernateIdentityObjectAttribute.hbm.xml"/>
+ <mapping resource="mappings/HibernateIdentityObjectType.hbm.xml"/>
+ <mapping resource="mappings/HibernateIdentityObjectRelationship.hbm.xml"/>
+ <mapping resource="mappings/HibernateIdentityObjectRelationshipType.hbm.xml"/>
+ <mapping resource="mappings/HibernateIdentityObjectRelationshipName.hbm.xml"/>
+
+ </session-factory>
+</hibernate-configuration>
+
Modified: idm/trunk/assembly/src/main/files/jboss/hibernate.cfg/mssql.hibernate.cfg.xml
===================================================================
--- idm/trunk/assembly/src/main/files/jboss/hibernate.cfg/mssql.hibernate.cfg.xml 2009-11-12 13:37:28 UTC (rev 929)
+++ idm/trunk/assembly/src/main/files/jboss/hibernate.cfg/mssql.hibernate.cfg.xml 2009-11-12 15:30:33 UTC (rev 930)
@@ -28,11 +28,9 @@
<hibernate-configuration>
<session-factory>
- <property name="show_sql">false</property>
<property name="cache.use_second_level_cache">true</property>
- <property name="cache.use_query_cache">false</property>
+ <property name="cache.use_query_cache">true</property>
- <property name="current_session_context_class">thread</property>
<!-- ask hibernate to do the schema population -->
<!-- property name="hibernate.hbm2ddl.auto">create-drop</property-->
Modified: idm/trunk/assembly/src/main/files/jboss/hibernate.cfg/mysql.hibernate.cfg.xml
===================================================================
--- idm/trunk/assembly/src/main/files/jboss/hibernate.cfg/mysql.hibernate.cfg.xml 2009-11-12 13:37:28 UTC (rev 929)
+++ idm/trunk/assembly/src/main/files/jboss/hibernate.cfg/mysql.hibernate.cfg.xml 2009-11-12 15:30:33 UTC (rev 930)
@@ -30,7 +30,9 @@
<!-- ask hibernate to do the schema population -->
<!-- property name="hibernate.hbm2ddl.auto">create-drop</property-->
-
+ <property name="cache.use_second_level_cache">true</property>
+ <property name="cache.use_query_cache">true</property>
+
<property name="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>
<property name="hibernate.connection.datasource">java:jbossidmDS</property>
<property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
Modified: idm/trunk/assembly/src/main/files/jboss/hibernate.cfg/oracle.hibernate.cfg.xml
===================================================================
--- idm/trunk/assembly/src/main/files/jboss/hibernate.cfg/oracle.hibernate.cfg.xml 2009-11-12 13:37:28 UTC (rev 929)
+++ idm/trunk/assembly/src/main/files/jboss/hibernate.cfg/oracle.hibernate.cfg.xml 2009-11-12 15:30:33 UTC (rev 930)
@@ -31,6 +31,9 @@
<!-- ask hibernate to do the schema population -->
<!-- property name="hibernate.hbm2ddl.auto">create-drop</property-->
+ <property name="cache.use_second_level_cache">true</property>
+ <property name="cache.use_query_cache">true</property>
+
<property name="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</property>
<property name="hibernate.connection.datasource">java:jbossidmDS</property>
<property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
Modified: idm/trunk/assembly/src/main/files/jboss/hibernate.cfg/postgresql.hibernate.cfg.xml
===================================================================
--- idm/trunk/assembly/src/main/files/jboss/hibernate.cfg/postgresql.hibernate.cfg.xml 2009-11-12 13:37:28 UTC (rev 929)
+++ idm/trunk/assembly/src/main/files/jboss/hibernate.cfg/postgresql.hibernate.cfg.xml 2009-11-12 15:30:33 UTC (rev 930)
@@ -31,6 +31,9 @@
<!-- ask hibernate to do the schema population -->
<!-- property name="hibernate.hbm2ddl.auto">create-drop</property-->
+ <property name="cache.use_second_level_cache">true</property>
+ <property name="cache.use_query_cache">true</property>
+
<property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
<property name="hibernate.connection.datasource">java:jbossidmDS</property>
<property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
Modified: idm/trunk/assembly/src/main/files/jboss/hibernate.cfg/sybase.hibernate.cfg.xml
===================================================================
--- idm/trunk/assembly/src/main/files/jboss/hibernate.cfg/sybase.hibernate.cfg.xml 2009-11-12 13:37:28 UTC (rev 929)
+++ idm/trunk/assembly/src/main/files/jboss/hibernate.cfg/sybase.hibernate.cfg.xml 2009-11-12 15:30:33 UTC (rev 930)
@@ -28,11 +28,9 @@
<hibernate-configuration>
<session-factory>
- <property name="show_sql">false</property>
<property name="cache.use_second_level_cache">true</property>
- <property name="cache.use_query_cache">false</property>
+ <property name="cache.use_query_cache">true</property>
- <property name="current_session_context_class">thread</property>
<!-- ask hibernate to do the schema population -->
<!-- property name="hibernate.hbm2ddl.auto">create-drop</property-->
16 years, 6 months
JBoss Identity SVN: r929 - in idm/trunk: idm-core/src/main/java/org/jboss/identity/idm/impl/api and 3 other directories.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2009-11-12 08:37:28 -0500 (Thu, 12 Nov 2009)
New Revision: 929
Modified:
idm/trunk/example/simple/src/test/java/org/jboss/identity/idm/example/DBTestCase.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/SimpleAttribute.java
idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectAttribute.java
idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java
idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreTestCase.java
Log:
- fix updateAttributes() to add not present attributes istead of only update values of present ones
Modified: idm/trunk/example/simple/src/test/java/org/jboss/identity/idm/example/DBTestCase.java
===================================================================
--- idm/trunk/example/simple/src/test/java/org/jboss/identity/idm/example/DBTestCase.java 2009-11-11 22:47:31 UTC (rev 928)
+++ idm/trunk/example/simple/src/test/java/org/jboss/identity/idm/example/DBTestCase.java 2009-11-12 13:37:28 UTC (rev 929)
@@ -128,11 +128,13 @@
random.nextBytes(picture);
identitySession.getAttributesManager().addAttributes(johnDoe, new Attribute[] {new SimpleAttribute("picture", new byte[][]{picture})});
+ identitySession.getAttributesManager().addAttributes(johnDoe, new Attribute[] {new SimpleAttribute("emplyer", new String[]{"ACME1", "ACME2"})});
+ identitySession.getAttributesManager().addAttributes(johnDoe, new Attribute[] {new SimpleAttribute("hobby", new String[]{"BASE Jumping"})});
// Assert picture
Map<String, Attribute> attributes = identitySession.getAttributesManager().getAttributes(johnDoe);
- assertEquals(1, attributes.keySet().size());
+ assertEquals(3, attributes.keySet().size());
assertTrue(Arrays.equals((byte[])attributes.get("picture").getValue(), picture));
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/SimpleAttribute.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/SimpleAttribute.java 2009-11-11 22:47:31 UTC (rev 928)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/SimpleAttribute.java 2009-11-12 13:37:28 UTC (rev 929)
@@ -58,7 +58,11 @@
public SimpleAttribute(String name, Object value)
{
this.name = name;
- this.values.add(value);
+ if (value != null)
+ {
+ this.values.add(value);
+ }
+
}
public SimpleAttribute(Attribute attribute)
Modified: idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectAttribute.java
===================================================================
--- idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectAttribute.java 2009-11-11 22:47:31 UTC (rev 928)
+++ idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/model/hibernate/HibernateIdentityObjectAttribute.java 2009-11-12 13:37:28 UTC (rev 929)
@@ -36,9 +36,9 @@
public class HibernateIdentityObjectAttribute implements IdentityObjectAttribute
{
- public static final String TYPE_TEXT = "TEXT";
+ public static final String TYPE_TEXT = "text";
- public static final String TYPE_BINARY = "BINARY";
+ public static final String TYPE_BINARY = "binary";
private Long id;
@@ -101,6 +101,10 @@
public void setType(String newType)
{
+ if (!newType.equals(TYPE_TEXT) && !newType.equals(TYPE_BINARY))
+ {
+ throw new IllegalArgumentException("Type has not supported value." + " Name=" + name + "; type=" + type);
+ }
this.type = newType;
}
@@ -119,7 +123,7 @@
return Collections.unmodifiableSet(textValues);
}
- public void setTextValues(Set<String> textValues)
+ public void setTextValues(Collection<String> textValues)
{
this.textValues.clear();
this.textValues.addAll(textValues);
@@ -149,7 +153,7 @@
}
else
{
- throw new IllegalStateException("Type has not supported value");
+ throw new IllegalStateException("Type has not supported value." + " Name=" + name + "; type=" + type);
}
}
@@ -159,7 +163,7 @@
{
if (!(value instanceof String))
{
- throw new IllegalArgumentException("String value expected with a set type");
+ throw new IllegalArgumentException("String value expected with a set type." + " Name=" + name + "; type=" + type);
}
addTextValue((String)value);
}
@@ -167,14 +171,14 @@
{
if (!(value instanceof byte[]))
{
- throw new IllegalArgumentException("byte[] value expected with a set type");
+ throw new IllegalArgumentException("byte[] value expected with a set type." + " Name=" + name + "; type=" + type);
}
setBinaryValue((byte[])value);
}
else
{
- throw new IllegalStateException("Type has not supported value or has not been set");
+ throw new IllegalStateException("Type has not supported value or has not been set." + " Name=" + name + "; type=" + type);
}
}
@@ -192,7 +196,7 @@
}
else
{
- throw new IllegalStateException("Type has not supported value");
+ throw new IllegalStateException("Type has not supported value." + " Name=" + name + "; type=" + type);
}
}
@@ -212,7 +216,7 @@
}
else
{
- throw new IllegalStateException("Type has not supported value");
+ throw new IllegalStateException("Type has not supported value." + " Name=" + name + "; type=" + type);
}
}
}
Modified: idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java
===================================================================
--- idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java 2009-11-11 22:47:31 UTC (rev 928)
+++ idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java 2009-11-12 13:37:28 UTC (rev 929)
@@ -1658,8 +1658,6 @@
throw new IllegalArgumentException("attributes are null");
}
- //TODO: check if attribute values time is same as MD type
-
Map<String, IdentityObjectAttribute> mappedAttributes = new HashMap<String, IdentityObjectAttribute>();
Map<String, IdentityObjectAttributeMetaData> mdMap = attributesMetaData.get(identity.getIdentityType().getName());
@@ -1750,10 +1748,13 @@
// Default to text
String type = amd != null ? amd.getType() : IdentityObjectAttributeMetaData.TEXT_TYPE;
+ boolean present = false;
+
for (HibernateIdentityObjectAttribute storeAttribute : hibernateObject.getAttributes())
{
if (storeAttribute.getName().equals(name))
{
+ present = true;
if (storeAttribute.getType().equals(HibernateIdentityObjectAttribute.TYPE_TEXT))
{
if (!type.equals(IdentityObjectAttributeMetaData.TEXT_TYPE))
@@ -1779,9 +1780,6 @@
throw new IdentityException("Wrong attribute mapping. Attribute persisted as binary is mapped with: "
+ type + ". Attribute name: " + name);
}
-
-
-
storeAttribute.setBinaryValue((byte[])attribute.getValue());
}
else
@@ -1791,6 +1789,21 @@
break;
}
}
+
+ if (!present && attribute.getValues() != null && attribute.getValues().size() > 0)
+ {
+ HibernateIdentityObjectAttribute newAttribute = new HibernateIdentityObjectAttribute(hibernateObject, name, type);
+ if (type.equals(HibernateIdentityObjectAttribute.TYPE_TEXT))
+ {
+ newAttribute.setTextValues(attribute.getValues());
+ }
+ else if (type.equals(HibernateIdentityObjectAttribute.TYPE_BINARY))
+ {
+ newAttribute.setBinaryValue((byte[])attribute.getValue());
+ }
+ hibernateObject.addAttribute(newAttribute);
+ }
+
}
}
@@ -1951,7 +1964,7 @@
values.add(value.toString());
}
hibernateAttribute = new HibernateIdentityObjectAttribute(hibernateObject, name, HibernateIdentityObjectAttribute.TYPE_TEXT);
- hibernateAttribute.setTextValues(values);;
+ hibernateAttribute.setTextValues(values);
}
else if (type.equals(IdentityObjectAttributeMetaData.BINARY_TYPE))
{
Modified: idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreTestCase.java
===================================================================
--- idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreTestCase.java 2009-11-11 22:47:31 UTC (rev 928)
+++ idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreTestCase.java 2009-11-12 13:37:28 UTC (rev 929)
@@ -323,13 +323,27 @@
flush();
+ attrs = new IdentityObjectAttribute[]{
+ new SimpleAttribute("key4", new String[]{"val2"})
+ };
+
+ store.updateAttributes(ctx, user1, attrs);
+
+ flush();
+
+ persistedAttrs = store.getAttributes(ctx, user1);
+
+ assertEquals(4, persistedAttrs.keySet().size());
+ assertEquals("val2", persistedAttrs.get("key4").getValue().toString());
+
+
store.removeAttributes(ctx, user1, new String[] {"key3"});
flush();
persistedAttrs = store.getAttributes(ctx, user1);
- assertEquals(2, persistedAttrs.keySet().size());
+ assertEquals(3, persistedAttrs.keySet().size());
commit();
16 years, 6 months
JBoss Identity SVN: r928 - in idm/trunk: idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers and 1 other directories.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2009-11-11 17:47:31 -0500 (Wed, 11 Nov 2009)
New Revision: 928
Modified:
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/event/IdentityTypeEventListener.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/event/RelationshipEventListener.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/event/RoleEventListener.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/event/RoleTypeEventListener.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AbstractManager.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheIdentityStoreWrapper.java
Log:
- improve event API by passing current session object to listeners
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/event/IdentityTypeEventListener.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/event/IdentityTypeEventListener.java 2009-11-11 22:20:53 UTC (rev 927)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/event/IdentityTypeEventListener.java 2009-11-11 22:47:31 UTC (rev 928)
@@ -1,9 +1,6 @@
package org.jboss.identity.idm.api.event;
-import org.jboss.identity.idm.api.IdentityType;
-import org.jboss.identity.idm.api.Attribute;
-import org.jboss.identity.idm.api.User;
-import org.jboss.identity.idm.api.Credential;/*
+import org.jboss.identity.idm.api.*;/*
* JBoss, a division of Red Hat
* Copyright 2009, Red Hat Middleware, LLC, and individual contributors as indicated
* by the @authors tag. See the copyright.txt in the distribution for a
@@ -33,81 +30,93 @@
/**
* Method invoked before given IdentityType is created
+ * @param session
* @param identityType
*/
- void preCreate(IdentityType identityType);
+ void preCreate(IdentitySession session, IdentityType identityType);
/**
* Method invoked after given IdentityType is created
+ * @param session
* @param identityType
*/
- void postCreate(IdentityType identityType);
+ void postCreate(IdentitySession session, IdentityType identityType);
/**
* Method invoked before given IdentityType is removed
+ * @param session
* @param identityType
*/
- void preRemove(IdentityType identityType);
+ void preRemove(IdentitySession session, IdentityType identityType);
/**
* Method invoked after given IdentityType is removed
+ * @param session
* @param identityType
*/
- void postRemove(IdentityType identityType);
+ void postRemove(IdentitySession session, IdentityType identityType);
/**
* Method invoked before attributes are added for a given IdentityType
+ * @param session
* @param identityType
* @param attributes
*/
- void preAttributesAdd(IdentityType identityType, Attribute[] attributes);
+ void preAttributesAdd(IdentitySession session, IdentityType identityType, Attribute[] attributes);
/**
* Method invoked after attributes are added for a given IdentityType
+ * @param session
* @param identityType
* @param attributes
*/
- void postAttributesAdd(IdentityType identityType, Attribute[] attributes);
+ void postAttributesAdd(IdentitySession session, IdentityType identityType, Attribute[] attributes);
/**
* Method invoked before attributes are removed for a given IdentityType
+ * @param session
* @param identityType
* @param attributes
*/
- void preAttributesRemove(IdentityType identityType, String[] attributes);
+ void preAttributesRemove(IdentitySession session, IdentityType identityType, String[] attributes);
/**
* Method invoked after attributes are removed for a given IdentityType
+ * @param session
* @param identityType
* @param attributes
*/
- void postAttributesRemove(IdentityType identityType, String[] attributes);
+ void postAttributesRemove(IdentitySession session, IdentityType identityType, String[] attributes);
/**
* Method invoked before attributes are updated for a given IdentityType
+ * @param session
* @param identityType
* @param attributes
*/
- void preAttributesUpdate(IdentityType identityType, Attribute[] attributes);
+ void preAttributesUpdate(IdentitySession session, IdentityType identityType, Attribute[] attributes);
/**
* Method invoked after attributes are updated for a given IdentityType
+ * @param session
* @param identityType
* @param attributes
*/
- void postAttributesUpdate(IdentityType identityType, Attribute[] attributes);
+ void postAttributesUpdate(IdentitySession session, IdentityType identityType, Attribute[] attributes);
/**
* Method invoked before credential is updated for a given User
+ * @param session
* @param user
* @param credential
*/
- void preCredentialUpdate(User user, Credential credential);
+ void preCredentialUpdate(IdentitySession session, User user, Credential credential);
/**
* Method invoked after credential is updated for a given User
+ * @param session
* @param user
* @param credential
*/
- void postCredentialUpdate(User user, Credential credential);
+ void postCredentialUpdate(IdentitySession session, User user, Credential credential);
}
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/event/RelationshipEventListener.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/event/RelationshipEventListener.java 2009-11-11 22:20:53 UTC (rev 927)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/event/RelationshipEventListener.java 2009-11-11 22:47:31 UTC (rev 928)
@@ -1,7 +1,8 @@
package org.jboss.identity.idm.api.event;
import org.jboss.identity.idm.api.Group;
-import org.jboss.identity.idm.api.User;/*
+import org.jboss.identity.idm.api.User;
+import org.jboss.identity.idm.api.IdentitySession;/*
* JBoss, a division of Red Hat
* Copyright 2009, Red Hat Middleware, LLC, and individual contributors as indicated
* by the @authors tag. See the copyright.txt in the distribution for a
@@ -31,63 +32,71 @@
/**
* Method invoked before association is created between Group and User
+ * @param session
* @param parent
* @param member
*/
- void preUserAssociationCreate(Group parent, User member);
+ void preUserAssociationCreate(IdentitySession session, Group parent, User member);
/**
* Method invoked before association is created between Groups
- * \
+ *
+ * @param session
* @param parent
* @param member
*/
- void preGroupAssociationCreate(Group parent, Group member);
+ void preGroupAssociationCreate(IdentitySession session, Group parent, Group member);
/**
* Method invoked after association is created between Group and User
*
+ * @param session
* @param parent
* @param member
*/
- void postUserAssociationCreate(Group parent, User member);
+ void postUserAssociationCreate(IdentitySession session, Group parent, User member);
/**
* Method invoked after association is created between Groups
*
+ * @param session
* @param parent
* @param member
*/
- void postGroupAssociationCreate(Group parent, Group member);
+ void postGroupAssociationCreate(IdentitySession session, Group parent, Group member);
/**
* Method invoked before association is removed between Group and User
+ * @param session
* @param parent
* @param member
*/
- void preUserAssociationRemove(Group parent, User member);
+ void preUserAssociationRemove(IdentitySession session, Group parent, User member);
/**
* Method invoked before association is removed between Groups
+ * @param session
* @param parent
* @param member
*/
- void preGroupAssociationRemove(Group parent, Group member);
+ void preGroupAssociationRemove(IdentitySession session, Group parent, Group member);
/**
* Method invoked after association is removed between Group and User
*
+ * @param session
* @param parent
* @param member
*/
- void postUserAssociationRemove(Group parent, User member);
+ void postUserAssociationRemove(IdentitySession session, Group parent, User member);
/**
* Method invoked after association is removed between Groups
*
+ * @param session
* @param parent
* @param member
*/
- void postGroupAssociationRemove(Group parent, Group member);
+ void postGroupAssociationRemove(IdentitySession session, Group parent, Group member);
}
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/event/RoleEventListener.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/event/RoleEventListener.java 2009-11-11 22:20:53 UTC (rev 927)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/event/RoleEventListener.java 2009-11-11 22:47:31 UTC (rev 928)
@@ -1,6 +1,7 @@
package org.jboss.identity.idm.api.event;
import org.jboss.identity.idm.api.Role;
+import org.jboss.identity.idm.api.IdentitySession;
import java.util.Map;
import java.util.Collection;/*
@@ -33,54 +34,62 @@
/**
* Method invoked before Role is created
+ * @param session
* @param role
*/
- void preCreate(Role role);
+ void preCreate(IdentitySession session, Role role);
/**
* Method invoked after Role is created
+ * @param session
* @param role
*/
- void postCreate(Role role);
+ void postCreate(IdentitySession session, Role role);
/**
* Method invoked before Role is created
+ * @param session
* @param role
*/
- void preRemove(Role role);
+ void preRemove(IdentitySession session, Role role);
/**
* Method invoked after Role is created
+ * @param session
* @param role
*/
- void postRemove(Role role);
+ void postRemove(IdentitySession session, Role role);
/**
* Method invoked before properties are set
+ * @param session
* @param role
* @param properties
*/
- void prePropertiesSet(Role role, Map<String, String> properties);
+ void prePropertiesSet(IdentitySession session, Role role, Map<String, String> properties);
/**
* Method invoked after properties are set
+ * @param session
* @param role
* @param properties
*/
- void postPropertiesSet(Role role, Map<String, String> properties);
+ void postPropertiesSet(IdentitySession session, Role role, Map<String, String> properties);
/**
* Method invoked before properties are removed
+ * @param session
* @param role
* @param names
*/
- void prePropertiesRemove(Role role, Collection<String> names);
+ void prePropertiesRemove(IdentitySession session, Role role, Collection<String> names);
/**
* Method invoked after properties are removed
+ * @param session
* @param role
* @param names
*/
- void postPropertiesRemove(Role role, Collection<String> names);
+ void postPropertiesRemove(IdentitySession session, Role role, Collection<String> names);
}
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/event/RoleTypeEventListener.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/event/RoleTypeEventListener.java 2009-11-11 22:20:53 UTC (rev 927)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/event/RoleTypeEventListener.java 2009-11-11 22:47:31 UTC (rev 928)
@@ -1,6 +1,7 @@
package org.jboss.identity.idm.api.event;
import org.jboss.identity.idm.api.RoleType;
+import org.jboss.identity.idm.api.IdentitySession;
import java.util.Map;
import java.util.Collection;/*
@@ -33,55 +34,63 @@
/**
* Method invoked before RoleType is created
+ * @param session
* @param roleType
*/
- void preCreate(RoleType roleType);
+ void preCreate(IdentitySession session, RoleType roleType);
/**
* Method invoked after RoleType is created
+ * @param session
* @param roleType
*/
- void postCreate(RoleType roleType);
+ void postCreate(IdentitySession session, RoleType roleType);
/**
* Method invoked before RoleType is created
+ * @param session
* @param roleType
*/
- void preRemove(RoleType roleType);
+ void preRemove(IdentitySession session, RoleType roleType);
/**
* Method invoked after RoleType is created
+ * @param session
* @param roleType
*/
- void postRemove(RoleType roleType);
+ void postRemove(IdentitySession session, RoleType roleType);
/**
* Method invoked before properties are set
+ * @param session
* @param roleType
* @param properties
*/
- void prePropertiesSet(RoleType roleType, Map<String, String> properties);
+ void prePropertiesSet(IdentitySession session, RoleType roleType, Map<String, String> properties);
/**
* Method invoked after properties are set
+ * @param session
* @param roleType
* @param properties
*/
- void postPropertiesSet(RoleType roleType, Map<String, String> properties);
+ void postPropertiesSet(IdentitySession session, RoleType roleType, Map<String, String> properties);
/**
* Method invoked before properties are removed
+ * @param session
* @param roleType
* @param names
*/
- void prePropertiesRemove(RoleType roleType, Collection<String> names);
+ void prePropertiesRemove(IdentitySession session, RoleType roleType, Collection<String> names);
/**
* Method invoked after properties are removed
+ * @param session
* @param roleType
* @param names
*/
- void postPropertiesRemove(RoleType roleType, Collection<String> names);
+ void postPropertiesRemove(IdentitySession session, RoleType roleType, Collection<String> names);
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AbstractManager.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AbstractManager.java 2009-11-11 22:20:53 UTC (rev 927)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AbstractManager.java 2009-11-11 22:47:31 UTC (rev 928)
@@ -49,7 +49,7 @@
* @version : 0.1 $
*/
public abstract class AbstractManager
- implements Serializable, IdentityTypeEventListener, RelationshipEventListener, RoleTypeEventListener, RoleEventListener
+ implements Serializable
{
protected final IdentitySessionImpl identitySession;
@@ -287,7 +287,7 @@
{
if (el instanceof IdentityTypeEventListener)
{
- ((IdentityTypeEventListener)el).preCreate(identityType);
+ ((IdentityTypeEventListener)el).preCreate(identitySession, identityType);
}
}
}
@@ -298,7 +298,7 @@
{
if (el instanceof IdentityTypeEventListener)
{
- ((IdentityTypeEventListener)el).postCreate(identityType);
+ ((IdentityTypeEventListener)el).postCreate(identitySession, identityType);
}
}
}
@@ -309,7 +309,7 @@
{
if (el instanceof IdentityTypeEventListener)
{
- ((IdentityTypeEventListener)el).preRemove(identityType);
+ ((IdentityTypeEventListener)el).preRemove(identitySession, identityType);
}
}
}
@@ -320,7 +320,7 @@
{
if (el instanceof IdentityTypeEventListener)
{
- ((IdentityTypeEventListener)el).postRemove(identityType);
+ ((IdentityTypeEventListener)el).postRemove(identitySession, identityType);
}
}
}
@@ -331,7 +331,7 @@
{
if (el instanceof IdentityTypeEventListener)
{
- ((IdentityTypeEventListener)el).preAttributesAdd(identityType, attributes);
+ ((IdentityTypeEventListener)el).preAttributesAdd(identitySession, identityType, attributes);
}
}
}
@@ -342,7 +342,7 @@
{
if (el instanceof IdentityTypeEventListener)
{
- ((IdentityTypeEventListener)el).postAttributesAdd(identityType, attributes);
+ ((IdentityTypeEventListener)el).postAttributesAdd(identitySession, identityType, attributes);
}
}
}
@@ -353,7 +353,7 @@
{
if (el instanceof IdentityTypeEventListener)
{
- ((IdentityTypeEventListener)el).preAttributesRemove(identityType, attributes);
+ ((IdentityTypeEventListener)el).preAttributesRemove(identitySession, identityType, attributes);
}
}
}
@@ -364,7 +364,7 @@
{
if (el instanceof IdentityTypeEventListener)
{
- ((IdentityTypeEventListener)el).postAttributesRemove(identityType, attributes);
+ ((IdentityTypeEventListener)el).postAttributesRemove(identitySession, identityType, attributes);
}
}
}
@@ -375,7 +375,7 @@
{
if (el instanceof IdentityTypeEventListener)
{
- ((IdentityTypeEventListener)el).preAttributesUpdate(identityType, attributes);
+ ((IdentityTypeEventListener)el).preAttributesUpdate(identitySession, identityType, attributes);
}
}
}
@@ -386,7 +386,7 @@
{
if (el instanceof IdentityTypeEventListener)
{
- ((IdentityTypeEventListener)el).postAttributesUpdate(identityType, attributes);
+ ((IdentityTypeEventListener)el).postAttributesUpdate(identitySession, identityType, attributes);
}
}
}
@@ -397,7 +397,7 @@
{
if (el instanceof IdentityTypeEventListener)
{
- ((IdentityTypeEventListener)el).preCredentialUpdate(user, credential);
+ ((IdentityTypeEventListener)el).preCredentialUpdate(identitySession, user, credential);
}
}
}
@@ -408,7 +408,7 @@
{
if (el instanceof IdentityTypeEventListener)
{
- ((IdentityTypeEventListener)el).postCredentialUpdate(user, credential);
+ ((IdentityTypeEventListener)el).postCredentialUpdate(identitySession, user, credential);
}
}
}
@@ -419,7 +419,7 @@
{
if (el instanceof RelationshipEventListener)
{
- ((RelationshipEventListener)el).preUserAssociationCreate(parent, childs);
+ ((RelationshipEventListener)el).preUserAssociationCreate(identitySession, parent, childs);
}
}
}
@@ -430,7 +430,7 @@
{
if (el instanceof RelationshipEventListener)
{
- ((RelationshipEventListener)el).preGroupAssociationCreate(parent, childs);
+ ((RelationshipEventListener)el).preGroupAssociationCreate(identitySession, parent, childs);
}
}
}
@@ -441,7 +441,7 @@
{
if (el instanceof RelationshipEventListener)
{
- ((RelationshipEventListener)el).postUserAssociationCreate(parent, childs);
+ ((RelationshipEventListener)el).postUserAssociationCreate(identitySession, parent, childs);
}
}
}
@@ -452,7 +452,7 @@
{
if (el instanceof RelationshipEventListener)
{
- ((RelationshipEventListener)el).postGroupAssociationCreate(parent, childs);
+ ((RelationshipEventListener)el).postGroupAssociationCreate(identitySession, parent, childs);
}
}
}
@@ -463,7 +463,7 @@
{
if (el instanceof RelationshipEventListener)
{
- ((RelationshipEventListener)el).preUserAssociationRemove(parent, childs);
+ ((RelationshipEventListener)el).preUserAssociationRemove(identitySession, parent, childs);
}
}
}
@@ -474,7 +474,7 @@
{
if (el instanceof RelationshipEventListener)
{
- ((RelationshipEventListener)el).preGroupAssociationRemove(parent, childs);
+ ((RelationshipEventListener)el).preGroupAssociationRemove(identitySession, parent, childs);
}
}
}
@@ -485,7 +485,7 @@
{
if (el instanceof RelationshipEventListener)
{
- ((RelationshipEventListener)el).postUserAssociationRemove(parent, childs);
+ ((RelationshipEventListener)el).postUserAssociationRemove(identitySession, parent, childs);
}
}
}
@@ -496,7 +496,7 @@
{
if (el instanceof RelationshipEventListener)
{
- ((RelationshipEventListener)el).postGroupAssociationRemove(parent, childs);
+ ((RelationshipEventListener)el).postGroupAssociationRemove(identitySession, parent, childs);
}
}
}
@@ -507,7 +507,7 @@
{
if (el instanceof RoleTypeEventListener)
{
- ((RoleTypeEventListener)el).preCreate(roleType);
+ ((RoleTypeEventListener)el).preCreate(identitySession, roleType);
}
}
}
@@ -518,7 +518,7 @@
{
if (el instanceof RoleTypeEventListener)
{
- ((RoleTypeEventListener)el).postCreate(roleType);
+ ((RoleTypeEventListener)el).postCreate(identitySession, roleType);
}
}
}
@@ -529,7 +529,7 @@
{
if (el instanceof RoleTypeEventListener)
{
- ((RoleTypeEventListener)el).preRemove(roleType);
+ ((RoleTypeEventListener)el).preRemove(identitySession, roleType);
}
}
}
@@ -540,7 +540,7 @@
{
if (el instanceof RoleTypeEventListener)
{
- ((RoleTypeEventListener)el).postRemove(roleType);
+ ((RoleTypeEventListener)el).postRemove(identitySession, roleType);
}
}
}
@@ -551,7 +551,7 @@
{
if (el instanceof RoleTypeEventListener)
{
- ((RoleTypeEventListener)el).prePropertiesSet(roleType, properties);
+ ((RoleTypeEventListener)el).prePropertiesSet(identitySession, roleType, properties);
}
}
}
@@ -562,7 +562,7 @@
{
if (el instanceof RoleTypeEventListener)
{
- ((RoleTypeEventListener)el).postPropertiesSet(roleType, properties);
+ ((RoleTypeEventListener)el).postPropertiesSet(identitySession, roleType, properties);
}
}
}
@@ -573,7 +573,7 @@
{
if (el instanceof RoleEventListener)
{
- ((RoleEventListener)el).preCreate(role);
+ ((RoleEventListener)el).preCreate(identitySession, role);
}
}
}
@@ -584,7 +584,7 @@
{
if (el instanceof RoleEventListener)
{
- ((RoleEventListener)el).postCreate(role);
+ ((RoleEventListener)el).postCreate(identitySession, role);
}
}
}
@@ -595,7 +595,7 @@
{
if (el instanceof RoleEventListener)
{
- ((RoleEventListener)el).preRemove(role);
+ ((RoleEventListener)el).preRemove(identitySession, role);
}
}
}
@@ -606,7 +606,7 @@
{
if (el instanceof RoleEventListener)
{
- ((RoleEventListener)el).postRemove(role);
+ ((RoleEventListener)el).postRemove(identitySession, role);
}
}
}
@@ -617,7 +617,7 @@
{
if (el instanceof RoleEventListener)
{
- ((RoleEventListener)el).prePropertiesSet(role, properties);
+ ((RoleEventListener)el).prePropertiesSet(identitySession, role, properties);
}
}
}
@@ -628,7 +628,7 @@
{
if (el instanceof RoleEventListener)
{
- ((RoleEventListener)el).postPropertiesSet(role, properties);
+ ((RoleEventListener)el).postPropertiesSet(identitySession, role, properties);
}
}
}
@@ -639,7 +639,7 @@
{
if (el instanceof RoleTypeEventListener)
{
- ((RoleTypeEventListener)el).prePropertiesRemove(roleType, names);
+ ((RoleTypeEventListener)el).prePropertiesRemove(identitySession, roleType, names);
}
}
}
@@ -650,7 +650,7 @@
{
if (el instanceof RoleTypeEventListener)
{
- ((RoleTypeEventListener)el).postPropertiesRemove(roleType, names);
+ ((RoleTypeEventListener)el).postPropertiesRemove(identitySession, roleType, names);
}
}
}
@@ -661,7 +661,7 @@
{
if (el instanceof RoleEventListener)
{
- ((RoleEventListener)el).postPropertiesRemove(role, names);
+ ((RoleEventListener)el).postPropertiesRemove(identitySession, role, names);
}
}
}
@@ -672,7 +672,7 @@
{
if (el instanceof RoleEventListener)
{
- ((RoleEventListener)el).postPropertiesRemove(role, names);
+ ((RoleEventListener)el).postPropertiesRemove(identitySession, role, names);
}
}
}
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheIdentityStoreWrapper.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheIdentityStoreWrapper.java 2009-11-11 22:20:53 UTC (rev 927)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheIdentityStoreWrapper.java 2009-11-11 22:47:31 UTC (rev 928)
@@ -59,15 +59,15 @@
private final IdentityStore identityStore;
- public JBossCacheIdentityStoreWrapper(IdentityStore identityStore, IdentityStoreCacheProvider cacheSupport, String cacheNS) throws IdentityException
+ public JBossCacheIdentityStoreWrapper(IdentityStore identityStore, IdentityStoreCacheProvider cacheSupport, String cacheScope) throws IdentityException
{
- super(identityStore, cacheSupport, cacheNS);
+ super(identityStore, cacheSupport, cacheScope);
this.identityStore = identityStore;
log.fine("------------------------------------------------------");
log.fine("JBossCacheIdentityStoreWrapper created ....." +
- "(IdentityStore: " + identityStore.getId() + "; cache namespace: " + cacheNS + ")");
+ "(IdentityStore: " + identityStore.getId() + "; cache scope: " + cacheScope + ")");
log.fine("------------------------------------------------------");
}
16 years, 6 months
JBoss Identity SVN: r927 - idm/trunk/idm-cache/src/main/java/org/jboss/identity/idm/impl/cache.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2009-11-11 17:20:53 -0500 (Wed, 11 Nov 2009)
New Revision: 927
Modified:
idm/trunk/idm-cache/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheAPICacheProviderImpl.java
idm/trunk/idm-cache/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheIdentityStoreCacheProviderImpl.java
Log:
- improve caching layer logging
Modified: idm/trunk/idm-cache/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheAPICacheProviderImpl.java
===================================================================
--- idm/trunk/idm-cache/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheAPICacheProviderImpl.java 2009-11-11 22:03:01 UTC (rev 926)
+++ idm/trunk/idm-cache/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheAPICacheProviderImpl.java 2009-11-11 22:20:53 UTC (rev 927)
@@ -200,7 +200,7 @@
if (log.isLoggable(Level.FINER))
{
- log.finer(this.toString() + "User stored in cache: " + user.getId());
+ log.finer(this.toString() + "User stored in cache: " + user.getId() + ";namespace=" + ns);
}
}
@@ -216,7 +216,7 @@
if (log.isLoggable(Level.FINER) && user != null)
{
- log.finer(this.toString() + "User found in cache: id=" + user.getId());
+ log.finer(this.toString() + "User found in cache: id=" + user.getId() + ";namespace=" + ns);
}
return user;
@@ -233,7 +233,7 @@
if (log.isLoggable(Level.FINER))
{
- log.finer(this.toString() + "User removed from cache: id= " + id);
+ log.finer(this.toString() + "User removed from cache: id= " + id + ";namespace=" + ns);
}
}
@@ -248,7 +248,7 @@
if (log.isLoggable(Level.FINER))
{
log.finer(this.toString() + "User criteria search stored in cache: users.size()=" + users.size() +
- "; criteria.hash()=" + criteria.hashCode());
+ "; criteria.hash()=" + criteria.hashCode() + ";namespace=" + ns);
}
}
@@ -265,7 +265,7 @@
if (log.isLoggable(Level.FINER) && users != null)
{
log.finer(this.toString() + "User criteria search found in cache: users.size()=" + users.size() +
- "; criteria.hash()=" + criteria.hashCode());
+ "; criteria.hash()=" + criteria.hashCode() + ";namespace=" + ns);
}
return users;
@@ -283,7 +283,7 @@
getCache().getRoot().removeChild(Fqn.fromElements(getNamespacedFqn(ns), NODE_USERS_SEARCHES));
if (log.isLoggable(Level.FINER))
{
- log.finer(this.toString() + "Invalidating Users cache. Namespace:" + ns);
+ log.finer(this.toString() + "Invalidating Users cache. Namespace:" + ns + ";namespace=" + ns);
}
}
@@ -297,7 +297,7 @@
if (log.isLoggable(Level.FINER))
{
- log.finer(this.toString() + "Users count stored in cache: " + count);
+ log.finer(this.toString() + "Users count stored in cache: " + count + ";namespace=" + ns);
}
}
@@ -318,7 +318,7 @@
if (log.isLoggable(Level.FINER) && count != -1)
{
- log.finer(this.toString() + "User count found in cache: " + count);
+ log.finer(this.toString() + "User count found in cache: " + count + ";namespace=" + ns);
}
return count;
@@ -332,7 +332,7 @@
getCache().getRoot().removeChild(Fqn.fromElements(getNamespacedFqn(ns), NODE_USERS_COUNT));
if (log.isLoggable(Level.FINER))
{
- log.finer(this.toString() + "Invalidating User count. Namespace:" + ns);
+ log.finer(this.toString() + "Invalidating User count. Namespace:" + ns + ";namespace=" + ns);
}
}
@@ -346,7 +346,7 @@
if (log.isLoggable(Level.FINER))
{
- log.finer(this.toString() + "Group stored in cache: " + group.getKey());
+ log.finer(this.toString() + "Group stored in cache: " + group.getKey() + ";namespace=" + ns);
}
}
@@ -362,7 +362,7 @@
if (log.isLoggable(Level.FINER) && group != null)
{
- log.finer(this.toString() + "Group found in cache: id=" + group.getKey());
+ log.finer(this.toString() + "Group found in cache: id=" + group.getKey() + ";namespace=" + ns);
}
return group;
@@ -379,7 +379,8 @@
if (log.isLoggable(Level.FINER))
{
- log.finer(this.toString() + "Group removed from cache: id= " + GroupKey.parseKey(groupName, groupType));
+ log.finer(this.toString() + "Group removed from cache: id= " + GroupKey.parseKey(groupName, groupType)
+ + ";namespace=" + ns);
}
}
@@ -394,7 +395,7 @@
if (log.isLoggable(Level.FINER))
{
log.finer(this.toString() + "Group criteria search stored in cache: groups.size()=" + groups.size() +
- "; criteria.hash()=" + criteria.hashCode());
+ "; criteria.hash()=" + criteria.hashCode() + ";namespace=" + ns);
}
}
@@ -411,7 +412,7 @@
if (log.isLoggable(Level.FINER) && groups != null)
{
log.finer(this.toString() + "Group criteria search found in cache: groups.size()=" + groups.size() +
- "; criteria.hash()=" + criteria.hashCode());
+ "; criteria.hash()=" + criteria.hashCode() + ";namespace=" + ns);
}
return groups;
@@ -429,7 +430,7 @@
getCache().getRoot().removeChild(Fqn.fromElements(getNamespacedFqn(ns), NODE_GROUPS_SEARCHES));
if (log.isLoggable(Level.FINER))
{
- log.finer(this.toString() + "Invalidating Groups cache. Namespace:" + ns);
+ log.finer(this.toString() + "Invalidating Groups cache. Namespace:" + ns + ";namespace=" + ns);
}
}
@@ -443,7 +444,8 @@
if (log.isLoggable(Level.FINER))
{
- log.finer(this.toString() + "Group count stored in cache: type=" + groupType + "; count=" + count);
+ log.finer(this.toString() + "Group count stored in cache: type=" + groupType + "; count=" + count
+ + ";namespace=" + ns);
}
}
@@ -464,7 +466,8 @@
if (log.isLoggable(Level.FINER) && count != -1)
{
- log.finer(this.toString() + "Group count found in cache: groupType=" + groupType + "; count=" + count);
+ log.finer(this.toString() + "Group count found in cache: groupType=" + groupType + "; count=" + count
+ + ";namespace=" + ns);
}
return count;
@@ -493,7 +496,7 @@
if (log.isLoggable(Level.FINER))
{
- log.finer(this.toString() + "Role stored in cache: " + role);
+ log.finer(this.toString() + "Role stored in cache: " + role + ";namespace=" + ns);
}
}
@@ -509,7 +512,7 @@
if (log.isLoggable(Level.FINER) && result != null)
{
- log.finer(this.toString() + "Role found in cache: id=" + result);
+ log.finer(this.toString() + "Role found in cache: id=" + result + ";namespace=" + ns);
}
return result;
@@ -534,7 +537,7 @@
if (log.isLoggable(Level.FINER))
{
- log.finer(this.toString() + "RoleType stored in cache: name=" + role.getName());
+ log.finer(this.toString() + "RoleType stored in cache: name=" + role.getName() + ";namespace=" + ns);
}
}
@@ -550,7 +553,7 @@
if (log.isLoggable(Level.FINER) && result != null)
{
- log.finer(this.toString() + "RoleType found in cache: name=" + role.getName());
+ log.finer(this.toString() + "RoleType found in cache: name=" + role.getName() + ";namespace=" + ns);
}
return result;
@@ -574,7 +577,8 @@
if (log.isLoggable(Level.FINER))
{
- log.finer(this.toString() + "Attributes stored in cache: id=" + id + "; attributes.size()=" + attributes.size());
+ log.finer(this.toString() + "Attributes stored in cache: id=" + id + "; attributes.size()="
+ + attributes.size() + ";namespace=" + ns);
}
}
@@ -591,7 +595,7 @@
if (log.isLoggable(Level.FINER) && attributes != null)
{
log.finer(this.toString() + "Attributes search found in cache: attributes.size()=" + attributes.size() +
- "; id=" + id);
+ "; id=" + id + ";namespace=" + ns);
}
return attributes;
@@ -628,7 +632,8 @@
if (log.isLoggable(Level.FINER))
{
- log.finer(this.toString() + "Role properties stored in cache: role=" + role + "; properties.size()=" + properties.size());
+ log.finer(this.toString() + "Role properties stored in cache: role=" + role + "; properties.size()="
+ + properties.size() + ";namespace=" + ns);
}
}
@@ -645,7 +650,7 @@
if (log.isLoggable(Level.FINER) && props != null)
{
log.finer(this.toString() + "Role properties found in cache: properties.size()=" + props.size() +
- "; role=" + role);
+ "; role=" + role + ";namespace=" + ns);
}
return props;
@@ -682,7 +687,8 @@
if (log.isLoggable(Level.FINER))
{
- log.finer(this.toString() + "RoleType properties stored in cache: roleType=" + roleType + "; properties.size()=" + properties.size());
+ log.finer(this.toString() + "RoleType properties stored in cache: roleType=" + roleType
+ + "; properties.size()=" + properties.size() + ";namespace=" + ns);
}
}
@@ -699,7 +705,7 @@
if (log.isLoggable(Level.FINER) && props != null)
{
log.finer(this.toString() + "RoleType properties found in cache: properties.size()=" + props.size() +
- "; roleType=" + roleType);
+ "; roleType=" + roleType + ";namespace=" + ns);
}
return props;
@@ -749,7 +755,8 @@
if (log.isLoggable(Level.FINER))
{
- log.finer(this.toString() + "User search stored in cache: results.size()=" + results.size());
+ log.finer(this.toString() + "User search stored in cache: results.size()=" + results.size()
+ + ";namespace=" + ns);
}
}
@@ -765,7 +772,8 @@
if (log.isLoggable(Level.FINER) && props != null)
{
- log.finer(this.toString() + "User search found in cache: properties.size()=" + props.size());
+ log.finer(this.toString() + "User search found in cache: properties.size()=" + props.size()
+ + ";namespace=" + ns);
}
return props;
@@ -784,7 +792,7 @@
if (log.isLoggable(Level.FINER))
{
- log.finer(this.toString() + "Group search stored in cache: results.size()=" + results.size());
+ log.finer(this.toString() + "Group search stored in cache: results.size()=" + results.size() + ";namespace=" + ns);
}
}
@@ -800,7 +808,7 @@
if (log.isLoggable(Level.FINER) && results != null)
{
- log.finer(this.toString() + "Group search found in cache: results.size()=" + results.size());
+ log.finer(this.toString() + "Group search found in cache: results.size()=" + results.size() + ";namespace=" + ns);
}
return results;
@@ -819,7 +827,7 @@
if (log.isLoggable(Level.FINER))
{
- log.finer(this.toString() + "Relationship search stored in cache: result=" + result);
+ log.finer(this.toString() + "Relationship search stored in cache: result=" + result + ";namespace=" + ns);
}
}
@@ -835,7 +843,7 @@
if (log.isLoggable(Level.FINER) && result != null)
{
- log.finer(this.toString() + "Relationship search found in cache: properties.size()=" + result);
+ log.finer(this.toString() + "Relationship search found in cache: properties.size()=" + result + ";namespace=" + ns);
}
return result;
@@ -854,7 +862,7 @@
if (log.isLoggable(Level.FINER))
{
- log.finer(this.toString() + "Role search stored in cache: results.size()=" + results.size());
+ log.finer(this.toString() + "Role search stored in cache: results.size()=" + results.size() + ";namespace=" + ns);
}
}
@@ -870,7 +878,7 @@
if (log.isLoggable(Level.FINER) && results != null)
{
- log.finer(this.toString() + "Role search found in cache: results.size()=" + results.size());
+ log.finer(this.toString() + "Role search found in cache: results.size()=" + results.size() + ";namespace=" + ns);
}
return results;
@@ -889,7 +897,7 @@
if (log.isLoggable(Level.FINER))
{
- log.finer(this.toString() + "RoleType search stored in cache: results.size()=" + results.size());
+ log.finer(this.toString() + "RoleType search stored in cache: results.size()=" + results.size() + ";namespace=" + ns);
}
}
@@ -905,7 +913,7 @@
if (log.isLoggable(Level.FINER) && results != null)
{
- log.finer(this.toString() + "RoleType search found in cache: results.size()=" + results.size());
+ log.finer(this.toString() + "RoleType search found in cache: results.size()=" + results.size() + ";namespace=" + ns);
}
return results;
@@ -936,7 +944,8 @@
if (log.isLoggable(Level.FINER))
{
- log.finer(this.toString() + "User query stored in cache: q.hashCode()=" + q.hashCode() + "; results.size()=" + results.size());
+ log.finer(this.toString() + "User query stored in cache: q.hashCode()=" + q.hashCode()
+ + "; results.size()=" + results.size() + ";namespace=" + ns);
}
}
@@ -950,7 +959,8 @@
if (log.isLoggable(Level.FINER))
{
- log.finer(this.toString() + "User query stored in cache: q.hashCode()=" + q.hashCode() + "; user=" + user);
+ log.finer(this.toString() + "User query stored in cache: q.hashCode()=" + q.hashCode() + "; user=" + user
+ + ";namespace=" + ns);
}
}
@@ -967,7 +977,7 @@
if (log.isLoggable(Level.FINER) && users != null)
{
log.finer(this.toString() + "User query found in cache: users.size()=" + users.size() +
- "; query.hash()=" + q.hashCode());
+ "; query.hash()=" + q.hashCode() + ";namespace=" + ns);
}
return users;
@@ -988,7 +998,7 @@
if (log.isLoggable(Level.FINER) && users != null)
{
- log.finer(this.toString() + "User query found in cache: user=" + users);
+ log.finer(this.toString() + "User query found in cache: user=" + users + ";namespace=" + ns);
}
return users;
@@ -1016,7 +1026,8 @@
if (log.isLoggable(Level.FINER))
{
- log.finer(this.toString() + "Group query stored in cache: q.hashCode()=" + q.hashCode() + "; results.size()=" + results.size());
+ log.finer(this.toString() + "Group query stored in cache: q.hashCode()=" + q.hashCode()
+ + "; results.size()=" + results.size() + ";namespace=" + ns);
}
}
@@ -1030,7 +1041,8 @@
if (log.isLoggable(Level.FINER))
{
- log.finer(this.toString() + "Group query stored in cache: q.hashCode()=" + q.hashCode() + "; group=" + group);
+ log.finer(this.toString() + "Group query stored in cache: q.hashCode()=" + q.hashCode()
+ + "; group=" + group + ";namespace=" + ns);
}
}
@@ -1047,7 +1059,7 @@
if (log.isLoggable(Level.FINER) && groups != null)
{
log.finer(this.toString() + "Group query found in cache: groups.size()=" + groups.size() +
- "; query.hash()=" + q.hashCode());
+ "; query.hash()=" + q.hashCode() + ";namespace=" + ns);
}
return groups;
@@ -1068,7 +1080,7 @@
if (log.isLoggable(Level.FINER) && group != null)
{
- log.finer(this.toString() + "Group query found in cache: group=" + group);
+ log.finer(this.toString() + "Group query found in cache: group=" + group + ";namespace=" + ns);
}
return group;
@@ -1096,7 +1108,8 @@
if (log.isLoggable(Level.FINER))
{
- log.finer(this.toString() + "Role query stored in cache: q.hashCode()=" + q.hashCode() + "; results.size()=" + results.size());
+ log.finer(this.toString() + "Role query stored in cache: q.hashCode()=" + q.hashCode()
+ + "; results.size()=" + results.size() + ";namespace=" + ns);
}
}
public void putRoleQueryUnique(String ns, RoleQuery q, Role role)
@@ -1109,7 +1122,8 @@
if (log.isLoggable(Level.FINER))
{
- log.finer(this.toString() + "Role query stored in cache: q.hashCode()=" + q.hashCode() + "; role=" + role);
+ log.finer(this.toString() + "Role query stored in cache: q.hashCode()=" + q.hashCode() + "; role=" + role
+ + ";namespace=" + ns);
}
}
@@ -1126,7 +1140,7 @@
if (log.isLoggable(Level.FINER) && roles != null)
{
log.finer(this.toString() + "Role query found in cache: users.size()=" + roles.size() +
- "; query.hash()=" + q.hashCode());
+ "; query.hash()=" + q.hashCode() + ";namespace=" + ns);
}
return roles;
@@ -1147,7 +1161,7 @@
if (log.isLoggable(Level.FINER) && role != null)
{
- log.finer(this.toString() + "Role query found in cache: role=" + role);
+ log.finer(this.toString() + "Role query found in cache: role=" + role + ";namespace=" + ns);
}
return role;
Modified: idm/trunk/idm-cache/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheIdentityStoreCacheProviderImpl.java
===================================================================
--- idm/trunk/idm-cache/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheIdentityStoreCacheProviderImpl.java 2009-11-11 22:03:01 UTC (rev 926)
+++ idm/trunk/idm-cache/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheIdentityStoreCacheProviderImpl.java 2009-11-11 22:20:53 UTC (rev 927)
@@ -186,7 +186,8 @@
if (log.isLoggable(Level.FINER))
{
- log.finer(this.toString() + "IdentityObject count stored in cache: " + count + "; type=" + type);
+ log.finer(this.toString() + "IdentityObject count stored in cache: " + count + "; type=" + type
+ + ";namespace=" + ns);
}
}
@@ -207,7 +208,8 @@
if (log.isLoggable(Level.FINER) && count != -1)
{
- log.finer(this.toString() + "IdentityObject count found in cache: " + count + "; type=" + type);
+ log.finer(this.toString() + "IdentityObject count found in cache: " + count + "; type=" + type
+ + ";namespace=" + ns);
}
return count;
@@ -221,7 +223,8 @@
getCache().getRoot().removeChild(Fqn.fromElements(getNamespacedFqn(ns), NODE_IO_COUNT, type));
if (log.isLoggable(Level.FINER))
{
- log.finer(this.toString() + "Invalidating IdentityObject count. Namespace:" + ns + "; type=" + type);
+ log.finer(this.toString() + "Invalidating IdentityObject count. Namespace:" + ns + "; type=" + type
+ + ";namespace=" + ns);
}
}
@@ -235,7 +238,8 @@
if (log.isLoggable(Level.FINER))
{
- log.finer(this.toString() + "IdentityObject search stored in cache: results.size()=" + results.size());
+ log.finer(this.toString() + "IdentityObject search stored in cache: results.size()=" + results.size()
+ + ";namespace=" + ns);
}
}
@@ -251,7 +255,8 @@
if (log.isLoggable(Level.FINER) && results != null)
{
- log.finer(this.toString() + "IdentityObject search found in cache: results.size()=" + results.size());
+ log.finer(this.toString() + "IdentityObject search found in cache: results.size()=" + results.size()
+ + ";namespace=" + ns);
}
return results;
@@ -279,7 +284,8 @@
if (log.isLoggable(Level.FINER))
{
- log.finer(this.toString() + "IdentityObjectRelationship search stored in cache: results.size()=" + results.size());
+ log.finer(this.toString() + "IdentityObjectRelationship search stored in cache: results.size()=" + results.size()
+ + ";namespace=" + ns);
}
}
@@ -295,7 +301,8 @@
if (log.isLoggable(Level.FINER) && results != null)
{
- log.finer(this.toString() + "IdentityObjectRelationship search found in cache: results.size()=" + results.size());
+ log.finer(this.toString() + "IdentityObjectRelationship search found in cache: results.size()=" + results.size()
+ + ";namespace=" + ns);
}
return results;
@@ -323,7 +330,8 @@
if (log.isLoggable(Level.FINER))
{
- log.finer(this.toString() + "IdentityObjectRelationshipName search stored in cache: results.size()=" + results.size());
+ log.finer(this.toString() + "IdentityObjectRelationshipName search stored in cache: results.size()=" + results.size()
+ + ";namespace=" + ns);
}
}
@@ -339,7 +347,8 @@
if (log.isLoggable(Level.FINER) && results != null)
{
- log.finer(this.toString() + "IdentityObjectRelationshipName search found in cache: results.size()=" + results.size());
+ log.finer(this.toString() + "IdentityObjectRelationshipName search found in cache: results.size()=" + results.size()
+ + ";namespace=" + ns);
}
return results;
@@ -367,7 +376,8 @@
if (log.isLoggable(Level.FINER))
{
- log.finer(this.toString() + "IdentityObjectRelationship properties stored in cache: relationship=" + relationship + "; properties.size()=" + properties.size());
+ log.finer(this.toString() + "IdentityObjectRelationship properties stored in cache: relationship="
+ + relationship + "; properties.size()=" + properties.size() + ";namespace=" + ns);
}
}
@@ -393,7 +403,7 @@
if (log.isLoggable(Level.FINER) && props != null)
{
log.finer(this.toString() + "IdentityObjectRelationship properties found in cache: properties.size()=" + props.size() +
- "; relationship=" + relationship);
+ "; relationship=" + relationship + ";namespace=" + ns);
}
return props;
@@ -407,7 +417,8 @@
getCache().getRoot().removeChild(getFqn(ns, NODE_REL_PROPS, decode(relationship)));
if (log.isLoggable(Level.FINER))
{
- log.finer(this.toString() + "Invalidating IdentityObjectRelationship properties. Namespace:" + ns + "; relationship=" + relationship);
+ log.finer(this.toString() + "Invalidating IdentityObjectRelationship properties. Namespace:" + ns
+ + "; relationship=" + relationship + ";namespace=" + ns);
}
}
@@ -430,7 +441,8 @@
if (log.isLoggable(Level.FINER))
{
- log.finer(this.toString() + "IdentityObjectRelationshipName properties stored in cache: name=" + name + "; properties.size()=" + properties.size());
+ log.finer(this.toString() + "IdentityObjectRelationshipName properties stored in cache: name="
+ + name + "; properties.size()=" + properties.size() + ";namespace=" + ns);
}
}
@@ -447,7 +459,7 @@
if (log.isLoggable(Level.FINER) && props != null)
{
log.finer(this.toString() + "IdentityObjectRelationshipName properties found in cache: properties.size()=" + props.size() +
- "; name=" + name);
+ "; name=" + name + ";namespace=" + ns);
}
return props;
@@ -461,7 +473,8 @@
getCache().getRoot().removeChild(getFqn(ns, NODE_REL_NAME_PROPS, relationship));
if (log.isLoggable(Level.FINER))
{
- log.finer(this.toString() + "Invalidating IdentityObjectRelationshipName properties. Namespace:" + ns + "; name=" + relationship);
+ log.finer(this.toString() + "Invalidating IdentityObjectRelationshipName properties." +
+ " Namespace:" + ns + "; name=" + relationship);
}
}
@@ -470,7 +483,8 @@
getCache().getRoot().removeChild(getFqn(ns, NODE_REL_NAME_PROPS));
if (log.isLoggable(Level.FINER))
{
- log.finer(this.toString() + "Invalidating IdentityObjectRelationshipName properties. Namespace:" + ns);
+ log.finer(this.toString() + "Invalidating IdentityObjectRelationshipName properties. " +
+ "Namespace:" + ns);
}
}
@@ -485,7 +499,8 @@
if (log.isLoggable(Level.FINER))
{
- log.finer(this.toString() + "IdentityObject attributes stored in cache: io=" + io + "; attributes.size()=" + attributes.size());
+ log.finer(this.toString() + "IdentityObject attributes stored in cache: io=" + io
+ + "; attributes.size()=" + attributes.size() + ";namespace=" + ns);
}
}
@@ -502,7 +517,7 @@
if (log.isLoggable(Level.FINER) && props != null)
{
log.finer(this.toString() + "IIdentityObject attributes found in cache: attributes.size()=" + props.size() +
- "; io=" + io);
+ "; io=" + io + ";namespace=" + ns);
}
return props;
16 years, 6 months
JBoss Identity SVN: r926 - idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/store/hibernate.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2009-11-11 17:03:01 -0500 (Wed, 11 Nov 2009)
New Revision: 926
Modified:
idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java
Log:
- better implementation of findIdentityObjectByUniqueAttribute()
Modified: idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java
===================================================================
--- idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java 2009-11-11 20:46:11 UTC (rev 925)
+++ idm/trunk/idm-hibernate/src/main/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreImpl.java 2009-11-11 22:03:01 UTC (rev 926)
@@ -2034,17 +2034,60 @@
Session session = getHibernateSession(invocationCtx);
- Query q = session.createQuery("select a from HibernateIdentityObjectAttribute a where a.identityObject.identityType = :identityType " +
- "and a.name = :attributeName and :value = any elements(a.textValues)");
- Set attrValues = new HashSet();
- attrValues.addAll(attribute.getValues());
- List<HibernateIdentityObjectAttribute> attrs = (List<HibernateIdentityObjectAttribute>)
- q.setParameter("identityType", hiot)
- .setParameter("attributeName", attrMappedName)
- .setParameter("value", attribute.getValue()).list();
+ if (attribute.getValues() == null || attribute.getValues().size() == 0)
+ {
+ return null;
+ }
+ boolean attrDuctTypeText = true;
+
+ if (attribute.getValue() instanceof byte[])
+ {
+ attrDuctTypeText = false;
+ }
+
+ StringBuffer queryString = new StringBuffer("select a from HibernateIdentityObjectAttribute a where a.identityObject.identityType = :identityType " +
+ "and a.name = :attributeName");
+
+ if (attrDuctTypeText)
+ {
+ for (int i = 0; i < attribute.getValues().size(); i++)
+ {
+ String paramName = " :value" + i;
+ queryString.append(" and").append(paramName).append(" = any elements(a.textValues)");
+
+ }
+ }
+ else
+ {
+ queryString.append(" and :value = a.binaryValue");
+ }
+
+
+ Query q = session.createQuery(queryString.toString());
+ q.setParameter("identityType", hiot)
+ .setParameter("attributeName", attrMappedName);
+
+ if (attrDuctTypeText)
+ {
+ int i = 0;
+ for (Object o : attribute.getValues())
+ {
+ String value = o.toString();
+ String paramName = "value" + i;
+ q.setParameter(paramName, value);
+ i++;
+ }
+ }
+ else
+ {
+ q.setParameter("value", attribute.getValue());
+ }
+
+ List<HibernateIdentityObjectAttribute> attrs = (List<HibernateIdentityObjectAttribute>)q.list();
+
if (attrs.size() == 0)
{
return null;
16 years, 6 months
JBoss Identity SVN: r925 - in idm/trunk: idm-api/src/main/java/org/jboss/identity/idm/api and 14 other directories.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2009-11-11 15:46:11 -0500 (Wed, 11 Nov 2009)
New Revision: 925
Added:
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/model/GroupKey.java
Removed:
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RealmManager.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/model/GroupId.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleGroupType.java
Modified:
idm/trunk/example/simple/src/test/java/org/jboss/identity/idm/example/InjectSFTestCase.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/Group.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/IdentitySearchCriteria.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/IdentityType.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/PersistenceManager.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RelationshipManager.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RoleManager.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/User.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/cfg/IdentityConfigurationRegistry.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/GroupQueryBuilder.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/RoleQueryBuilder.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/UserQueryBuilder.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/APICacheProvider.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/GroupSearch.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/RoleSearch.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/RoleTypeSearch.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/UserSearch.java
idm/trunk/idm-auth/src/main/java/org/jboss/identity/idm/auth/JBossIdentityIDMLoginModule.java
idm/trunk/idm-cache/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheAPICacheProviderImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/IdentitySearchCriteriaImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleGroup.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleUser.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/AbstractQuery.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/AbstractQueryBuilder.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/GroupQueryBuilderImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/GroupQueryExecutorImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/GroupQueryImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/RoleQueryBuilderImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryBuilderImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AbstractManager.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AttributesManagerImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/PersistenceManagerImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RelationshipManagerImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RoleManagerImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/RelationshipSearchImpl.java
idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/configuration/jaxb2/JAXB2IdentityConfiguration.java
idm/trunk/idm-core/src/test/java/org/jboss/identity/idm/impl/store/CommonIdentityStoreTest.java
idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/GroupQueryTest.java
idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/ModelTestCase.java
idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/PersistenceManagerTest.java
idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/RelationshipManagerTest.java
idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/RoleManagerTest.java
idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/RoleQueryTest.java
idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/UserQueryTest.java
idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreTestCase.java
Log:
- API refactoring introducing IdentityType.getKey(). groupKey instead of id should be less confusing
Modified: idm/trunk/example/simple/src/test/java/org/jboss/identity/idm/example/InjectSFTestCase.java
===================================================================
--- idm/trunk/example/simple/src/test/java/org/jboss/identity/idm/example/InjectSFTestCase.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/example/simple/src/test/java/org/jboss/identity/idm/example/InjectSFTestCase.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -89,30 +89,30 @@
// Use username nad group ids instead of objects
- String johnDoeUser = identitySession.getPersistenceManager().createUser("John Doe").getId();
- String aliceUser = identitySession.getPersistenceManager().createUser("Alice").getId();
- String evaUser = identitySession.getPersistenceManager().createUser("Eva").getId();
+ String johnDoeUser = identitySession.getPersistenceManager().createUser("John Doe").getKey();
+ String aliceUser = identitySession.getPersistenceManager().createUser("Alice").getKey();
+ String evaUser = identitySession.getPersistenceManager().createUser("Eva").getKey();
- String acmeOrgId = identitySession.getPersistenceManager().createGroup("ACME", ORGANIZATION).getId();
+ String acmeOrgId = identitySession.getPersistenceManager().createGroup("ACME", ORGANIZATION).getKey();
- String itGroupId = identitySession.getPersistenceManager().createGroup("IT", GROUP).getId();
- String hrGroupId = identitySession.getPersistenceManager().createGroup("HR", GROUP).getId();
+ String itGroupId = identitySession.getPersistenceManager().createGroup("IT", GROUP).getKey();
+ String hrGroupId = identitySession.getPersistenceManager().createGroup("HR", GROUP).getKey();
- identitySession.getRelationshipManager().associateGroupsByIds(acmeOrgId, itGroupId);
- identitySession.getRelationshipManager().associateGroupsByIds(acmeOrgId, hrGroupId);
+ identitySession.getRelationshipManager().associateGroupsByKeys(acmeOrgId, itGroupId);
+ identitySession.getRelationshipManager().associateGroupsByKeys(acmeOrgId, hrGroupId);
- identitySession.getRelationshipManager().associateUserByIds(itGroupId, johnDoeUser);
- identitySession.getRelationshipManager().associateUserByIds(itGroupId, aliceUser);
+ identitySession.getRelationshipManager().associateUserByKeys(itGroupId, johnDoeUser);
+ identitySession.getRelationshipManager().associateUserByKeys(itGroupId, aliceUser);
- identitySession.getRelationshipManager().associateUserByIds(hrGroupId, evaUser);
+ identitySession.getRelationshipManager().associateUserByKeys(hrGroupId, evaUser);
identitySession.getRoleManager().createRoleType("manager");
identitySession.getRoleManager().createRole("manager", johnDoeUser, itGroupId);
// John belongs to IT and not HR
- assertTrue(identitySession.getRelationshipManager().isAssociatedByIds(itGroupId, johnDoeUser));
- assertFalse(identitySession.getRelationshipManager().isAssociatedByIds(hrGroupId, johnDoeUser));
+ assertTrue(identitySession.getRelationshipManager().isAssociatedByKeys(itGroupId, johnDoeUser));
+ assertFalse(identitySession.getRelationshipManager().isAssociatedByKeys(hrGroupId, johnDoeUser));
// John is manager of IT and not HR
assertTrue(identitySession.getRoleManager().hasRole(johnDoeUser, itGroupId, "manager"));
@@ -140,8 +140,8 @@
assertTrue(Arrays.equals((byte[])attributes.get("picture").getValue(), picture));
- String xUser = identitySession.getPersistenceManager().createUser("x").getId();
- String someGroupId = identitySession.getPersistenceManager().createGroup("someGroup", GROUP).getId();
+ String xUser = identitySession.getPersistenceManager().createUser("x").getKey();
+ String someGroupId = identitySession.getPersistenceManager().createGroup("someGroup", GROUP).getKey();
identitySession.getRoleManager().createRole("manager", xUser, someGroupId);
@@ -149,9 +149,9 @@
assertEquals(1, identitySession.getRoleManager().findGroupsWithRelatedRole(xUser, GROUP, null).size());
assertEquals(1, identitySession.getRoleManager().findGroupsWithRelatedRole(xUser, null).size());
- String otherGroupId = identitySession.getPersistenceManager().createGroup("otherGroup", GROUP).getId();
+ String otherGroupId = identitySession.getPersistenceManager().createGroup("otherGroup", GROUP).getKey();
- identitySession.getRelationshipManager().associateUserByIds(otherGroupId, xUser);
+ identitySession.getRelationshipManager().associateUserByKeys(otherGroupId, xUser);
assertEquals(1, identitySession.getRelationshipManager().findAssociatedGroups(xUser, GROUP, null).size());
assertEquals(1, identitySession.getRoleManager().findGroupsWithRelatedRole(xUser, GROUP, null).size());
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/Group.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/Group.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/Group.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -26,9 +26,7 @@
/**
* Represents a Group. Group has a name that is unique in scope of a given group type. This means that groupType/name pairs
- * uniquely identifies group. Group Id contains encoded group type and name imformation. In default implementation
- * it can look as follows: "jbpid_group_id_._._GROUP_TYPE_._._GROUP_NAME". Still prefix and format of Id can change in the future so
- * PersistenceManager.createGroupId(String groupName, String groupType) method should be used to create it.
+ * uniquely identifies group.
*
* @author Anil.Saldhana(a)redhat.com
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/IdentitySearchCriteria.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/IdentitySearchCriteria.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/IdentitySearchCriteria.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -70,12 +70,12 @@
IdentitySearchCriteria attributeValuesFilter(String attributeName, String[] attributeValue) throws UnsupportedCriterium;
/**
- * Filter results by id. Wildcard '*' can be used
+ * Filter results by id or name. Wildcard '*' can be used
*
* @param filter
* @return
* @throws UnsupportedCriterium
*/
- IdentitySearchCriteria idFilter(String filter) throws UnsupportedCriterium;
+ IdentitySearchCriteria nameFilter(String filter) throws UnsupportedCriterium;
}
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/IdentityType.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/IdentityType.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/IdentityType.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -34,8 +34,11 @@
{
/**
- * @return the id of the IdentityType
+ * @return the pointer to the IdentityType. For User this will return same value as getId(). For Group key contains
+ * encoded group type and name imformation. In default implementation it can look as follows:
+ * "jbpid_group_id_._._GROUP_TYPE_._._GROUP_NAME". Still prefix and format of key can change in the future so
+ * PersistenceManager.createGroupId(String groupName, String groupType) method should be used to create it for Group.
*/
- String getId();
+ String getKey();
}
\ No newline at end of file
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/PersistenceManager.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/PersistenceManager.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/PersistenceManager.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -73,16 +73,25 @@
throws IdentityException;
/**
- * <p>Create a group Id. Result string can be used in other methods. Group Id contains encoded group type and
- * name imformation.
+ * <p>Create a group key. Result string can be used in other methods as a simple reference instead of whole object.
+ * Group key contains encoded group type and name imformation.
* In default implementation it can look as follows: "jbpid_group_id_._._GROUP_TYPE_._._GROUP_NAME".
- * Still prefix and format of Id can change in the future so this method should be used to create it.</p>
+ * Still prefix and format of key can change in the future so this method should be used to create it.</p>
* @param groupName
* @param groupType
* @return
*/
- String createGroupId(String groupName, String groupType);
+ String createGroupKey(String groupName, String groupType);
+ /**
+ * <p>Create a user key. Result string can be used in other methods as a simple reference instead of whole object.
+ * User key contains encoded id information. The most common implementation will be that key and id values are simply
+ * equals. Still format of key can change in the future so this method should be used to create it.</p>
+ * @param id
+ * @return
+ */
+ String createUserKey(String id);
+
// Remove
/**
@@ -98,12 +107,12 @@
/**
* Remove given user
*
- * @param id
+ * @param key
* @param force - if true all present relationships will be removed, if false any present relationship will cause
* removal to fail
* @throws org.jboss.identity.idm.common.exception.IdentityException
*/
- void removeUser(String id, boolean force) throws IdentityException;
+ void removeUser(String key, boolean force) throws IdentityException;
/**
* Remove given group
@@ -118,12 +127,12 @@
/**
* Remove given group
*
- * @param groupId
+ * @param groupKey
* @param force - if true all present relationships will be removed, if false any present relationship will cause
* removal to fail
* @throws org.jboss.identity.idm.common.exception.IdentityException
*/
- void removeGroup(String groupId, boolean force) throws IdentityException;
+ void removeGroup(String groupKey, boolean force) throws IdentityException;
// Search
@@ -143,13 +152,13 @@
throws IdentityException;
/**
- * Find user with a given name
+ * Find user with a given key
*
- * @param name
+ * @param key
* @return
* @throws org.jboss.identity.idm.common.exception.IdentityException
*/
- User findUser(String name) throws IdentityException;
+ User findUser(String key) throws IdentityException;
/**
* Obtain users
@@ -175,11 +184,11 @@
/**
* Find group with a given id
*
- * @param id
+ * @param key
* @return
* @throws org.jboss.identity.idm.common.exception.IdentityException
*/
- Group findGroupById(String id) throws IdentityException;
+ Group findGroupByKey(String key) throws IdentityException;
/**
@@ -201,14 +210,4 @@
*/
Collection<Group> findGroup(String groupType) throws IdentityException;
-
- //TODO: commented out for now as it is not implemented
- /**
- * Whether Identity is a virtual
- * (such as a pseudonym)
- * @return true (virtual identity)
- */
-// boolean isVirtual(User user);
-
-
}
Deleted: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RealmManager.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RealmManager.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RealmManager.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -1,89 +0,0 @@
-//TODO: Implement
-
-///*
-//* JBoss, a division of Red Hat
-//* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-//* by the @authors tag. See the copyright.txt in the distribution for a
-//* full listing of individual contributors.
-//*
-//* This is free software; you can redistribute it and/or modify it
-//* under the terms of the GNU Lesser General Public License as
-//* published by the Free Software Foundation; either version 2.1 of
-//* the License, or (at your option) any later version.
-//*
-//* This software is distributed in the hope that it will be useful,
-//* but WITHOUT ANY WARRANTY; without even the implied warranty of
-//* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-//* Lesser General Public License for more details.
-//*
-//* You should have received a copy of the GNU Lesser General Public
-//* License along with this software; if not, write to the Free
-//* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-//* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-//*/
-//
-//package org.jboss.identity.idm.api;
-//
-//import org.jboss.identity.idm.common.exception.IdentityException;
-//
-//import java.io.InputStream;
-//
-///**
-// * All operations connected with realms.
-// * Because operations on realms are not often there is no transaction or session support.
-// *
-// * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
-// * @version : 0.1 $
-// */
-//public interface RealmManager
-//{
-//
-//
-// /**
-// * <p>Create a Realm or return an already
-// * created realm. Bootstrapping includes generating
-// * the models in the realm</p>
-// * @param realmName
-// * @return
-// */
-// Realm bootstrap(String realmName) throws IdentityException;
-//
-// /**
-// * <p>Bootstrap a realm given a configuration</p>
-// * @param realmName
-// * @param config
-// * @return
-// */
-// Realm bootstrap(String realmName, InputStream config) throws IdentityException;
-//
-// /**
-// * <p>Associate a relationship between two realms</p>
-// * @param realmA
-// * @param realmB
-// */
-// void associate(Realm realmA, Realm realmB) throws IdentityException;
-//
-//
-// /**
-// * <p>Disassociate a relationship between two realms</p>
-// * @param realmA
-// * @param realmB
-// */
-// void disassociate(Realm realmA, Realm realmB) throws IdentityException;
-//
-// /**
-// * @param fromRealm
-// * @param toRealm
-// * @return returns a relationship type between this and given Realm.
-// */
-// boolean isAssosiated(Realm fromRealm, Realm toRealm) throws IdentityException;
-//
-// /**
-// * <p>Return a realm</p>
-// * @param realmName
-// * @param shouldBootstrap Should we bootstrap if a realm does not exist?
-// * @return
-// */
-// Realm getRealm(String realmName, boolean shouldBootstrap) throws IdentityException;
-//
-//}
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RelationshipManager.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RelationshipManager.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RelationshipManager.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -73,20 +73,20 @@
/**
* <p>Associate groups</p>
- * @param parentIds
- * @param memberIds
+ * @param parentKeys
+ * @param memberKeys
* @throws org.jboss.identity.idm.common.exception.IdentityException
*/
- void associateGroupsByIds(Collection<String> parentIds, Collection<String> memberIds)
+ void associateGroupsByKeys(Collection<String> parentKeys, Collection<String> memberKeys)
throws IdentityException;
/**
* <p>Associate groups</p>
- * @param parentId
- * @param memberIds
+ * @param parentKeys
+ * @param memberKeys
* @throws org.jboss.identity.idm.common.exception.IdentityException
*/
- void associateGroupsByIds(String parentId, Collection<String> memberIds)
+ void associateGroupsByKeys(String parentKeys, Collection<String> memberKeys)
throws IdentityException;
/**
@@ -100,11 +100,11 @@
/**
* <p>Associate groups</p>
- * @param parentId
- * @param memberId
+ * @param parentKey
+ * @param memberKey
* @throws org.jboss.identity.idm.common.exception.IdentityException
*/
- void associateGroupsByIds(String parentId, String memberId)
+ void associateGroupsByKeys(String parentKey, String memberKey)
throws IdentityException;
/**
@@ -127,20 +127,20 @@
/**
* <p>Associate identities to groups</p>
- * @param parents
- * @param members
+ * @param parentKeys
+ * @param memberKeys
* @throws org.jboss.identity.idm.common.exception.IdentityException
*/
- void associateUsersByIds(Collection<String> parents, Collection<String> members)
+ void associateUsersByKeys(Collection<String> parentKeys, Collection<String> memberKeys)
throws IdentityException;
/**
* <p>Associate identities to groups</p>
- * @param parentId
- * @param members
+ * @param parentKey
+ * @param memberKeys
* @throws org.jboss.identity.idm.common.exception.IdentityException
*/
- void associateUsersByIds(String parentId, Collection<String> members)
+ void associateUsersByKeys(String parentKey, Collection<String> memberKeys)
throws IdentityException;
/**
@@ -154,11 +154,11 @@
/**
* <p>Associate identities to groups</p>
- * @param parentGroupId
- * @param memberid
+ * @param parentGroupKey
+ * @param memberKey
* @throws org.jboss.identity.idm.common.exception.IdentityException
*/
- void associateUserByIds(String parentGroupId, String memberid)
+ void associateUserByKeys(String parentGroupKey, String memberKey)
throws IdentityException;
/**
@@ -198,20 +198,20 @@
/**
* <p>Disassociate groups</p>
- * @param parents
- * @param members
+ * @param parentKeys
+ * @param memberKeys
* @throws org.jboss.identity.idm.common.exception.IdentityException
*/
- void disassociateGroupsByIds(Collection<String> parents, Collection<String> members)
+ void disassociateGroupsByKeys(Collection<String> parentKeys, Collection<String> memberKeys)
throws IdentityException;
/**
* <p>Disassociate groups</p>
- * @param parent
- * @param members
+ * @param parentKey
+ * @param memberKeys
* @throws org.jboss.identity.idm.common.exception.IdentityException
*/
- void disassociateGroupsByIds(String parent, Collection<String> members)
+ void disassociateGroupsByKeys(String parentKey, Collection<String> memberKeys)
throws IdentityException;
/**
@@ -234,20 +234,20 @@
/**
* <p>Disassociate users from groups</p>
- * @param parents
- * @param members
+ * @param parentKeys
+ * @param memberKeys
* @throws org.jboss.identity.idm.common.exception.IdentityException
*/
- void disassociateUsersByIds(Collection<String> parents, Collection<String> members)
+ void disassociateUsersByKeys(Collection<String> parentKeys, Collection<String> memberKeys)
throws IdentityException;
/**
* <p>Disassociate users from groups</p>
- * @param parent
- * @param members
+ * @param parentKey
+ * @param memberKey
* @throws org.jboss.identity.idm.common.exception.IdentityException
*/
- void disassociateUsersByIds(String parent, Collection<String> members)
+ void disassociateUsersByKeys(String parentKey, Collection<String> memberKey)
throws IdentityException;
/**
@@ -262,12 +262,12 @@
/**
* <p>Check if association is present </p>
- * @param parents
- * @param members
+ * @param parentKeys
+ * @param memberKeys
* @return
* @throws org.jboss.identity.idm.common.exception.IdentityException
*/
- boolean isAssociatedByIds(Collection<String> parents, Collection<String> members)
+ boolean isAssociatedByKeys(Collection<String> parentKeys, Collection<String> memberKeys)
throws IdentityException;
/**
@@ -282,12 +282,12 @@
/**
* <p>Check if association is present </p>
- * @param parent
- * @param member
+ * @param parentKey
+ * @param memberKey
* @return
* @throws org.jboss.identity.idm.common.exception.IdentityException
*/
- boolean isAssociatedByIds(String parent, String member)
+ boolean isAssociatedByKeys(String parentKey, String memberKey)
throws IdentityException;
// Resolve relationships
@@ -440,12 +440,12 @@
/**
* Find users that have relationship with given parent group.
*
- * @param groupId parent group id
+ * @param groupKey parent group id
* @param cascade if true also identities from subgroubs will be retrieved. Default is false
* @return
* @throws org.jboss.identity.idm.common.exception.IdentityException
*/
- Collection<User> findAssociatedUsers(String groupId,
+ Collection<User> findAssociatedUsers(String groupKey,
boolean cascade,
IdentitySearchCriteria criteria) throws IdentityException;
@@ -486,11 +486,11 @@
/**
* Find users that have relationship with given parent group. Will return users connected with a given group with a role
*
- * @param groupId parent group id
+ * @param groupKey parent group id
* @return
* @throws org.jboss.identity.idm.common.exception.IdentityException
*/
- Collection<User> findRelatedUsers(String groupId, IdentitySearchCriteria criteria) throws IdentityException;
+ Collection<User> findRelatedUsers(String groupKey, IdentitySearchCriteria criteria) throws IdentityException;
}
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RoleManager.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RoleManager.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RoleManager.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -115,11 +115,11 @@
* Create role
* @param roleTypeName
* @param userId
- * @param groupId
+ * @param groupKey
* @return
* @throws IdentityException
*/
- Role createRole(String roleTypeName, String userId, String groupId) throws IdentityException;
+ Role createRole(String roleTypeName, String userId, String groupKey) throws IdentityException;
/**
* Create role
@@ -135,11 +135,11 @@
* Create role
* @param roleTypeName
* @param userId
- * @param groupId
+ * @param groupKey
* @return
* @throws IdentityException
*/
- Role getRole(String roleTypeName, String userId, String groupId) throws IdentityException;
+ Role getRole(String roleTypeName, String userId, String groupKey) throws IdentityException;
/**
* Remove Role
@@ -154,10 +154,10 @@
* Remove Role
* @param roleTypeName
* @param userId
- * @param groupId
+ * @param groupKey
* @throws IdentityException
*/
- void removeRole(String roleTypeName, String userId, String groupId) throws IdentityException;
+ void removeRole(String roleTypeName, String userId, String groupKey) throws IdentityException;
/**
* Remove Role
@@ -179,12 +179,12 @@
/**
* Check if Role is present
* @param userId
- * @param groupId
+ * @param groupKey
* @param roleTypeName
* @return
* @throws IdentityException
*/
- boolean hasRole(String userId, String groupId, String roleTypeName) throws IdentityException;
+ boolean hasRole(String userId, String groupKey, String roleTypeName) throws IdentityException;
/**
* Find RoleType objects for roles associated with a given User and Group
@@ -199,11 +199,11 @@
/**
* Find RoleType objects for roles associated with a given User and Group
* @param userId
- * @param groupId
+ * @param groupKey
* @return
* @throws IdentityException
*/
- Collection<RoleType> findRoleTypes(String userId, String groupId,
+ Collection<RoleType> findRoleTypes(String userId, String groupKey,
IdentitySearchCriteria criteria) throws IdentityException;
/**
@@ -258,11 +258,11 @@
/**
* Find RoleType objects for roles associated with a given Group
- * @param groupId
+ * @param groupKey
* @return
* @throws IdentityException
*/
- Collection<RoleType> findGroupRoleTypes(String groupId,
+ Collection<RoleType> findGroupRoleTypes(String groupKey,
IdentitySearchCriteria criteria) throws IdentityException;
/**
@@ -326,12 +326,12 @@
/**
* Find all Users with which Group has a Role association
*
- * @param groupId
+ * @param groupKey
* @param criteria
* @return
* @throws IdentityException
*/
- Collection<User> findUsersWithRelatedRole(String groupId,
+ Collection<User> findUsersWithRelatedRole(String groupKey,
IdentitySearchCriteria criteria) throws IdentityException;
/**
@@ -345,13 +345,13 @@
RoleType roleType) throws IdentityException;
/**
- * Find Role objects with a given RoleType name associated with IdentityType for a given id
- * @param id
+ * Find Role objects with a given RoleType name associated with IdentityType for a given key
+ * @param key
* @param roleTypeName
* @return
* @throws IdentityException
*/
- <T extends IdentityType> Collection<Role> findRoles(String id,
+ <T extends IdentityType> Collection<Role> findRoles(String key,
String roleTypeName) throws IdentityException;
/**
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/User.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/User.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/User.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -30,5 +30,7 @@
*/
public interface User extends IdentityType
{
+
+ String getId();
}
\ No newline at end of file
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/cfg/IdentityConfigurationRegistry.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/cfg/IdentityConfigurationRegistry.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/cfg/IdentityConfigurationRegistry.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -25,7 +25,8 @@
import org.jboss.identity.idm.common.exception.IdentityException;
/**
- * Simple registry enables to register object instance and then reference it from configuration file.
+ * Simple registry enables to register object instance before IdentitySessionFactory creation and then reference it
+ * from configuration file.
*
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
* @version : 0.1 $
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/GroupQueryBuilder.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/GroupQueryBuilder.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/GroupQueryBuilder.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -49,12 +49,12 @@
GroupQueryBuilder reset();
/**
- * Search for a Group with a given ID
+ * Search for a Group with a given key
*
- * @param id
+ * @param key
* @return
*/
- GroupQueryBuilder setId(String id);
+ GroupQueryBuilder setKey(String key);
/**
* Search for groups with a given name and type
@@ -91,11 +91,11 @@
/**
* Search for groups that are associated with a given group
*
- * @param id
+ * @param key
* @param parent
* @return
*/
- GroupQueryBuilder addAssociatedGroup(String id, boolean parent);
+ GroupQueryBuilder addAssociatedGroup(String key, boolean parent);
/**
* Search for groups that are associated with a given groups
@@ -108,11 +108,11 @@
/**
* Search for groups that are associated with a given groups
*
- * @param ids
+ * @param keys
* @param parent
* @return
*/
- GroupQueryBuilder addAssociatedGroupsIds(Collection<String> ids, boolean parent);
+ GroupQueryBuilder addAssociatedGroupsKeys(Collection<String> keys, boolean parent);
/**
* Search for groups that are associated with a given user
@@ -125,10 +125,10 @@
/**
* Search for groups that are associated with a given user
*
- * @param id
+ * @param key
* @return
*/
- GroupQueryBuilder addAssociatedUser(String id);
+ GroupQueryBuilder addAssociatedUser(String key);
/**
* Search for groups that are associated with a given users
@@ -141,10 +141,10 @@
/**
* Search for groups that are associated with a given users
*
- * @param ids
+ * @param keys
* @return
*/
- GroupQueryBuilder addAssociatedUsersIds(Collection<String> ids);
+ GroupQueryBuilder addAssociatedUsersKeys(Collection<String> keys);
/**
* Search for groups that are connected with a Role with a given user
@@ -157,10 +157,10 @@
/**
* Search for groups that are connected with a Role with a given user
*
- * @param id
+ * @param key
* @return
*/
- GroupQueryBuilder addUserConnectedByRole(String id);
+ GroupQueryBuilder addUserConnectedByRole(String key);
/**
* Search for groups that are connected with a Role with a given users
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/RoleQueryBuilder.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/RoleQueryBuilder.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/RoleQueryBuilder.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -75,10 +75,10 @@
/**
* Search for roles connected with a given group
*
- * @param id
+ * @param key
* @return
*/
- RoleQueryBuilder setGroup(String id);
+ RoleQueryBuilder setGroup(String key);
/**
* Search for roles with a given RoleType
@@ -107,9 +107,9 @@
/**
* Search for roles connected with a given IdentityType object
*
- * @param id
+ * @param key
* @return
*/
- RoleQueryBuilder setIdentityTypeId(String id);
+ RoleQueryBuilder setIdentityTypeKey(String key);
}
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/UserQueryBuilder.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/UserQueryBuilder.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/UserQueryBuilder.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -66,10 +66,10 @@
/**
* Search for users associated with a given group
*
- * @param id
+ * @param key
* @return
*/
- UserQueryBuilder addAssociatedGroup(String id);
+ UserQueryBuilder addAssociatedGroup(String key);
/**
* Search for users associated with a given groups
@@ -82,10 +82,10 @@
/**
* Search for users associated with a given groups
*
- * @param groups
+ * @param groupKeys
* @return
*/
- UserQueryBuilder addAssociatedGroupsIds(Collection<String> groups);
+ UserQueryBuilder addAssociatedGroupsKeys(Collection<String> groupKeys);
/**
* Search for users that are connected with role with a given group
@@ -99,10 +99,10 @@
/**
* Search for users that are connected with role with a given group
*
- * @param id
+ * @param groupKey
* @return
*/
- UserQueryBuilder addGroupConnectedWithRole(String id);
+ UserQueryBuilder addGroupConnectedWithRole(String groupKey);
/**
* Search for users that are connected with role with a given groups
@@ -115,10 +115,10 @@
/**
* Search for users that are connected with role with a given group
*
- * @param groups
+ * @param groupKeys
* @return
*/
- UserQueryBuilder addGroupsIdsConnectedWithRole(Collection<String> groups);
+ UserQueryBuilder addGroupsKeysConnectedWithRole(Collection<String> groupKeys);
/**
* Search for users that are connected with role or associated with a given group
@@ -131,10 +131,10 @@
/**
* Search for users that are connected with role or associated with a given group
*
- * @param id
+ * @param key
* @return
*/
- UserQueryBuilder addRelatedGroup(String id);
+ UserQueryBuilder addRelatedGroup(String key);
/**
* Search for users that are connected with role or associated with a given group
@@ -147,10 +147,10 @@
/**
* Search for users that are connected with role or associated with a given group
*
- * @param ids
+ * @param groupKeys
* @return
*/
- UserQueryBuilder addRelatedGroupsIds(Collection<String> ids);
+ UserQueryBuilder addRelatedGroupsKeys(Collection<String> groupKeys);
/**
* Sort results
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/APICacheProvider.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/APICacheProvider.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/APICacheProvider.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -47,6 +47,11 @@
*/
void initialize(Map<String, String> properties, IdentityConfigurationRegistry configurationRegistry);
+ /**
+ * Invalidate whole namespace
+ *
+ * @param ns
+ */
void invalidate(String ns);
/**
@@ -69,145 +74,550 @@
// Persistence Manager
-
+
+ /**
+ * Store user in cache
+ *
+ * @param ns
+ * @param user
+ */
void putUser(String ns, User user);
+ /**
+ * Get user from cache
+ *
+ * @param ns
+ * @param id
+ * @return
+ */
User getUser(String ns, String id);
+ /**
+ * Remove user from cache
+ *
+ * @param ns
+ * @param id
+ */
void removeUser(String ns, String id);
+ /**
+ * Store users in cache
+ *
+ * @param ns
+ * @param criteria
+ * @param users
+ */
void putUsers(String ns, IdentitySearchCriteria criteria, Collection<User> users);
+ /**
+ * Get users from cache
+ *
+ * @param ns
+ * @param criteria
+ * @return
+ */
Collection<User> getUsers(String ns, IdentitySearchCriteria criteria);
+ /**
+ * Invalidate all stored users
+ *
+ * @param ns
+ */
void invalidateUsers(String ns);
+ /**
+ * Store user count in cache
+ * @param ns
+ * @param count
+ */
void putUserCount(String ns, int count);
+ /**
+ * Get user count
+ * @param ns
+ * @return
+ */
int getUserCount(String ns);
+ /**
+ * Invalidate user count
+ * @param ns
+ */
void invalidateUserCount(String ns);
//
+ /**
+ * Put group in cache
+ *
+ * @param ns
+ * @param group
+ */
void putGroup(String ns, Group group);
+ /**
+ * Get group from cache
+ *
+ * @param ns
+ * @param groupType
+ * @param groupName
+ * @return
+ */
Group getGroup(String ns, String groupType, String groupName);
+ /**
+ * Remove group from cache
+ *
+ * @param ns
+ * @param groupType
+ * @param groupName
+ */
void removeGroup(String ns, String groupType, String groupName);
+ /**
+ * Put groups in cache
+ *
+ * @param ns
+ * @param criteria
+ * @param groups
+ */
void putGroups(String ns, IdentitySearchCriteria criteria, Collection<Group> groups);
+ /**
+ * Get groups from cache
+ *
+ * @param ns
+ * @param criteria
+ * @return
+ */
Collection<Group> getGroups(String ns, IdentitySearchCriteria criteria);
+ /**
+ * Invalidate all stored groups
+ *
+ * @param ns
+ */
void invalidateGroups(String ns);
+ /**
+ * Store group count
+ *
+ * @param ns
+ * @param groupType
+ * @param count
+ */
void putGroupCount(String ns, String groupType, int count);
+ /**
+ * Get group count
+ *
+ * @param ns
+ * @param groupType
+ * @return
+ */
int getGroupCount(String ns, String groupType);
+ /**
+ * Invalidate group count
+ *
+ * @param ns
+ * @param groupType
+ */
void invalidateGroupCount(String ns, String groupType);
//
+
+ /**
+ * Store role
+ *
+ * @param ns
+ * @param role
+ */
void putRole(String ns, Role role);
+ /**
+ * Get role
+ *
+ * @param ns
+ * @param role
+ * @return
+ */
Role getRole(String ns, Role role);
+ /**
+ * Remove role
+ *
+ * @param ns
+ * @param role
+ */
void removeRole(String ns, Role role);
+ /**
+ * Store role type
+ *
+ * @param ns
+ * @param roleType
+ */
void putRoleType(String ns, RoleType roleType);
+ /**
+ * Get role type
+ *
+ * @param ns
+ * @param roleType
+ * @return
+ */
RoleType getRoleType(String ns, RoleType roleType);
+ /**
+ * Remove role type
+ *
+ * @param ns
+ * @param roleType
+ */
void removeRoleType(String ns, RoleType roleType);
// Attribute
+
+ /**
+ * Store attributes
+ *
+ * @param ns
+ * @param id
+ * @param attributes
+ */
void putAttributes(String ns, String id, Map<String, Attribute> attributes);
+ /**
+ * Get attributes
+ *
+ * @param ns
+ * @param id
+ * @return
+ */
Map<String, Attribute> getAttributes(String ns, String id);
+ /**
+ * Invalidate attributes
+ *
+ * @param ns
+ * @param id
+ */
void invalidateAttributes(String ns, String id);
+ /**
+ * Invalidate attributes
+ *
+ * @param ns
+ */
void invalidateAttributes(String ns);
// Properties
+
+ /**
+ * Store properties
+ *
+ * @param ns
+ * @param role
+ * @param properties
+ */
void putProperties(String ns, Role role, Map<String, String> properties);
+ /**
+ * Get properties
+ *
+ * @param ns
+ * @param role
+ * @return
+ */
Map<String, String> getProperties(String ns, Role role);
+ /**
+ * Invalidate role properties
+ *
+ * @param ns
+ * @param role
+ */
void invalidateRoleProperties(String ns, Role role);
+ /**
+ * Invalidate role properties
+ *
+ * @param ns
+ */
void invalidateRoleProperties(String ns);
+ /**
+ * Store properties
+ *
+ * @param ns
+ * @param roleType
+ * @param properties
+ */
void putProperties(String ns, RoleType roleType, Map<String, String> properties);
+ /**
+ * Get role type properties
+ *
+ * @param ns
+ * @param roleType
+ * @return
+ */
Map<String, String> getProperties(String ns, RoleType roleType);
+ /**
+ * Invalidate role type properties
+ *
+ * @param ns
+ * @param roleType
+ */
void invalidateRoleTypeProperties(String ns, RoleType roleType);
+ /**
+ * Invalidate role type properties
+ *
+ * @param ns
+ */
void invalidateRoleTypeProperties(String ns);
// Searches
+ /**
+ * Invalidate all searches stored in cache
+ *
+ * @param ns
+ */
void invalidateAllSearches(String ns);
+ /**
+ * Store user search
+ *
+ * @param ns
+ * @param search
+ * @param results
+ */
void putUserSearch(String ns, UserSearch search, Collection<User> results);
+ /**
+ * Get user search
+ *
+ * @param ns
+ * @param search
+ * @return
+ */
Collection<User> getUserSearch(String ns, UserSearch search);
+ /**
+ * Store group search
+ *
+ * @param ns
+ * @param search
+ * @param results
+ */
void putGroupSearch(String ns, GroupSearch search, Collection<Group> results);
+ /**
+ * Get group search
+ *
+ * @param ns
+ * @param search
+ * @return
+ */
Collection<Group> getGroupSearch(String ns, GroupSearch search);
+ /**
+ * Store relationship search
+ *
+ * @param ns
+ * @param search
+ * @param result
+ */
void putRelationshipSearch(String ns, RelationshipSearch search, Boolean result);
+ /**
+ * Get relationship Search
+ *
+ * @param ns
+ * @param search
+ * @return
+ */
Boolean getRelationshipSearch(String ns, RelationshipSearch search);
+ /**
+ * Store role search
+ * @param ns
+ * @param search
+ * @param results
+ */
void putRoleSearch(String ns, RoleSearch search, Collection<Role> results);
+ /**
+ * Get role search
+ *
+ * @param ns
+ * @param search
+ * @return
+ */
Collection<Role> getRoleSearch(String ns, RoleSearch search);
+ /**
+ * Store role type search
+ *
+ * @param ns
+ * @param search
+ * @param results
+ */
void putRoleTypeSearch(String ns, RoleTypeSearch search, Collection<RoleType> results);
+ /**
+ * Get role type search
+ *
+ * @param ns
+ * @param search
+ * @return
+ */
Collection<RoleType> getRoleTypeSearch(String ns, RoleTypeSearch search);
// Queries
+ /**
+ * Invalidate all queries
+ *
+ * @param ns
+ */
void invalidateAllQueries(String ns);
+ /**
+ * Store user query
+ *
+ * @param ns
+ * @param q
+ * @param results
+ */
void putUserQuery(String ns, UserQuery q, Collection<User> results);
+ /**
+ * Store user query unique result
+ *
+ * @param ns
+ * @param q
+ * @param user
+ */
void putUserQueryUnique(String ns, UserQuery q, User user);
+ /**
+ * Get user query
+ *
+ * @param ns
+ * @param q
+ * @return
+ */
Collection<User> getUserQuery(String ns, UserQuery q);
+ /**
+ * Get user query unique result
+ * @param ns
+ * @param q
+ * @return
+ */
User getUserQueryUnique(String ns, UserQuery q);
+ /**
+ * Invalidate user queries
+ * @param ns
+ */
void invalidateUserQueries(String ns);
//
+
+ /**
+ * Store group query
+ *
+ * @param ns
+ * @param q
+ * @param results
+ */
void putGroupQuery(String ns, GroupQuery q, Collection<Group> results);
+ /**
+ * Store group query unique result
+ * \
+ * @param ns
+ * @param q
+ * @param group
+ */
void putGroupQueryUnique(String ns, GroupQuery q, Group group);
+ /**
+ * Get group query
+ *
+ * @param ns
+ * @param q
+ * @return
+ */
Collection<Group> getGroupQuery(String ns, GroupQuery q);
+ /**
+ * Get group query unique
+ *
+ * @param ns
+ * @param q
+ * @return
+ */
Group getGroupQueryUnique(String ns, GroupQuery q);
+ /**
+ * Invalidate all group queries
+ * @param ns
+ */
void invalidateGroupQueries(String ns);
//
+
+ /**
+ * Store role query
+ *
+ * @param ns
+ * @param q
+ * @param results
+ */
void putRoleQuery(String ns, RoleQuery q, Collection<Role> results);
+ /**
+ * Store role query unique result
+ *
+ * @param ns
+ * @param q
+ * @param role
+ */
void putRoleQueryUnique(String ns, RoleQuery q, Role role);
+ /**
+ * Get role query
+ *
+ * @param ns
+ * @param q
+ * @return
+ */
Collection<Role> getRoleQuery(String ns, RoleQuery q);
+ /**
+ * Get role query
+ *
+ * @param ns
+ * @param q
+ * @return
+ */
Role getRoleQueryUnique(String ns, RoleQuery q);
+ /**
+ * Invalidate all role queries
+ *
+ * @param ns
+ */
void invalidateRoleQueries(String ns);
}
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/GroupSearch.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/GroupSearch.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/GroupSearch.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -23,8 +23,6 @@
package org.jboss.identity.idm.cache;
-import java.io.Serializable;
-
public interface GroupSearch extends Search
{
}
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/RoleSearch.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/RoleSearch.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/RoleSearch.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -23,8 +23,6 @@
package org.jboss.identity.idm.cache;
-import java.io.Serializable;
-
public interface RoleSearch extends Search
{
}
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/RoleTypeSearch.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/RoleTypeSearch.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/RoleTypeSearch.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -23,8 +23,6 @@
package org.jboss.identity.idm.cache;
-import java.io.Serializable;
-
public interface RoleTypeSearch extends Search
{
}
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/UserSearch.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/UserSearch.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/cache/UserSearch.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -21,8 +21,6 @@
*/
package org.jboss.identity.idm.cache;
-import java.io.Serializable;
-
public interface UserSearch extends Search
{
}
Modified: idm/trunk/idm-auth/src/main/java/org/jboss/identity/idm/auth/JBossIdentityIDMLoginModule.java
===================================================================
--- idm/trunk/idm-auth/src/main/java/org/jboss/identity/idm/auth/JBossIdentityIDMLoginModule.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-auth/src/main/java/org/jboss/identity/idm/auth/JBossIdentityIDMLoginModule.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -241,7 +241,7 @@
//This is because LDAP binds can be non case sensitive
if (validateUserNameCase != null && validateUserNameCase.equalsIgnoreCase("true")
- && !getUsername().equals(user.getId()))
+ && !getUsername().equals(user.getKey()))
{
return UserStatus.UNEXISTING;
}
Modified: idm/trunk/idm-cache/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheAPICacheProviderImpl.java
===================================================================
--- idm/trunk/idm-cache/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheAPICacheProviderImpl.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-cache/src/main/java/org/jboss/identity/idm/impl/cache/JBossCacheAPICacheProviderImpl.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -27,8 +27,7 @@
import org.jboss.identity.idm.api.query.UserQuery;
import org.jboss.identity.idm.api.query.GroupQuery;
import org.jboss.identity.idm.api.query.RoleQuery;
-import org.jboss.identity.idm.impl.api.model.GroupId;
-import org.jboss.identity.idm.common.exception.IdentityException;
+import org.jboss.identity.idm.impl.api.model.GroupKey;
import org.jboss.cache.*;
import java.util.Map;
@@ -192,7 +191,7 @@
public void putUser(String ns, User user)
{
- Fqn nodeFqn = getFqn(ns, NODE_USERS, user.getId());
+ Fqn nodeFqn = getFqn(ns, NODE_USERS, user.getKey());
Node ioNode = getCache().getRoot().addChild(nodeFqn);
@@ -339,7 +338,7 @@
public void putGroup(String ns, Group group)
{
- Fqn nodeFqn = getFqn(ns, NODE_GROUPS, group.getId());
+ Fqn nodeFqn = getFqn(ns, NODE_GROUPS, group.getKey());
Node ioNode = getCache().getRoot().addChild(nodeFqn);
@@ -347,13 +346,13 @@
if (log.isLoggable(Level.FINER))
{
- log.finer(this.toString() + "Group stored in cache: " + group.getId());
+ log.finer(this.toString() + "Group stored in cache: " + group.getKey());
}
}
public Group getGroup(String ns, String groupType, String groupName)
{
- Fqn nodeFqn = getFqn(ns, NODE_GROUPS, GroupId.parseId(groupName, groupType));
+ Fqn nodeFqn = getFqn(ns, NODE_GROUPS, GroupKey.parseKey(groupName, groupType));
Node node = getCache().getRoot().getChild(nodeFqn);
@@ -363,7 +362,7 @@
if (log.isLoggable(Level.FINER) && group != null)
{
- log.finer(this.toString() + "Group found in cache: id=" + group.getId());
+ log.finer(this.toString() + "Group found in cache: id=" + group.getKey());
}
return group;
@@ -374,13 +373,13 @@
public void removeGroup(String ns, String groupType, String groupName)
{
- Fqn nodeFqn = getFqn(ns, NODE_GROUPS, GroupId.parseId(groupName, groupType));
+ Fqn nodeFqn = getFqn(ns, NODE_GROUPS, GroupKey.parseKey(groupName, groupType));
getCache().getRoot().removeChild(nodeFqn);
if (log.isLoggable(Level.FINER))
{
- log.finer(this.toString() + "Group removed from cache: id= " + GroupId.parseId(groupName, groupType));
+ log.finer(this.toString() + "Group removed from cache: id= " + GroupKey.parseKey(groupName, groupType));
}
}
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/IdentitySearchCriteriaImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/IdentitySearchCriteriaImpl.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/IdentitySearchCriteriaImpl.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -198,7 +198,7 @@
return this;
}
- public IdentitySearchCriteria idFilter(String filter) throws UnsupportedCriterium
+ public IdentitySearchCriteria nameFilter(String filter) throws UnsupportedCriterium
{
if (filter == null)
{
@@ -378,7 +378,7 @@
if (type instanceof User)
{
- id = type.getId();
+ id = type.getKey();
}
else if (type instanceof Group)
{
@@ -412,11 +412,11 @@
{
if (ascending)
{
- return o1.getId().compareTo(o2.getId());
+ return o1.getKey().compareTo(o2.getKey());
}
else
{
- return o2.getId().compareTo(o1.getId());
+ return o2.getKey().compareTo(o1.getKey());
}
}
else
Deleted: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/model/GroupId.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/model/GroupId.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/model/GroupId.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -1,109 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-
-package org.jboss.identity.idm.impl.api.model;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class GroupId
-{
- public static final String PREFIX = "jbpid_group_id";
-
- public static final String SEPARATOR = "_._._";
-
- public static final String SEPARATOR_REGEX = "_\\._\\._";
-
- private String name;
-
- private String type;
-
- public GroupId(String name, String type)
- {
- if (name == null)
- {
- throw new IllegalArgumentException("name is null");
- }
- if (type == null)
- {
- throw new IllegalArgumentException("type is null");
- }
-
- this.name = name;
- this.type = type;
- }
-
- public GroupId(String id)
- {
- if (id == null)
- {
- throw new IllegalArgumentException("id is null");
- }
-
- String[] parts = id.split(SEPARATOR_REGEX);
-
- if (!validateId(id))
- {
- throw new IllegalArgumentException("group id not following required format: " +
- PREFIX + SEPARATOR + "groupType" + SEPARATOR + "name : " + id);
- }
-
- name = parts[2];
- type = parts[1];
- }
-
- public static boolean validateId(String id)
- {
- String[] parts = id.split(SEPARATOR_REGEX);
-
- if (parts == null || parts.length != 3 || parts[0].equals(PREFIX.substring(0, PREFIX.length() - 1)))
- {
- return false;
- }
-
- return true;
- }
-
- public static String parseId(String name, String type)
- {
- GroupId gid = new GroupId(name, type);
- String id = gid.getId();
- gid = null;
- return id;
- }
-
- public String getName()
- {
- return name;
- }
-
- public String getType()
- {
- return type;
- }
-
- public String getId()
- {
- return PREFIX + SEPARATOR + type + SEPARATOR + name;
- }
-}
Copied: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/model/GroupKey.java (from rev 906, idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/model/GroupId.java)
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/model/GroupKey.java (rev 0)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/model/GroupKey.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -0,0 +1,109 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.jboss.identity.idm.impl.api.model;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class GroupKey
+{
+ public static final String PREFIX = "jbpid_group_id";
+
+ public static final String SEPARATOR = "_._._";
+
+ public static final String SEPARATOR_REGEX = "_\\._\\._";
+
+ private String name;
+
+ private String type;
+
+ public GroupKey(String name, String type)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException("name is null");
+ }
+ if (type == null)
+ {
+ throw new IllegalArgumentException("type is null");
+ }
+
+ this.name = name;
+ this.type = type;
+ }
+
+ public GroupKey(String id)
+ {
+ if (id == null)
+ {
+ throw new IllegalArgumentException("id is null");
+ }
+
+ String[] parts = id.split(SEPARATOR_REGEX);
+
+ if (!validateKey(id))
+ {
+ throw new IllegalArgumentException("group id not following required format: " +
+ PREFIX + SEPARATOR + "groupType" + SEPARATOR + "name : " + id);
+ }
+
+ name = parts[2];
+ type = parts[1];
+ }
+
+ public static boolean validateKey(String key)
+ {
+ String[] parts = key.split(SEPARATOR_REGEX);
+
+ if (parts == null || parts.length != 3 || parts[0].equals(PREFIX.substring(0, PREFIX.length() - 1)))
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ public static String parseKey(String name, String type)
+ {
+ GroupKey gid = new GroupKey(name, type);
+ String id = gid.getKey();
+ gid = null;
+ return id;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getType()
+ {
+ return type;
+ }
+
+ public String getKey()
+ {
+ return PREFIX + SEPARATOR + type + SEPARATOR + name;
+ }
+}
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleGroup.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleGroup.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleGroup.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -41,15 +41,15 @@
{
this.name = name;
this.groupType = groupType;
- this.id = new GroupId(name, groupType).getId();
+ this.id = new GroupKey(name, groupType).getKey();
}
- public SimpleGroup(GroupId groupId)
+ public SimpleGroup(GroupKey groupKey)
{
- this.name = groupId.getName();
- this.groupType = groupId.getType();
- this.id = groupId.getId();
+ this.name = groupKey.getName();
+ this.groupType = groupKey.getType();
+ this.id = groupKey.getKey();
}
public String getName()
@@ -62,7 +62,7 @@
return groupType;
}
- public String getId()
+ public String getKey()
{
return id;
}
Deleted: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleGroupType.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleGroupType.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleGroupType.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -1,71 +0,0 @@
-///*
-//* JBoss, a division of Red Hat
-//* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-//* by the @authors tag. See the copyright.txt in the distribution for a
-//* full listing of individual contributors.
-//*
-//* This is free software; you can redistribute it and/or modify it
-//* under the terms of the GNU Lesser General Public License as
-//* published by the Free Software Foundation; either version 2.1 of
-//* the License, or (at your option) any later version.
-//*
-//* This software is distributed in the hope that it will be useful,
-//* but WITHOUT ANY WARRANTY; without even the implied warranty of
-//* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-//* Lesser General Public License for more details.
-//*
-//* You should have received a copy of the GNU Lesser General Public
-//* License along with this software; if not, write to the Free
-//* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-//* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-//*/
-//
-//package org.jboss.identity.idm.impl.api.model;
-//
-//import org.jboss.identity.idm.api.GroupType;
-//
-///**
-// * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
-// * @version : 0.1 $
-// */
-//public class SimpleGroupType implements GroupType
-//{
-//
-// private final String name;
-//
-// public SimpleGroupType(String name)
-// {
-// this.name = name;
-// }
-//
-// public String getName()
-// {
-// return name;
-// }
-//
-// public boolean equals(Object o)
-// {
-// if (this == o)
-// {
-// return true;
-// }
-// if (o == null || getClass() != o.getClass())
-// {
-// return false;
-// }
-//
-// SimpleGroupType that = (SimpleGroupType)o;
-//
-// if (name != null ? !name.equals(that.name) : that.name != null)
-// {
-// return false;
-// }
-//
-// return true;
-// }
-//
-// public int hashCode()
-// {
-// return (name != null ? name.hashCode() : 0);
-// }
-//}
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleUser.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleUser.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/model/SimpleUser.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -43,6 +43,11 @@
return id;
}
+ public String getKey()
+ {
+ return getId();
+ }
+
@Override
public boolean equals(Object o)
{
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/AbstractQuery.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/AbstractQuery.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/AbstractQuery.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -22,25 +22,9 @@
package org.jboss.identity.idm.impl.api.query;
-import org.jboss.identity.idm.api.IdentitySearchCriteria;
-import org.jboss.identity.idm.api.SortOrder;
-import org.jboss.identity.idm.api.UnsupportedCriterium;
-import org.jboss.identity.idm.api.IdentitySession;
-import org.jboss.identity.idm.api.Group;
-import org.jboss.identity.idm.api.IdentityType;
-import org.jboss.identity.idm.api.User;
-import org.jboss.identity.idm.api.Role;
-import org.jboss.identity.idm.api.query.UserQuery;
-import org.jboss.identity.idm.api.query.UnsupportedQueryCriterium;
import org.jboss.identity.idm.api.query.Query;
import org.jboss.identity.idm.impl.api.IdentitySearchCriteriaImpl;
-import org.jboss.identity.idm.impl.api.model.SimpleGroup;
-import org.jboss.identity.idm.impl.api.model.GroupId;
-import org.jboss.identity.idm.impl.api.model.SimpleUser;
-import org.jboss.identity.idm.impl.api.session.IdentitySessionImpl;
-import java.util.List;
-import java.util.LinkedList;
import java.io.Serializable;
/**
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/AbstractQueryBuilder.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/AbstractQueryBuilder.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/AbstractQueryBuilder.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -24,9 +24,8 @@
import org.jboss.identity.idm.impl.api.IdentitySearchCriteriaImpl;
import org.jboss.identity.idm.impl.api.model.SimpleGroup;
-import org.jboss.identity.idm.impl.api.model.GroupId;
+import org.jboss.identity.idm.impl.api.model.GroupKey;
import org.jboss.identity.idm.impl.api.model.SimpleUser;
-import org.jboss.identity.idm.api.query.Query;
import org.jboss.identity.idm.api.query.UnsupportedQueryCriterium;
import org.jboss.identity.idm.api.query.QueryBuilder;
import org.jboss.identity.idm.api.SortOrder;
@@ -101,7 +100,7 @@
{
try
{
- searchCriteria.idFilter(idFilter);
+ searchCriteria.nameFilter(idFilter);
}
catch (UnsupportedCriterium unsupportedCriterium)
{
@@ -121,16 +120,16 @@
protected Group createGroupFromId(String id)
{
- return new SimpleGroup(new GroupId(id));
+ return new SimpleGroup(new GroupKey(id));
}
protected IdentityType createIdentityTypeFromId(String id)
{
- if (GroupId.validateId(id))
+ if (GroupKey.validateKey(id))
{
- GroupId groupId = new GroupId(id);
+ GroupKey groupKey = new GroupKey(id);
- return new SimpleGroup(groupId);
+ return new SimpleGroup(groupKey);
}
else
{
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/GroupQueryBuilderImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/GroupQueryBuilderImpl.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/GroupQueryBuilderImpl.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -23,22 +23,19 @@
package org.jboss.identity.idm.impl.api.query;
import org.jboss.identity.idm.api.query.GroupQueryBuilder;
-import org.jboss.identity.idm.api.query.QueryException;
import org.jboss.identity.idm.api.query.GroupQuery;
import org.jboss.identity.idm.api.query.UnsupportedQueryCriterium;
import org.jboss.identity.idm.api.Group;
import org.jboss.identity.idm.api.User;
import org.jboss.identity.idm.api.SortOrder;
-import org.jboss.identity.idm.impl.api.model.GroupId;
+import org.jboss.identity.idm.impl.api.model.GroupKey;
import org.jboss.identity.idm.impl.api.model.SimpleGroup;
import org.jboss.identity.idm.impl.api.model.SimpleUser;
import org.jboss.identity.idm.impl.api.IdentitySearchCriteriaImpl;
-import org.jboss.identity.idm.impl.NotYetImplementedException;
import java.util.Set;
import java.util.HashSet;
import java.util.Collection;
-import java.util.List;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
@@ -46,7 +43,7 @@
*/
public class GroupQueryBuilderImpl extends AbstractQueryBuilder implements GroupQueryBuilder
{
- private GroupId groupId;
+ private GroupKey groupKey;
private String groupName;
@@ -64,9 +61,9 @@
private void prepare()
{
- if (groupId == null && (groupName != null && groupType != null))
+ if (groupKey == null && (groupName != null && groupType != null))
{
- groupId = new GroupId(groupName, groupType);
+ groupKey = new GroupKey(groupName, groupType);
}
}
@@ -77,7 +74,7 @@
return new GroupQueryImpl(
searchCriteria,
- groupId,
+ groupKey,
groupName,
groupType,
associatedParentGroups,
@@ -90,7 +87,7 @@
public GroupQueryBuilder reset()
{
searchCriteria = new IdentitySearchCriteriaImpl();
- groupId = null;
+ groupKey = null;
groupName = null;
groupType = null;
associatedParentGroups = new HashSet<Group>();
@@ -102,15 +99,15 @@
return this;
}
- public GroupQueryBuilder setId(String id)
+ public GroupQueryBuilder setKey(String id)
{
- groupId = new GroupId(id);
+ groupKey = new GroupKey(id);
return this;
}
public GroupQueryBuilder setNameAndType(String name, String type)
{
- groupId = new GroupId(name, type);
+ groupKey = new GroupKey(name, type);
groupName = name;
groupType = type;
@@ -149,7 +146,7 @@
{
checkNotNullArgument(id, "Group id");
- Group group = new SimpleGroup(new GroupId(id));
+ Group group = new SimpleGroup(new GroupKey(id));
if (parent)
{
@@ -180,12 +177,12 @@
return this;
}
- public GroupQueryBuilder addAssociatedGroupsIds(Collection<String> ids, boolean parent)
+ public GroupQueryBuilder addAssociatedGroupsKeys(Collection<String> ids, boolean parent)
{
checkNotNullArgument(ids, "Groups ids");
for (String groupId : ids)
{
- Group group = new SimpleGroup(new GroupId(groupId));
+ Group group = new SimpleGroup(new GroupKey(groupId));
if (parent)
{
@@ -221,7 +218,7 @@
return this;
}
- public GroupQueryBuilder addAssociatedUsersIds(Collection<String> ids)
+ public GroupQueryBuilder addAssociatedUsersKeys(Collection<String> ids)
{
checkNotNullArgument(ids, "Users ids");
for (String id : ids)
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/GroupQueryExecutorImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/GroupQueryExecutorImpl.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/GroupQueryExecutorImpl.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -63,7 +63,7 @@
// If no conditions
- if (q.groupId == null &&
+ if (q.groupKey == null &&
q.groupName == null &&
q.groupType == null &&
q.associatedParentGroups.size() == 0 &&
@@ -79,10 +79,10 @@
}
- if (q.groupId != null)
+ if (q.groupKey != null)
{
uniqueResult = identitySession.getPersistenceManager().
- findGroup(q.groupId.getName(), q.groupId.getType());
+ findGroup(q.groupKey.getName(), q.groupKey.getType());
}
// Process each condition
@@ -135,7 +135,7 @@
// If only one search was performed then return it as search criteria are applied correctly
- if (q.groupId == null &&
+ if (q.groupKey == null &&
uniqueResult == null &&
q.associatedChildGroups.size() == 0 &&
resultsAssociatedChildGroups.size() == 0 &&
@@ -151,7 +151,7 @@
return mainResults;
}
- else if (q.groupId != null &&
+ else if (q.groupKey != null &&
uniqueResult != null &&
q.associatedChildGroups.size() == 0 &&
resultsAssociatedChildGroups.size() == 0 &&
@@ -169,7 +169,7 @@
IdentitySearchCriteriaImpl.applyCriteria(identitySession, q.searchCriteria, mainResults);
return mainResults;
}
- else if (q.groupId == null &&
+ else if (q.groupKey == null &&
uniqueResult == null &&
q.associatedChildGroups.size() != 0 &&
resultsAssociatedChildGroups.size() != 0 &&
@@ -185,7 +185,7 @@
return resultsAssociatedChildGroups;
}
- else if (q.groupId == null &&
+ else if (q.groupKey == null &&
uniqueResult == null &&
q.associatedChildGroups.size() == 0 &&
resultsAssociatedChildGroups.size() == 0 &&
@@ -200,7 +200,7 @@
{
return resultsAssociatedParentGroups;
}
- else if (q.groupId == null &&
+ else if (q.groupKey == null &&
uniqueResult == null &&
q.associatedChildGroups.size() == 0 &&
resultsAssociatedChildGroups.size() == 0 &&
@@ -215,7 +215,7 @@
{
return resultsUsersAssociated;
}
- else if (q.groupId == null &&
+ else if (q.groupKey == null &&
uniqueResult == null &&
q.associatedChildGroups.size() == 0 &&
resultsAssociatedChildGroups.size() == 0 &&
@@ -230,7 +230,7 @@
{
return resultsUsersConnectedByRole;
}
- else if (q.groupId == null &&
+ else if (q.groupKey == null &&
uniqueResult == null &&
q.associatedChildGroups.size() == 0 &&
resultsAssociatedChildGroups.size() == 0 &&
@@ -250,7 +250,7 @@
boolean first = true;
- if (q.groupId != null)
+ if (q.groupKey != null)
{
first = false;
mainResults.add(uniqueResult);
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/GroupQueryImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/GroupQueryImpl.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/GroupQueryImpl.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -25,7 +25,7 @@
import org.jboss.identity.idm.api.query.GroupQuery;
import org.jboss.identity.idm.api.Group;
import org.jboss.identity.idm.api.User;
-import org.jboss.identity.idm.impl.api.model.GroupId;
+import org.jboss.identity.idm.impl.api.model.GroupKey;
import org.jboss.identity.idm.impl.api.IdentitySearchCriteriaImpl;
import java.util.Set;
@@ -37,7 +37,7 @@
*/
public class GroupQueryImpl extends AbstractQuery implements GroupQuery
{
- public final GroupId groupId;
+ public final GroupKey groupKey;
public final String groupName;
@@ -53,10 +53,10 @@
public final Set<User> usersConnectedByRole;
- public GroupQueryImpl(IdentitySearchCriteriaImpl searchCriteria, GroupId groupId, String groupName, String groupType, Set<Group> associatedParentGroups, Set<Group> associatedChildGroups, Set<User> usersAssociated, Set<User> usersRelated, Set<User> usersConnectedByRole)
+ public GroupQueryImpl(IdentitySearchCriteriaImpl searchCriteria, GroupKey groupKey, String groupName, String groupType, Set<Group> associatedParentGroups, Set<Group> associatedChildGroups, Set<User> usersAssociated, Set<User> usersRelated, Set<User> usersConnectedByRole)
{
super(searchCriteria);
- this.groupId = groupId;
+ this.groupKey = groupKey;
this.groupName = groupName;
this.groupType = groupType;
@@ -132,7 +132,7 @@
{
return false;
}
- if (groupId != null ? !groupId.equals(that.groupId) : that.groupId != null)
+ if (groupKey != null ? !groupKey.equals(that.groupKey) : that.groupKey != null)
{
return false;
}
@@ -164,7 +164,7 @@
public int hashCode()
{
int result = super.hashCode();
- result = 31 * result + (groupId != null ? groupId.hashCode() : 0);
+ result = 31 * result + (groupKey != null ? groupKey.hashCode() : 0);
result = 31 * result + (groupName != null ? groupName.hashCode() : 0);
result = 31 * result + (groupType != null ? groupType.hashCode() : 0);
result = 31 * result + associatedParentGroups.hashCode();
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/RoleQueryBuilderImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/RoleQueryBuilderImpl.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/RoleQueryBuilderImpl.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -32,7 +32,7 @@
import org.jboss.identity.idm.api.SortOrder;
import org.jboss.identity.idm.impl.api.model.SimpleUser;
import org.jboss.identity.idm.impl.api.model.SimpleGroup;
-import org.jboss.identity.idm.impl.api.model.GroupId;
+import org.jboss.identity.idm.impl.api.model.GroupKey;
import org.jboss.identity.idm.impl.api.model.SimpleRoleType;
import org.jboss.identity.idm.impl.api.IdentitySearchCriteriaImpl;
@@ -93,7 +93,7 @@
public RoleQueryBuilder setGroup(String id)
{
checkNotNullArgument(id, "Group id");
- this.group = new SimpleGroup(new GroupId(id));
+ this.group = new SimpleGroup(new GroupKey(id));
return this;
}
@@ -125,7 +125,7 @@
return this;
}
- public RoleQueryBuilder setIdentityTypeId(String id)
+ public RoleQueryBuilder setIdentityTypeKey(String id)
{
checkNotNullArgument(id, "IdentityType id");
IdentityType identityType = createIdentityTypeFromId(id);
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryBuilderImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryBuilderImpl.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/query/UserQueryBuilderImpl.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -98,7 +98,7 @@
return this;
}
- public UserQueryBuilder addAssociatedGroupsIds(Collection<String> groups)
+ public UserQueryBuilder addAssociatedGroupsKeys(Collection<String> groups)
{
checkNotNullArgument(groups, "Groups");
for (String groupId : groups)
@@ -129,7 +129,7 @@
return this;
}
- public UserQueryBuilder addGroupsIdsConnectedWithRole(Collection<String> groups)
+ public UserQueryBuilder addGroupsKeysConnectedWithRole(Collection<String> groups)
{
checkNotNullArgument(groups, "Groups");
for (String groupId : groups)
@@ -160,7 +160,7 @@
return this;
}
- public UserQueryBuilder addRelatedGroupsIds(Collection<String> ids)
+ public UserQueryBuilder addRelatedGroupsKeys(Collection<String> ids)
{
checkNotNullArgument(ids, "Groups ids");
for (String id : ids)
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AbstractManager.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AbstractManager.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AbstractManager.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -35,7 +35,7 @@
import org.jboss.identity.idm.impl.api.session.IdentitySessionImpl;
import org.jboss.identity.idm.impl.api.model.SimpleUser;
import org.jboss.identity.idm.impl.api.model.SimpleGroup;
-import org.jboss.identity.idm.impl.api.model.GroupId;
+import org.jboss.identity.idm.impl.api.model.GroupKey;
import org.jboss.identity.idm.impl.api.SimpleAttribute;
import org.jboss.identity.idm.impl.api.IdentitySearchCriteriaImpl;
import org.jboss.identity.idm.cache.APICacheProvider;
@@ -112,11 +112,11 @@
protected IdentityType createIdentityTypeFromId(String id)
{
- if (GroupId.validateId(id))
+ if (GroupKey.validateKey(id))
{
- GroupId groupId = new GroupId(id);
+ GroupKey groupKey = new GroupKey(id);
- return new SimpleGroup(groupId);
+ return new SimpleGroup(groupKey);
}
else
{
@@ -128,7 +128,7 @@
{
IdentityObjectType iot = getSessionContext().getIdentityObjectTypeMapper().getIdentityObjectType();
- return new SimpleIdentityObject(user.getId(), iot);
+ return new SimpleIdentityObject(user.getKey(), iot);
}
protected IdentityObject createIdentityObjectForUserName(String userName)
@@ -142,16 +142,16 @@
{
IdentityObjectType iot = getSessionContext().getIdentityObjectTypeMapper().getIdentityObjectType(group.getGroupType());
- return new SimpleIdentityObject(group.getName(), group.getId(), iot);
+ return new SimpleIdentityObject(group.getName(), group.getKey(), iot);
}
protected IdentityObject createIdentityObjectForGroupId(String groupId)
{
- GroupId id = new GroupId(groupId);
+ GroupKey key = new GroupKey(groupId);
- IdentityObjectType iot = getSessionContext().getIdentityObjectTypeMapper().getIdentityObjectType(id.getType());
+ IdentityObjectType iot = getSessionContext().getIdentityObjectTypeMapper().getIdentityObjectType(key.getType());
- return new SimpleIdentityObject(id.getName(), null, iot);
+ return new SimpleIdentityObject(key.getName(), null, iot);
}
protected IdentityObject createIdentityObject(IdentityType identityType)
@@ -171,9 +171,9 @@
protected IdentityObject createIdentityObject(String id)
{
- if (GroupId.validateId(id))
+ if (GroupKey.validateKey(id))
{
- GroupId groupId = new GroupId(id);
+ GroupKey groupKey = new GroupKey(id);
return createIdentityObjectForGroupId(id);
}
@@ -187,7 +187,7 @@
protected Group createGroupFromId(String id)
{
- return new SimpleGroup(new GroupId(id));
+ return new SimpleGroup(new GroupKey(id));
}
protected IdentityObjectSearchCriteria convertSearchControls(IdentitySearchCriteria criteria)
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AttributesManagerImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AttributesManagerImpl.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/AttributesManagerImpl.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -22,7 +22,6 @@
package org.jboss.identity.idm.impl.api.session.managers;
-import org.jboss.identity.idm.api.IdentitySession;
import org.jboss.identity.idm.api.AttributesManager;
import org.jboss.identity.idm.api.IdentityType;
import org.jboss.identity.idm.api.User;
@@ -156,7 +155,7 @@
if (cache != null)
{
- Map<String, Attribute> attributes = cache.getAttributes(cacheNS, identityType.getId());
+ Map<String, Attribute> attributes = cache.getAttributes(cacheNS, identityType.getKey());
if (attributes != null)
{
return attributes;
@@ -174,7 +173,7 @@
if (cache != null)
{
- cache.putAttributes(cacheNS, identityType.getId(), newMap);
+ cache.putAttributes(cacheNS, identityType.getKey(), newMap);
}
return newMap;
}
@@ -208,7 +207,7 @@
attrMap.put(attribute.getName(), attribute);
}
- cache.putAttributes(cacheNS, identity.getId(), attrMap);
+ cache.putAttributes(cacheNS, identity.getKey(), attrMap);
}
postAttributesUpdate(identity, attributes);
@@ -318,8 +317,8 @@
if (cache != null)
{
// Grab the new profile and persist in cache
- cache.invalidateAttributes(cacheNS, identityType.getId());
- cache.putAttributes(cacheNS, identityType.getId(), this.getAttributes(identityType));
+ cache.invalidateAttributes(cacheNS, identityType.getKey());
+ cache.putAttributes(cacheNS, identityType.getKey(), this.getAttributes(identityType));
}
postAttributesAdd(identityType, attributes);
@@ -339,8 +338,8 @@
if (cache != null)
{
// Grab the new profile and persist in cache
- cache.invalidateAttributes(cacheNS, identityType.getId());
- cache.putAttributes(cacheNS, identityType.getId(), this.getAttributes(identityType));
+ cache.invalidateAttributes(cacheNS, identityType.getKey());
+ cache.putAttributes(cacheNS, identityType.getKey(), this.getAttributes(identityType));
}
postAttributesRemove(identityType, attributeNames);
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/PersistenceManagerImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/PersistenceManagerImpl.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/PersistenceManagerImpl.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -23,15 +23,13 @@
package org.jboss.identity.idm.impl.api.session.managers;
import org.jboss.identity.idm.api.*;
-import org.jboss.identity.idm.api.event.IdentityTypeEventListener;
-import org.jboss.identity.idm.api.event.EventListener;
import org.jboss.identity.idm.common.exception.IdentityException;
import org.jboss.identity.idm.spi.model.IdentityObjectType;
import org.jboss.identity.idm.spi.model.IdentityObject;
import org.jboss.identity.idm.spi.store.IdentityObjectSearchCriteriaType;
import org.jboss.identity.idm.impl.api.session.managers.AbstractManager;
import org.jboss.identity.idm.impl.api.session.IdentitySessionImpl;
-import org.jboss.identity.idm.impl.api.model.GroupId;
+import org.jboss.identity.idm.impl.api.model.GroupKey;
import org.jboss.identity.idm.impl.api.model.SimpleUser;
import org.jboss.identity.idm.impl.api.model.SimpleGroup;
import org.jboss.identity.idm.impl.cache.GroupSearchImpl;
@@ -170,16 +168,21 @@
return group;
}
- public String createGroupId(String groupName, String groupType)
+ public String createGroupKey(String groupName, String groupType)
{
checkNotNullArgument(groupName, "Group name");
checkNotNullArgument(groupType, "Group type");
checkObjectName(groupName);
checkObjectName(groupType);
- return new GroupId(groupName, groupType).getId();
+ return new GroupKey(groupName, groupType).getKey();
}
+ public String createUserKey(String id)
+ {
+ return id;
+ }
+
public void removeUser(User user, boolean force) throws IdentityException
{
checkNotNullArgument(user, "User");
@@ -241,7 +244,7 @@
//TODO: force
- preRemove(new SimpleGroup(new GroupId(groupId)));
+ preRemove(new SimpleGroup(new GroupKey(groupId)));
getRepository().removeIdentityObject(getInvocationContext(), createIdentityObjectForGroupId(groupId));
@@ -250,7 +253,7 @@
cache.invalidate(cacheNS);
}
- postRemove(new SimpleGroup(new GroupId(groupId)));
+ postRemove(new SimpleGroup(new GroupKey(groupId)));
}
@@ -392,19 +395,19 @@
return null;
}
- public Group findGroupById(String id) throws IdentityException
+ public Group findGroupByKey(String id) throws IdentityException
{
checkNotNullArgument(id, "Group id");
- if (!GroupId.validateId(id))
+ if (!GroupKey.validateKey(id))
{
throw new IdentityException("Provided group id is not valid: " + id + "; " +
- "Please use PersistenceManager.createGroupId() to obtain valid group id");
+ "Please use PersistenceManager.createGroupKey() to obtain valid group id");
}
- GroupId groupId = new GroupId(id);
+ GroupKey groupKey = new GroupKey(id);
- return findGroup(groupId.getName(), groupId.getType());
+ return findGroup(groupKey.getName(), groupKey.getType());
}
@@ -455,5 +458,4 @@
}
-
}
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RelationshipManagerImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RelationshipManagerImpl.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RelationshipManagerImpl.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -23,7 +23,6 @@
package org.jboss.identity.idm.impl.api.session.managers;
import org.jboss.identity.idm.api.RelationshipManager;
-import org.jboss.identity.idm.api.IdentitySession;
import org.jboss.identity.idm.api.Group;
import org.jboss.identity.idm.api.User;
import org.jboss.identity.idm.api.IdentityType;
@@ -40,12 +39,11 @@
import org.jboss.identity.idm.impl.api.session.IdentitySessionImpl;
import org.jboss.identity.idm.impl.api.IdentitySearchCriteriaImpl;
import org.jboss.identity.idm.impl.api.model.SimpleGroup;
-import org.jboss.identity.idm.impl.api.model.GroupId;
+import org.jboss.identity.idm.impl.api.model.GroupKey;
import org.jboss.identity.idm.impl.api.model.SimpleUser;
import org.jboss.identity.idm.impl.cache.RelationshipSearchImpl;
import org.jboss.identity.idm.impl.cache.GroupSearchImpl;
import org.jboss.identity.idm.impl.cache.UserSearchImpl;
-import org.jboss.identity.idm.cache.RelationshipSearch;
import java.util.Collection;
import java.util.Iterator;
@@ -179,7 +177,7 @@
associateGroups(Arrays.asList(parent), members);
}
- public void associateGroupsByIds(Collection<String> parentIds, Collection<String> memberIds) throws IdentityException
+ public void associateGroupsByKeys(Collection<String> parentIds, Collection<String> memberIds) throws IdentityException
{
checkNotNullArgument(parentIds, "Parents Ids");
checkNotNullArgument(memberIds, "Members Ids");
@@ -192,16 +190,16 @@
{
String memberId = membersIterator.next();
- associateGroupsByIds(parentId, memberId);
+ associateGroupsByKeys(parentId, memberId);
}
}
}
- public void associateGroupsByIds(String parentId, Collection<String> memberIds) throws IdentityException
+ public void associateGroupsByKeys(String parentId, Collection<String> memberIds) throws IdentityException
{
checkNotNullArgument(parentId, "Parent Id");
- associateGroupsByIds(Arrays.asList(parentId), memberIds);
+ associateGroupsByKeys(Arrays.asList(parentId), memberIds);
}
public void associateGroups(Group parent, Group member) throws IdentityException
@@ -224,13 +222,13 @@
}
- public void associateGroupsByIds(String parentId, String memberId) throws IdentityException
+ public void associateGroupsByKeys(String parentId, String memberId) throws IdentityException
{
checkNotNullArgument(parentId, "Parent Id");
checkNotNullArgument(memberId, "Member Id");
- Group parent = new SimpleGroup(new GroupId(parentId));
- Group member = new SimpleGroup(new GroupId(memberId));
+ Group parent = new SimpleGroup(new GroupKey(parentId));
+ Group member = new SimpleGroup(new GroupKey(memberId));
preGroupAssociationCreate(parent, member);
@@ -274,7 +272,7 @@
}
- public void associateUsersByIds(Collection<String> parents, Collection<String> members) throws IdentityException
+ public void associateUsersByKeys(Collection<String> parents, Collection<String> members) throws IdentityException
{
checkNotNullArgument(parents, "parents");
@@ -288,17 +286,17 @@
{
String member = membersIterator.next();
- associateUserByIds(parent, member);
+ associateUserByKeys(parent, member);
}
}
}
- public void associateUsersByIds(String parentId, Collection<String> members) throws IdentityException
+ public void associateUsersByKeys(String parentId, Collection<String> members) throws IdentityException
{
checkNotNullArgument(parentId, "Parent Id");
- associateUsersByIds(Arrays.asList(parentId), members);
+ associateUsersByKeys(Arrays.asList(parentId), members);
}
@@ -323,12 +321,12 @@
}
- public void associateUserByIds(String parentId, String memberId) throws IdentityException
+ public void associateUserByKeys(String parentId, String memberId) throws IdentityException
{
checkNotNullArgument(parentId, "Parent group Id");
checkNotNullArgument(memberId, "Member user Id");
- Group parent = new SimpleGroup(new GroupId(parentId));
+ Group parent = new SimpleGroup(new GroupKey(parentId));
User member = new SimpleUser(memberId);
preUserAssociationCreate(parent, member);
@@ -405,7 +403,7 @@
disassociateGroups(Arrays.asList(parent), members);
}
- public void disassociateGroupsByIds(Collection<String> parents, Collection<String> members) throws IdentityException
+ public void disassociateGroupsByKeys(Collection<String> parents, Collection<String> members) throws IdentityException
{
checkNotNullArgument(parents, "parents");
checkNotNullArgument(members, "members");
@@ -418,8 +416,8 @@
{
String member = membersIterator.next();
- Group parentGroup = new SimpleGroup(new GroupId(parent));
- Group memberGroup = new SimpleGroup(new GroupId(member));
+ Group parentGroup = new SimpleGroup(new GroupKey(parent));
+ Group memberGroup = new SimpleGroup(new GroupKey(member));
preGroupAssociationRemove(parentGroup, memberGroup);
@@ -438,11 +436,11 @@
}
}
- public void disassociateGroupsByIds(String parent, Collection<String> members) throws IdentityException
+ public void disassociateGroupsByKeys(String parent, Collection<String> members) throws IdentityException
{
checkNotNullArgument(parent, "Parent Id");
- disassociateGroupsByIds(Arrays.asList(parent), members);
+ disassociateGroupsByKeys(Arrays.asList(parent), members);
}
public void disassociateUsers(Collection<Group> parents, Collection<User> members) throws IdentityException
@@ -482,7 +480,7 @@
disassociateUsers(Arrays.asList(parent), members);
}
- public void disassociateUsersByIds(Collection<String> parents, Collection<String> members) throws IdentityException
+ public void disassociateUsersByKeys(Collection<String> parents, Collection<String> members) throws IdentityException
{
checkNotNullArgument(parents, "parents");
checkNotNullArgument(members, "members");
@@ -496,7 +494,7 @@
{
String member = membersIterator.next();
- Group parentGroup = new SimpleGroup(new GroupId(parent));
+ Group parentGroup = new SimpleGroup(new GroupKey(parent));
User memberUser = new SimpleUser(member);
preUserAssociationRemove(parentGroup, memberUser);
@@ -516,11 +514,11 @@
}
}
- public void disassociateUsersByIds(String parent, Collection<String> members) throws IdentityException
+ public void disassociateUsersByKeys(String parent, Collection<String> members) throws IdentityException
{
checkNotNullArgument(parent, "Parent Id");
- disassociateUsersByIds(Arrays.asList(parent), members);
+ disassociateUsersByKeys(Arrays.asList(parent), members);
}
@@ -602,7 +600,7 @@
return true;
}
- public boolean isAssociatedByIds(Collection<String> parents, Collection<String> members) throws IdentityException
+ public boolean isAssociatedByKeys(Collection<String> parents, Collection<String> members) throws IdentityException
{
checkNotNullArgument(parents, "parents");
checkNotNullArgument(members, "members");
@@ -691,7 +689,7 @@
return isAssociated(parents, members);
}
- public boolean isAssociatedByIds(String parent, String member) throws IdentityException
+ public boolean isAssociatedByKeys(String parent, String member) throws IdentityException
{
checkNotNullArgument(parent, "Parent Id");
checkNotNullArgument(member, "Member Id");
@@ -760,7 +758,7 @@
if (cache != null)
{
GroupSearchImpl search = new GroupSearchImpl();
- search.addAssociatedGroupId(group.getId());
+ search.addAssociatedGroupId(group.getKey());
search.setGroupType(groupType);
search.setParent(parent);
search.setCascade(cascade);
@@ -818,7 +816,7 @@
if (cache != null)
{
GroupSearchImpl search = new GroupSearchImpl();
- search.addAssociatedGroupId(group.getId());
+ search.addAssociatedGroupId(group.getKey());
search.setGroupType(groupType);
search.setParent(parent);
search.setCascade(cascade);
@@ -858,7 +856,7 @@
if (cache != null)
{
GroupSearchImpl search = new GroupSearchImpl();
- search.addAssociatedUserId(user.getId());
+ search.addAssociatedUserId(user.getKey());
search.setGroupType(groupType);
search.setSearchCriteria(criteria);
@@ -886,7 +884,7 @@
if (cache != null)
{
GroupSearchImpl search = new GroupSearchImpl();
- search.addAssociatedUserId(user.getId());
+ search.addAssociatedUserId(user.getKey());
search.setGroupType(groupType);
search.setSearchCriteria(criteria);
@@ -924,7 +922,7 @@
if (cache != null)
{
GroupSearchImpl search = new GroupSearchImpl();
- search.addAssociatedUserId(user.getId());
+ search.addAssociatedUserId(user.getKey());
search.setSearchCriteria(criteria);
Collection<Group> results = cache.getGroupSearch(cacheNS, search);
@@ -952,7 +950,7 @@
if (cache != null)
{
GroupSearchImpl search = new GroupSearchImpl();
- search.addAssociatedUserId(user.getId());
+ search.addAssociatedUserId(user.getKey());
search.setSearchCriteria(criteria);
cache.putGroupSearch(cacheNS, search, identities);
@@ -984,7 +982,7 @@
if (cache != null)
{
UserSearchImpl search = new UserSearchImpl();
- search.addAssociatedGroupId(group.getId());
+ search.addAssociatedGroupId(group.getKey());
search.setCascade(cascade);
search.setSearchCriteria(criteria);
@@ -1047,7 +1045,7 @@
if (cache != null)
{
UserSearchImpl search = new UserSearchImpl();
- search.addAssociatedGroupId(group.getId());
+ search.addAssociatedGroupId(group.getKey());
search.setCascade(cascade);
search.setSearchCriteria(criteria);
@@ -1080,7 +1078,7 @@
if (cache != null)
{
GroupSearchImpl search = new GroupSearchImpl();
- search.addRelatedUserId(user.getId());
+ search.addRelatedUserId(user.getKey());
search.setGroupType(groupType);
search.setSearchCriteria(criteria);
@@ -1108,7 +1106,7 @@
if (cache != null)
{
GroupSearchImpl search = new GroupSearchImpl();
- search.addRelatedUserId(user.getId());
+ search.addRelatedUserId(user.getKey());
search.setGroupType(groupType);
search.setSearchCriteria(criteria);
@@ -1138,7 +1136,7 @@
if (cache != null)
{
UserSearchImpl search = new UserSearchImpl();
- search.addRelatedGroupId(group.getId());
+ search.addRelatedGroupId(group.getKey());
search.setSearchCriteria(criteria);
Collection<User> results = cache.getUserSearch(cacheNS, search);
@@ -1170,7 +1168,7 @@
if (cache != null)
{
UserSearchImpl search = new UserSearchImpl();
- search.addRelatedGroupId(group.getId());
+ search.addRelatedGroupId(group.getKey());
search.setSearchCriteria(criteria);
cache.putUserSearch(cacheNS, search, identities);
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RoleManagerImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RoleManagerImpl.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RoleManagerImpl.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -23,7 +23,6 @@
package org.jboss.identity.idm.impl.api.session.managers;
import org.jboss.identity.idm.api.RoleManager;
-import org.jboss.identity.idm.api.IdentitySession;
import org.jboss.identity.idm.api.RoleType;
import org.jboss.identity.idm.api.Role;
import org.jboss.identity.idm.api.User;
@@ -32,7 +31,6 @@
import org.jboss.identity.idm.api.RoleManagerFeaturesDescription;
import org.jboss.identity.idm.api.IdentitySearchCriteria;
import org.jboss.identity.idm.api.IdentitySearchCriteriumType;
-import org.jboss.identity.idm.api.query.RoleQuery;
import org.jboss.identity.idm.common.exception.IdentityException;
import org.jboss.identity.idm.spi.model.IdentityObjectRelationshipType;
import org.jboss.identity.idm.spi.model.IdentityObjectRelationship;
@@ -670,7 +668,7 @@
if (cache != null)
{
UserSearchImpl search = new UserSearchImpl();
- search.addRelatedGroupId(group.getId());
+ search.addRelatedGroupId(group.getKey());
search.setSearchCriteria(criteria);
Collection<User> results = cache.getUserSearch(cacheNS, search);
@@ -692,7 +690,7 @@
if (cache != null)
{
UserSearchImpl search = new UserSearchImpl();
- search.addRelatedGroupId(group.getId());
+ search.addRelatedGroupId(group.getKey());
search.setSearchCriteria(criteria);
cache.putUserSearch(cacheNS, search, identities);
@@ -720,7 +718,7 @@
if (cache != null)
{
GroupSearchImpl search = new GroupSearchImpl();
- search.addRelatedUserId(user.getId());
+ search.addRelatedUserId(user.getKey());
search.setSearchCriteria(criteria);
Collection<Group> results = cache.getGroupSearch(cacheNS, search);
@@ -742,7 +740,7 @@
if (cache != null)
{
GroupSearchImpl search = new GroupSearchImpl();
- search.addRelatedUserId(user.getId());
+ search.addRelatedUserId(user.getKey());
search.setSearchCriteria(criteria);
cache.putGroupSearch(cacheNS, search, identities);
@@ -771,7 +769,7 @@
if (cache != null)
{
GroupSearchImpl search = new GroupSearchImpl();
- search.addRelatedUserId(user.getId());
+ search.addRelatedUserId(user.getKey());
search.setGroupType(groupType);
search.setSearchCriteria(criteria);
@@ -809,7 +807,7 @@
if (cache != null)
{
GroupSearchImpl search = new GroupSearchImpl();
- search.addRelatedUserId(user.getId());
+ search.addRelatedUserId(user.getKey());
search.setGroupType(groupType);
search.setSearchCriteria(criteria);
@@ -842,7 +840,7 @@
if (cache != null)
{
RoleSearchImpl search = new RoleSearchImpl();
- search.setIdentityTypeId(identityType.getId());
+ search.setIdentityTypeId(identityType.getKey());
search.setRoleType(roleType);
Collection<Role> results = cache.getRoleSearch(cacheNS, search);
@@ -883,7 +881,7 @@
if (cache != null)
{
RoleSearchImpl search = new RoleSearchImpl();
- search.setIdentityTypeId(identityType.getId());
+ search.setIdentityTypeId(identityType.getKey());
search.setRoleType(roleType);
cache.putRoleSearch(cacheNS, search, roles);
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/RelationshipSearchImpl.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/RelationshipSearchImpl.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/cache/RelationshipSearchImpl.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -25,7 +25,7 @@
import org.jboss.identity.idm.cache.RelationshipSearch;
import org.jboss.identity.idm.api.IdentityType;
-import org.jboss.identity.idm.impl.api.model.GroupId;
+import org.jboss.identity.idm.impl.api.model.GroupKey;
import org.jboss.identity.idm.impl.api.model.SimpleGroup;
import org.jboss.identity.idm.impl.api.model.SimpleUser;
@@ -70,9 +70,9 @@
public void addParent(String id)
{
- if (GroupId.validateId(id))
+ if (GroupKey.validateKey(id))
{
- parents.add(new SimpleGroup(new GroupId(id)));
+ parents.add(new SimpleGroup(new GroupKey(id)));
return;
}
parents.add(new SimpleUser(id));
@@ -80,9 +80,9 @@
public void addMember(String id)
{
- if (GroupId.validateId(id))
+ if (GroupKey.validateKey(id))
{
- members.add(new SimpleGroup(new GroupId(id)));
+ members.add(new SimpleGroup(new GroupKey(id)));
return;
}
members.add(new SimpleUser(id));
Modified: idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/configuration/jaxb2/JAXB2IdentityConfiguration.java
===================================================================
--- idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/configuration/jaxb2/JAXB2IdentityConfiguration.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-core/src/main/java/org/jboss/identity/idm/impl/configuration/jaxb2/JAXB2IdentityConfiguration.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -443,7 +443,7 @@
// all configured identity object types
// if (storeMD.getSupportedIdentityTypes() == null || storeMD.getSupportedIdentityTypes().size() == 0)
// {
-// throw new IdentityConfigurationException("identity-store \"" + storeMD.getId() + "\" doesn't have any supported " +
+// throw new IdentityConfigurationException("identity-store \"" + storeMD.getKey() + "\" doesn't have any supported " +
// "identity-object-types configured");
// }
@@ -584,7 +584,7 @@
// if (repoMD.getIdentityStoreToIdentityObjectTypeMappings() == null ||
// repoMD.getIdentityStoreToIdentityObjectTypeMappings().size() == 0)
// {
-// throw new IdentityConfigurationException("No identity-store-mappings defined in repository \"" + repoMD.getId() + "\"");
+// throw new IdentityConfigurationException("No identity-store-mappings defined in repository \"" + repoMD.getKey() + "\"");
// }
// If there are no repo mappings then add all mappings from the default store
Modified: idm/trunk/idm-core/src/test/java/org/jboss/identity/idm/impl/store/CommonIdentityStoreTest.java
===================================================================
--- idm/trunk/idm-core/src/test/java/org/jboss/identity/idm/impl/store/CommonIdentityStoreTest.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-core/src/test/java/org/jboss/identity/idm/impl/store/CommonIdentityStoreTest.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -379,42 +379,42 @@
isSearchCriteriaTypeSupported(IdentityTypeEnum.USER, IdentityObjectSearchCriteriaType.NAME_FILTER))
{
- criteria = (IdentityObjectSearchCriteria)new IdentitySearchCriteriaImpl().idFilter("*");
+ criteria = (IdentityObjectSearchCriteria)new IdentitySearchCriteriaImpl().nameFilter("*");
results = testContext.getStore().
findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER, criteria);
assertEquals(8, results.size());
- criteria = (IdentityObjectSearchCriteria)new IdentitySearchCriteriaImpl().idFilter("D*");
+ criteria = (IdentityObjectSearchCriteria)new IdentitySearchCriteriaImpl().nameFilter("D*");
results = testContext.getStore().
findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER, criteria);
assertEquals(3, results.size());
- criteria = (IdentityObjectSearchCriteria)new IdentitySearchCriteriaImpl().idFilter("*2");
+ criteria = (IdentityObjectSearchCriteria)new IdentitySearchCriteriaImpl().nameFilter("*2");
results = testContext.getStore().
findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER, criteria);
assertEquals(3, results.size());
- criteria = (IdentityObjectSearchCriteria)new IdentitySearchCriteriaImpl().idFilter("*3");
+ criteria = (IdentityObjectSearchCriteria)new IdentitySearchCriteriaImpl().nameFilter("*3");
results = testContext.getStore().
findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER, criteria);
assertEquals(2, results.size());
- criteria = (IdentityObjectSearchCriteria)new IdentitySearchCriteriaImpl().idFilter("Company1");
+ criteria = (IdentityObjectSearchCriteria)new IdentitySearchCriteriaImpl().nameFilter("Company1");
results = testContext.getStore().
findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER, criteria);
assertEquals(1, results.size());
- criteria = (IdentityObjectSearchCriteria)new IdentitySearchCriteriaImpl().idFilter("Toronto");
+ criteria = (IdentityObjectSearchCriteria)new IdentitySearchCriteriaImpl().nameFilter("Toronto");
results = testContext.getStore().
findIdentityObject(testContext.getCtx(), IdentityTypeEnum.USER, criteria);
Modified: idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/GroupQueryTest.java
===================================================================
--- idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/GroupQueryTest.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/GroupQueryTest.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -78,7 +78,7 @@
Role role1 = ids.getRoleManager().createRole(rt1, user1, group1);
Role role2 = ids.getRoleManager().createRole(rt1, user1, group2);
- Role role3 = ids.getRoleManager().createRole("rt2", user1.getId(), group1.getId());
+ Role role3 = ids.getRoleManager().createRole("rt2", user1.getKey(), group1.getKey());
// Assertions
Modified: idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/ModelTestCase.java
===================================================================
--- idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/ModelTestCase.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/ModelTestCase.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -23,7 +23,7 @@
package org.jboss.identity.idm.impl.api;
import junit.framework.TestCase;
-import org.jboss.identity.idm.impl.api.model.GroupId;
+import org.jboss.identity.idm.impl.api.model.GroupKey;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
@@ -35,13 +35,13 @@
public void testGroupId() throws Exception
{
- GroupId id = new GroupId(GroupId.PREFIX + GroupId.SEPARATOR + "groupTypeName" + GroupId.SEPARATOR + "groupName");
- assertEquals("groupName", id.getName());
- assertEquals("groupTypeName", id.getType());
+ GroupKey key = new GroupKey(GroupKey.PREFIX + GroupKey.SEPARATOR + "groupTypeName" + GroupKey.SEPARATOR + "groupName");
+ assertEquals("groupName", key.getName());
+ assertEquals("groupTypeName", key.getType());
- id = new GroupId("groupName", "groupTypeName");
- assertEquals("groupName", id.getName());
- assertEquals("groupTypeName", id.getType());
+ key = new GroupKey("groupName", "groupTypeName");
+ assertEquals("groupName", key.getName());
+ assertEquals("groupTypeName", key.getType());
}
Modified: idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/PersistenceManagerTest.java
===================================================================
--- idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/PersistenceManagerTest.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/PersistenceManagerTest.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -109,11 +109,11 @@
assertEquals(group1.getGroupType(), ORGANIZATION);
assertEquals(group1.getName(), "groupName1");
- String group1Id = session.getPersistenceManager().createGroupId("groupName1", ORGANIZATION);
+ String group1Id = session.getPersistenceManager().createGroupKey("groupName1", ORGANIZATION);
- assertEquals(group1Id, group1.getId());
+ assertEquals(group1Id, group1.getKey());
- group1 = session.getPersistenceManager().findGroupById(group1Id);
+ group1 = session.getPersistenceManager().findGroupByKey(group1Id);
assertNotNull(group1);
assertEquals(group1.getGroupType(), ORGANIZATION);
@@ -131,9 +131,9 @@
assertEquals(0, session.getPersistenceManager().findGroup(DEPARTMENT).size());
session.getPersistenceManager().removeGroup(group1, false);
- String id = session.getPersistenceManager().createGroupId("groupName2", ORGANIZATION);
+ String id = session.getPersistenceManager().createGroupKey("groupName2", ORGANIZATION);
session.getPersistenceManager().removeGroup(id, false);
- id = session.getPersistenceManager().createGroupId("groupName3", PROJECT);
+ id = session.getPersistenceManager().createGroupKey("groupName3", PROJECT);
session.getPersistenceManager().removeGroup(id, false);
assertEquals(0, session.getPersistenceManager().findGroup(ORGANIZATION, (IdentitySearchCriteria)null).size());
@@ -150,7 +150,7 @@
User u1 = session.getPersistenceManager().createUser("olo");
assertNotNull(u1);
- assertEquals(u1.getId(), "olo");
+ assertEquals(u1.getKey(), "olo");
session.getPersistenceManager().createUser("anna");
Modified: idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/RelationshipManagerTest.java
===================================================================
--- idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/RelationshipManagerTest.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/RelationshipManagerTest.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -111,18 +111,18 @@
assertFalse(session.getRelationshipManager().isAssociated(Arrays.asList(group1, group2), Arrays.asList(group2, group3)));
assertFalse(session.getRelationshipManager().isAssociated(Arrays.asList(group2, group3), Arrays.asList(group1)));
- assertTrue(session.getRelationshipManager().isAssociatedByIds(group1.getId(), group2.getId()));
- assertTrue(session.getRelationshipManager().isAssociatedByIds(group1.getId(), group3.getId()));
- assertFalse(session.getRelationshipManager().isAssociatedByIds(group1.getId(), group4.getId()));
- assertFalse(session.getRelationshipManager().isAssociatedByIds(group2.getId(), group1.getId()));
- assertFalse(session.getRelationshipManager().isAssociatedByIds(group2.getId(), group3.getId()));
+ assertTrue(session.getRelationshipManager().isAssociatedByKeys(group1.getKey(), group2.getKey()));
+ assertTrue(session.getRelationshipManager().isAssociatedByKeys(group1.getKey(), group3.getKey()));
+ assertFalse(session.getRelationshipManager().isAssociatedByKeys(group1.getKey(), group4.getKey()));
+ assertFalse(session.getRelationshipManager().isAssociatedByKeys(group2.getKey(), group1.getKey()));
+ assertFalse(session.getRelationshipManager().isAssociatedByKeys(group2.getKey(), group3.getKey()));
assertTrue(session.getRelationshipManager().
- isAssociatedByIds(Arrays.asList(group1.getId()), Arrays.asList(group2.getId(), group3.getId())));
+ isAssociatedByKeys(Arrays.asList(group1.getKey()), Arrays.asList(group2.getKey(), group3.getKey())));
assertFalse(session.getRelationshipManager().
- isAssociatedByIds(Arrays.asList(group1.getId(), group2.getId()), Arrays.asList(group2.getId(), group3.getId())));
+ isAssociatedByKeys(Arrays.asList(group1.getKey(), group2.getKey()), Arrays.asList(group2.getKey(), group3.getKey())));
assertFalse(session.getRelationshipManager().
- isAssociatedByIds(Arrays.asList(group2.getId(), group3.getId()), Arrays.asList(group1.getId())));
+ isAssociatedByKeys(Arrays.asList(group2.getKey(), group3.getKey()), Arrays.asList(group1.getKey())));
// Associate groups - other methods
@@ -137,17 +137,17 @@
session.getRelationshipManager().associateGroups(Arrays.asList(group1), Arrays.asList(group2, group3));
assertTrue(session.getRelationshipManager().isAssociated(Arrays.asList(group1), Arrays.asList(group2, group3)));
- session.getRelationshipManager().disassociateGroupsByIds(Arrays.asList(group1.getId()), Arrays.asList(group2.getId(), group3.getId()));
+ session.getRelationshipManager().disassociateGroupsByKeys(Arrays.asList(group1.getKey()), Arrays.asList(group2.getKey(), group3.getKey()));
// reassociate #2
- session.getRelationshipManager().associateGroupsByIds(Arrays.asList(group1.getId()), Arrays.asList(group2.getId(), group3.getId()));
+ session.getRelationshipManager().associateGroupsByKeys(Arrays.asList(group1.getKey()), Arrays.asList(group2.getKey(), group3.getKey()));
assertTrue(session.getRelationshipManager().isAssociated(Arrays.asList(group1), Arrays.asList(group2, group3)));
session.getRelationshipManager().disassociateGroups(Arrays.asList(group1), Arrays.asList(group2, group3));
// reassociate #3
- session.getRelationshipManager().associateGroupsByIds(group1.getId(), group2.getId());
- session.getRelationshipManager().associateGroupsByIds(group1.getId(), group3.getId());
+ session.getRelationshipManager().associateGroupsByKeys(group1.getKey(), group2.getKey());
+ session.getRelationshipManager().associateGroupsByKeys(group1.getKey(), group3.getKey());
assertTrue(session.getRelationshipManager().isAssociated(Arrays.asList(group1), Arrays.asList(group2, group3)));
session.getRelationshipManager().disassociateGroups(Arrays.asList(group1), Arrays.asList(group2, group3));
@@ -170,18 +170,18 @@
assertFalse(session.getRelationshipManager().isAssociated(Arrays.asList(group1, group2), Arrays.asList(user1, user2)));
assertFalse(session.getRelationshipManager().isAssociated(Arrays.asList(group2), Arrays.asList(user3)));
- assertTrue(session.getRelationshipManager().isAssociatedByIds(group1.getId(), user1.getId()));
- assertTrue(session.getRelationshipManager().isAssociatedByIds(group1.getId(), user2.getId()));
- assertFalse(session.getRelationshipManager().isAssociatedByIds(group1.getId(), user3.getId()));
- assertFalse(session.getRelationshipManager().isAssociatedByIds(group2.getId(), user1.getId()));
- assertFalse(session.getRelationshipManager().isAssociatedByIds(group2.getId(), user3.getId()));
+ assertTrue(session.getRelationshipManager().isAssociatedByKeys(group1.getKey(), user1.getKey()));
+ assertTrue(session.getRelationshipManager().isAssociatedByKeys(group1.getKey(), user2.getKey()));
+ assertFalse(session.getRelationshipManager().isAssociatedByKeys(group1.getKey(), user3.getKey()));
+ assertFalse(session.getRelationshipManager().isAssociatedByKeys(group2.getKey(), user1.getKey()));
+ assertFalse(session.getRelationshipManager().isAssociatedByKeys(group2.getKey(), user3.getKey()));
assertTrue(session.getRelationshipManager().
- isAssociatedByIds(Arrays.asList(group1.getId()), Arrays.asList(user1.getId(), user2.getId())));
+ isAssociatedByKeys(Arrays.asList(group1.getKey()), Arrays.asList(user1.getKey(), user2.getKey())));
assertFalse(session.getRelationshipManager().
- isAssociatedByIds(Arrays.asList(group1.getId(), group2.getId()), Arrays.asList(user1.getId(), user2.getId())));
+ isAssociatedByKeys(Arrays.asList(group1.getKey(), group2.getKey()), Arrays.asList(user1.getKey(), user2.getKey())));
assertFalse(session.getRelationshipManager().
- isAssociatedByIds(Arrays.asList(group2.getId(), group3.getId()), Arrays.asList(user1.getId())));
+ isAssociatedByKeys(Arrays.asList(group2.getKey(), group3.getKey()), Arrays.asList(user1.getKey())));
// Associate groups / users - other methods
@@ -199,23 +199,23 @@
session.getRelationshipManager().disassociateUsers(Arrays.asList(group1), Arrays.asList(user1, user2));
// reassociate #2
- session.getRelationshipManager().associateUsersByIds(Arrays.asList(group1.getId()), Arrays.asList(user1.getId(), user2.getId()));
+ session.getRelationshipManager().associateUsersByKeys(Arrays.asList(group1.getKey()), Arrays.asList(user1.getKey(), user2.getKey()));
assertTrue(session.getRelationshipManager().isAssociated(Arrays.asList(group1), Arrays.asList(user1, user2)));
- session.getRelationshipManager().disassociateUsersByIds(Arrays.asList(group1.getId()), Arrays.asList(user1.getId(), user2.getId()));
+ session.getRelationshipManager().disassociateUsersByKeys(Arrays.asList(group1.getKey()), Arrays.asList(user1.getKey(), user2.getKey()));
// reassociate #3
- session.getRelationshipManager().associateUserByIds(group1.getId(), user1.getId());
- session.getRelationshipManager().associateUserByIds(group1.getId(), user2.getId());
+ session.getRelationshipManager().associateUserByKeys(group1.getKey(), user1.getKey());
+ session.getRelationshipManager().associateUserByKeys(group1.getKey(), user2.getKey());
assertTrue(session.getRelationshipManager().isAssociated(Arrays.asList(group1), Arrays.asList(user1, user2)));
session.getRelationshipManager().disassociateUsers(Arrays.asList(group1), Arrays.asList(user1, user2));
// reassociate #4
- session.getRelationshipManager().associateUserByIds(group1.getId(), user1.getId());
- session.getRelationshipManager().associateUserByIds(group2.getId(), user1.getId());
- session.getRelationshipManager().associateUserByIds(group3.getId(), user1.getId());
+ session.getRelationshipManager().associateUserByKeys(group1.getKey(), user1.getKey());
+ session.getRelationshipManager().associateUserByKeys(group2.getKey(), user1.getKey());
+ session.getRelationshipManager().associateUserByKeys(group3.getKey(), user1.getKey());
assertTrue(session.getRelationshipManager().isAssociated(Arrays.asList(group1, group2, group3), Arrays.asList(user1)));
@@ -257,8 +257,8 @@
assertEquals(3, session.getRelationshipManager().findAssociatedUsers(group1, false, null).size());
assertEquals(0, session.getRelationshipManager().findAssociatedUsers(group2, false, null).size());
- assertEquals(3, session.getRelationshipManager().findAssociatedUsers(group1.getId(), false, null).size());
- assertEquals(0, session.getRelationshipManager().findAssociatedUsers(group2.getId(), false, null).size());
+ assertEquals(3, session.getRelationshipManager().findAssociatedUsers(group1.getKey(), false, null).size());
+ assertEquals(0, session.getRelationshipManager().findAssociatedUsers(group2.getKey(), false, null).size());
// Find groups
@@ -269,9 +269,9 @@
assertEquals(0, session.getRelationshipManager().findAssociatedGroups(group2, ORGANIZATION, true, false).size());
// #1
- assertEquals(2, session.getRelationshipManager().findAssociatedGroups(group2.getId(), DEPARTMENT, true, false, null).size());
- assertEquals(1, session.getRelationshipManager().findAssociatedGroups(group2.getId(), ORGANIZATION_UNIT, true, false, null).size());
- assertEquals(0, session.getRelationshipManager().findAssociatedGroups(group2.getId(), ORGANIZATION, true, false, null).size());
+ assertEquals(2, session.getRelationshipManager().findAssociatedGroups(group2.getKey(), DEPARTMENT, true, false, null).size());
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(group2.getKey(), ORGANIZATION_UNIT, true, false, null).size());
+ assertEquals(0, session.getRelationshipManager().findAssociatedGroups(group2.getKey(), ORGANIZATION, true, false, null).size());
// #3
assertEquals(1, session.getRelationshipManager().findAssociatedGroups(group3, ORGANIZATION_UNIT, false, false).size());
@@ -280,9 +280,9 @@
assertEquals(3, session.getRelationshipManager().findAssociatedGroups(group2, null, true, false).size());
// #4
- assertEquals(1, session.getRelationshipManager().findAssociatedGroups(group3.getId(), ORGANIZATION_UNIT, false, false, null).size());
- assertEquals(1, session.getRelationshipManager().findAssociatedGroups(group4.getId(), ORGANIZATION_UNIT, false, false, null).size());
- assertEquals(0, session.getRelationshipManager().findAssociatedGroups(group2.getId(), ORGANIZATION, false, false, null).size());
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(group3.getKey(), ORGANIZATION_UNIT, false, false, null).size());
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(group4.getKey(), ORGANIZATION_UNIT, false, false, null).size());
+ assertEquals(0, session.getRelationshipManager().findAssociatedGroups(group2.getKey(), ORGANIZATION, false, false, null).size());
// #5
assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user1).size());
@@ -291,10 +291,10 @@
assertEquals(0, session.getRelationshipManager().findAssociatedGroups(user4).size());
// #6
- assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user1.getId(), null).size());
- assertEquals(2, session.getRelationshipManager().findAssociatedGroups(user2.getId(), null).size());
- assertEquals(2, session.getRelationshipManager().findAssociatedGroups(user3.getId(), null).size());
- assertEquals(0, session.getRelationshipManager().findAssociatedGroups(user4.getId(), null).size());
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user1.getKey(), null).size());
+ assertEquals(2, session.getRelationshipManager().findAssociatedGroups(user2.getKey(), null).size());
+ assertEquals(2, session.getRelationshipManager().findAssociatedGroups(user3.getKey(), null).size());
+ assertEquals(0, session.getRelationshipManager().findAssociatedGroups(user4.getKey(), null).size());
// #7
assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user1, ORGANIZATION).size());
@@ -308,14 +308,14 @@
assertEquals(0, session.getRelationshipManager().findAssociatedGroups(user4, ORGANIZATION_UNIT).size());
// #7
- assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user1.getId(), ORGANIZATION, null).size());
- assertEquals(0, session.getRelationshipManager().findAssociatedGroups(user1.getId(), ORGANIZATION_UNIT, null).size());
- assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user2.getId(), ORGANIZATION, null).size());
- assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user2.getId(), ORGANIZATION_UNIT, null).size());
- assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user3.getId(), ORGANIZATION, null).size());
- assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user3.getId(), ORGANIZATION_UNIT, null).size());
- assertEquals(0, session.getRelationshipManager().findAssociatedGroups(user4.getId(), ORGANIZATION, null).size());
- assertEquals(0, session.getRelationshipManager().findAssociatedGroups(user4.getId(), ORGANIZATION_UNIT, null).size());
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user1.getKey(), ORGANIZATION, null).size());
+ assertEquals(0, session.getRelationshipManager().findAssociatedGroups(user1.getKey(), ORGANIZATION_UNIT, null).size());
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user2.getKey(), ORGANIZATION, null).size());
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user2.getKey(), ORGANIZATION_UNIT, null).size());
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user3.getKey(), ORGANIZATION, null).size());
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user3.getKey(), ORGANIZATION_UNIT, null).size());
+ assertEquals(0, session.getRelationshipManager().findAssociatedGroups(user4.getKey(), ORGANIZATION, null).size());
+ assertEquals(0, session.getRelationshipManager().findAssociatedGroups(user4.getKey(), ORGANIZATION_UNIT, null).size());
// Cleanup and check
session.getRelationshipManager().disassociateUsers(Arrays.asList(group1), Arrays.asList(user1, user2, user3));
@@ -427,13 +427,13 @@
session.getRoleManager().createRoleType("rt1");
session.getRoleManager().createRoleType("rt2");
- session.getRoleManager().createRole("rt1", user1.getId(), group1.getId());
- session.getRoleManager().createRole("rt1", user3.getId(), group1.getId());
- session.getRoleManager().createRole("rt1", user4.getId(), group1.getId());
- session.getRoleManager().createRole("rt2", user3.getId(), group1.getId());
+ session.getRoleManager().createRole("rt1", user1.getKey(), group1.getKey());
+ session.getRoleManager().createRole("rt1", user3.getKey(), group1.getKey());
+ session.getRoleManager().createRole("rt1", user4.getKey(), group1.getKey());
+ session.getRoleManager().createRole("rt2", user3.getKey(), group1.getKey());
- session.getRoleManager().createRole("rt1", user3.getId(), group2.getId());
- session.getRoleManager().createRole("rt2", user2.getId(), group3.getId());
+ session.getRoleManager().createRole("rt1", user3.getKey(), group2.getKey());
+ session.getRoleManager().createRole("rt2", user2.getKey(), group3.getKey());
// Assert
Modified: idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/RoleManagerTest.java
===================================================================
--- idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/RoleManagerTest.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/RoleManagerTest.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -33,8 +33,6 @@
import java.util.Map;
import java.util.HashMap;
-import java.util.Set;
-import java.util.HashSet;
/**
*
@@ -130,7 +128,7 @@
Role role1 = session.getRoleManager().createRole(rt1, user1, group1);
Role role2 = session.getRoleManager().createRole(rt1, user1, group2);
- Role role3 = session.getRoleManager().createRole("rt2", user1.getId(), group1.getId());
+ Role role3 = session.getRoleManager().createRole("rt2", user1.getKey(), group1.getKey());
@@ -145,35 +143,35 @@
//
assertEquals(2, session.getRoleManager().findGroupRoleTypes(group1).size());
- assertEquals(1, session.getRoleManager().findGroupRoleTypes(group2.getId(), null).size());
+ assertEquals(1, session.getRoleManager().findGroupRoleTypes(group2.getKey(), null).size());
//
assertEquals(2, session.getRoleManager().findRoles(user1, rt1).size());
- assertEquals(1, session.getRoleManager().findRoles(user1.getId(), "rt2").size());
- assertEquals(1, session.getRoleManager().findRoles(group1.getId(), "rt1").size());
+ assertEquals(1, session.getRoleManager().findRoles(user1.getKey(), "rt2").size());
+ assertEquals(1, session.getRoleManager().findRoles(group1.getKey(), "rt1").size());
assertEquals(1, session.getRoleManager().findRoles(group1, rt1).size());
//
assertEquals(2, session.getRoleManager().findGroupsWithRelatedRole(user1, null).size());
- assertEquals(1, session.getRoleManager().findGroupsWithRelatedRole(user1.getId(), ORGANIZATION, null).size());
+ assertEquals(1, session.getRoleManager().findGroupsWithRelatedRole(user1.getKey(), ORGANIZATION, null).size());
//
assertEquals(2, session.getRoleManager().findRoleTypes(user1, group1).size());
- assertEquals(1, session.getRoleManager().findRoleTypes(user1.getId(), group2.getId(), null).size());
+ assertEquals(1, session.getRoleManager().findRoleTypes(user1.getKey(), group2.getKey(), null).size());
//
assertEquals(2, session.getRoleManager().findUserRoleTypes(user1).size());
- assertEquals(0, session.getRoleManager().findUserRoleTypes(user2.getId(), null).size());
+ assertEquals(0, session.getRoleManager().findUserRoleTypes(user2.getKey(), null).size());
//
assertTrue(session.getRoleManager().hasRole(user1, group1, rt1));
assertTrue(session.getRoleManager().hasRole(user1, group1, rt2));
- assertTrue(session.getRoleManager().hasRole("user1", group2.getId(), "rt1"));
- assertFalse(session.getRoleManager().hasRole("user2", group2.getId(), "rt1"));
+ assertTrue(session.getRoleManager().hasRole("user1", group2.getKey(), "rt1"));
+ assertFalse(session.getRoleManager().hasRole("user2", group2.getKey(), "rt1"));
assertFalse(session.getRoleManager().hasRole(user1, group1, rt3));
assertFalse(session.getRoleManager().hasRole(user1, group4, rt3));
@@ -235,11 +233,11 @@
session.getRoleManager().removeRole(rt1, user1, group1);
session.getRoleManager().removeRole(role2);
- session.getRoleManager().removeRole("rt2", user1.getId(), group1.getId());
+ session.getRoleManager().removeRole("rt2", user1.getKey(), group1.getKey());
assertFalse(session.getRoleManager().hasRole(user1, group1, rt1));
assertFalse(session.getRoleManager().hasRole(user1, group1, rt2));
- assertFalse(session.getRoleManager().hasRole("user1", group2.getId(), "rt1"));
+ assertFalse(session.getRoleManager().hasRole("user1", group2.getKey(), "rt1"));
//
@@ -251,29 +249,29 @@
//
assertEquals(0, session.getRoleManager().findGroupRoleTypes(group1).size());
- assertEquals(0, session.getRoleManager().findGroupRoleTypes(group2.getId(), null).size());
+ assertEquals(0, session.getRoleManager().findGroupRoleTypes(group2.getKey(), null).size());
//
assertEquals(0, session.getRoleManager().findRoles(user1, rt1).size());
- assertEquals(0, session.getRoleManager().findRoles(user1.getId(), "rt2").size());
- assertEquals(0, session.getRoleManager().findRoles(group1.getId(), "rt1").size());
+ assertEquals(0, session.getRoleManager().findRoles(user1.getKey(), "rt2").size());
+ assertEquals(0, session.getRoleManager().findRoles(group1.getKey(), "rt1").size());
assertEquals(0, session.getRoleManager().findRoles(group1, rt1).size());
//
assertEquals(0, session.getRoleManager().findGroupsWithRelatedRole(user1, null).size());
- assertEquals(0, session.getRoleManager().findGroupsWithRelatedRole(user1.getId(), ORGANIZATION, null).size());
+ assertEquals(0, session.getRoleManager().findGroupsWithRelatedRole(user1.getKey(), ORGANIZATION, null).size());
//
assertEquals(0, session.getRoleManager().findRoleTypes(user1, group1).size());
- assertEquals(0, session.getRoleManager().findRoleTypes(user1.getId(), group2.getId(), null).size());
+ assertEquals(0, session.getRoleManager().findRoleTypes(user1.getKey(), group2.getKey(), null).size());
//
assertEquals(0, session.getRoleManager().findUserRoleTypes(user1).size());
- assertEquals(0, session.getRoleManager().findUserRoleTypes(user2.getId(), null).size());
+ assertEquals(0, session.getRoleManager().findUserRoleTypes(user2.getKey(), null).size());
Modified: idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/RoleQueryTest.java
===================================================================
--- idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/RoleQueryTest.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/RoleQueryTest.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -74,7 +74,7 @@
Role role1 = ids.getRoleManager().createRole(rt1, user1, group1);
Role role2 = ids.getRoleManager().createRole(rt1, user1, group2);
- Role role3 = ids.getRoleManager().createRole("rt2", user1.getId(), group1.getId());
+ Role role3 = ids.getRoleManager().createRole("rt2", user1.getKey(), group1.getKey());
// Test Query
Modified: idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/UserQueryTest.java
===================================================================
--- idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/UserQueryTest.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/UserQueryTest.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -86,7 +86,7 @@
Role role1 = ids.getRoleManager().createRole(rt1, user1, group1);
Role role2 = ids.getRoleManager().createRole(rt1, user1, group2);
- Role role3 = ids.getRoleManager().createRole("rt2", user1.getId(), group1.getId());
+ Role role3 = ids.getRoleManager().createRole("rt2", user1.getKey(), group1.getKey());
// Asserts
@@ -98,7 +98,7 @@
assertEquals(1, ids.execute(q).size());
assertEquals(1, ids.list(q).size());
- assertEquals("user1", ids.uniqueResult(q).getId());
+ assertEquals("user1", ids.uniqueResult(q).getKey());
//
qb.reset();
@@ -118,7 +118,7 @@
qb.reset();
qb.addAssociatedGroup(group1);
- qb.withUserId(user1.getId());
+ qb.withUserId(user1.getKey());
assertEquals(1, ids.execute(qb.createQuery()).size());
@@ -126,7 +126,7 @@
qb.reset();
qb.addAssociatedGroup(group2);
- qb.withUserId(user1.getId());
+ qb.withUserId(user1.getKey());
assertEquals(0, ids.execute(qb.createQuery()).size());
Modified: idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreTestCase.java
===================================================================
--- idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreTestCase.java 2009-11-11 13:18:39 UTC (rev 924)
+++ idm/trunk/idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreTestCase.java 2009-11-11 20:46:11 UTC (rev 925)
@@ -208,7 +208,7 @@
//
// IdentityObject io = store.findIdentityObject(ctx, "admin", IdentityTypeEnum.USER);
// assertEquals("admin", io.getName());
-// assertEquals("uid=admin,ou=People,o=test,dc=portal,dc=example,dc=com", io.getId().toString());
+// assertEquals("uid=admin,ou=People,o=test,dc=portal,dc=example,dc=com", io.getKey().toString());
//
// //
//
16 years, 6 months
JBoss Identity SVN: r924 - in identity-federation/trunk/jboss-identity-fed-core/src: main/java/org/jboss/identity/federation/core/wstrust and 2 other directories.
by jboss-identity-commits@lists.jboss.org
Author: sguilhen(a)redhat.com
Date: 2009-11-11 08:18:39 -0500 (Wed, 11 Nov 2009)
New Revision: 924
Modified:
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/util/XMLEncryptionUtil.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/wstrust/StandardRequestHandler.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/wstrust/WSTrustUtil.java
identity-federation/trunk/jboss-identity-fed-core/src/test/java/org/jboss/test/identity/federation/core/wstrust/JBossSTSUnitTestCase.java
identity-federation/trunk/jboss-identity-fed-core/src/test/resources/jboss-sts.xml
Log:
JBID-139: implemented token encryption logic in StadardRequestHandler
Modified: identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/util/XMLEncryptionUtil.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/util/XMLEncryptionUtil.java 2009-11-09 20:36:15 UTC (rev 923)
+++ identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/util/XMLEncryptionUtil.java 2009-11-11 13:18:39 UTC (rev 924)
@@ -56,19 +56,21 @@
//Initialize the Apache XML Security Library
org.apache.xml.security.Init.init();
}
-
+
public static final String CIPHER_DATA_LOCALNAME = "CipherData";
+
public static final String ENCRYPTED_KEY_LOCALNAME = "EncryptedKey";
+
public static final String DS_KEY_INFO = "ds:KeyInfo";
-
- public static final String XMLNS = "http://www.w3.org/2000/xmlns/";
+
+ public static final String XMLNS = "http://www.w3.org/2000/xmlns/";
+
public static String XMLSIG_NS = "http://www.w3.org/2000/09/xmldsig#";
+
public static String XMLENC_NS = "http://www.w3.org/2001/04/xmlenc#";
-
-
- private static HashMap <String, EncryptionAlgorithm> algorithms
- = new HashMap<String, EncryptionAlgorithm>(4);
-
+
+ private static HashMap<String, EncryptionAlgorithm> algorithms = new HashMap<String, EncryptionAlgorithm>(4);
+
private static class EncryptionAlgorithm
{
EncryptionAlgorithm(String jceName, String xmlSecName, int size)
@@ -80,19 +82,20 @@
@SuppressWarnings("unused")
public String jceName;
+
public String xmlSecName;
+
public int size;
}
-
+
static
{
algorithms.put("aes-128", new EncryptionAlgorithm("AES", XMLCipher.AES_128, 128));
algorithms.put("aes-192", new EncryptionAlgorithm("AES", XMLCipher.AES_192, 192));
algorithms.put("aes-256", new EncryptionAlgorithm("AES", XMLCipher.AES_256, 256));
algorithms.put("aes", new EncryptionAlgorithm("AES", XMLCipher.AES_256, 256));
-
- algorithms.put("tripledes", new EncryptionAlgorithm("TripleDes",
- XMLCipher.TRIPLEDES, 168));
+
+ algorithms.put("tripledes", new EncryptionAlgorithm("TripleDes", XMLCipher.TRIPLEDES, 168));
}
/**
@@ -102,12 +105,12 @@
*/
public static String getEncryptionURL(String certAlgo)
{
- EncryptionAlgorithm ea = algorithms.get(certAlgo);
- if(ea == null)
+ EncryptionAlgorithm ea = algorithms.get(certAlgo);
+ if (ea == null)
throw new RuntimeException("Unknown jce algorithm:" + certAlgo);
return ea.xmlSecName;
}
-
+
/**
* Given the JCE algorithm, get the XML Encryption KeySize
* @param certAlgo
@@ -115,14 +118,12 @@
*/
public static int getEncryptionKeySize(String certAlgo)
{
- EncryptionAlgorithm ea = algorithms.get(certAlgo);
- if(ea == null)
+ EncryptionAlgorithm ea = algorithms.get(certAlgo);
+ if (ea == null)
throw new RuntimeException("Unknown jce algorithm:" + certAlgo);
return ea.size;
}
-
-
/**
* <p>
* Encrypt the Key to be transported
@@ -141,27 +142,26 @@
* @return
* @throws ProcessingException
*/
- public static EncryptedKey encryptKey(Document document,
- SecretKey keyToBeEncrypted, PublicKey keyUsedToEncryptSecretKey,
- int keySize) throws ProcessingException
+ public static EncryptedKey encryptKey(Document document, SecretKey keyToBeEncrypted,
+ PublicKey keyUsedToEncryptSecretKey, int keySize) throws ProcessingException
{
XMLCipher keyCipher = null;
String pubKeyAlg = keyUsedToEncryptSecretKey.getAlgorithm();
-
+
try
{
String keyWrapAlgo = getXMLEncryptionURLForKeyUnwrap(pubKeyAlg, keySize);
keyCipher = XMLCipher.getInstance(keyWrapAlgo);
-
+
keyCipher.init(XMLCipher.WRAP_MODE, keyUsedToEncryptSecretKey);
return keyCipher.encryptKey(document, keyToBeEncrypted);
}
catch (XMLEncryptionException e)
{
- throw new ProcessingException(e);
- }
+ throw new ProcessingException(e);
+ }
}
-
+
/**
* Given an element in a Document, encrypt the element and replace
* the element in the document with the encrypted data
@@ -174,31 +174,28 @@
* @return
* @throws ProcessingException
*/
- public static void encryptElement(QName elementQName,
- Document document,
- PublicKey publicKey,
- SecretKey secretKey, int keySize, QName wrappingElementQName,
- boolean addEncryptedKeyInKeyInfo) throws ProcessingException
+ public static void encryptElement(QName elementQName, Document document, PublicKey publicKey, SecretKey secretKey,
+ int keySize, QName wrappingElementQName, boolean addEncryptedKeyInKeyInfo) throws ProcessingException
{
- if(elementQName == null)
+ if (elementQName == null)
throw new IllegalArgumentException("elementQName is null");
- if(document == null)
+ if (document == null)
throw new IllegalArgumentException("document is null");
String wrappingElementPrefix = wrappingElementQName.getPrefix();
- if(wrappingElementPrefix == null || wrappingElementPrefix == "")
+ if (wrappingElementPrefix == null || wrappingElementPrefix == "")
throw new IllegalArgumentException("Wrapping element prefix invalid");
-
+
NodeList elements = document.getElementsByTagName(elementQName.toString());
- if(elements == null || elements.getLength() > 1)
- throw new IllegalStateException("Element was either null or more than one:"+elements);
+ if (elements == null || elements.getLength() > 1)
+ throw new IllegalStateException("Element was either null or more than one:" + elements);
Element documentElement = (Element) elements.item(0);
-
- if(documentElement == null)
- throw new IllegalStateException("Element could not be found in the document:"+ elementQName.toString());
-
- XMLCipher cipher = null;
- EncryptedKey encryptedKey = encryptKey(document, secretKey, publicKey, keySize);
-
+
+ if (documentElement == null)
+ throw new IllegalStateException("Element could not be found in the document:" + elementQName.toString());
+
+ XMLCipher cipher = null;
+ EncryptedKey encryptedKey = encryptKey(document, secretKey, publicKey, keySize);
+
String encryptionAlgorithm = getXMLEncryptionURL(secretKey.getAlgorithm(), keySize);
//Encrypt the Document
try
@@ -208,7 +205,7 @@
}
catch (XMLEncryptionException e1)
{
- throw new ProcessingException(e1);
+ throw new ProcessingException(e1);
}
Document encryptedDoc;
@@ -219,59 +216,143 @@
catch (Exception e)
{
throw new ProcessingException(e);
- }
-
+ }
+
// The EncryptedKey element is added
- Element encryptedKeyElement = cipher.martial(document, encryptedKey);
+ Element encryptedKeyElement = cipher.martial(document, encryptedKey);
- String wrappingElementName = wrappingElementPrefix + ":" + wrappingElementQName.getLocalPart();
-
+ String wrappingElementName = wrappingElementPrefix + ":" + wrappingElementQName.getLocalPart();
+
//Create the wrapping element and set its attribute NS
Element wrappingElement = encryptedDoc.createElementNS(wrappingElementQName.getNamespaceURI(),
wrappingElementName);
-
- if(wrappingElementPrefix == null || wrappingElementPrefix == "")
+
+ if (wrappingElementPrefix == null || wrappingElementPrefix == "")
{
wrappingElementName = wrappingElementQName.getLocalPart();
}
- wrappingElement.setAttributeNS(XMLNS,
- "xmlns:" + wrappingElementPrefix, wrappingElementQName.getNamespaceURI());
-
+ wrappingElement.setAttributeNS(XMLNS, "xmlns:" + wrappingElementPrefix, wrappingElementQName.getNamespaceURI());
+
//Get Hold of the Cipher Data
NodeList cipherElements = encryptedDoc.getElementsByTagNameNS(XMLENC_NS, "EncryptedData");
- if(cipherElements == null || cipherElements.getLength() == 0)
+ if (cipherElements == null || cipherElements.getLength() == 0)
throw new IllegalStateException("xenc:EncryptedData Element Missing");
Element encryptedDataElement = (Element) cipherElements.item(0);
-
+
Node parentOfEncNode = encryptedDataElement.getParentNode();
- parentOfEncNode.replaceChild(wrappingElement, encryptedDataElement);
-
+ parentOfEncNode.replaceChild(wrappingElement, encryptedDataElement);
+
wrappingElement.appendChild(encryptedDataElement);
-
- if (addEncryptedKeyInKeyInfo)
+
+ if (addEncryptedKeyInKeyInfo)
{
// Outer ds:KeyInfo Element to hold the EncryptionKey
Element sigElement = encryptedDoc.createElementNS(XMLSIG_NS, DS_KEY_INFO);
- sigElement.setAttributeNS(XMLNS, "xmlns:ds", XMLSIG_NS);
+ sigElement.setAttributeNS(XMLNS, "xmlns:ds", XMLSIG_NS);
sigElement.appendChild(encryptedKeyElement);
-
+
//Insert the Encrypted key before the CipherData element
NodeList nodeList = encryptedDoc.getElementsByTagNameNS(XMLENC_NS, CIPHER_DATA_LOCALNAME);
- if (nodeList == null || nodeList.getLength() == 0)
- throw new IllegalStateException("xenc:CipherData Element Missing");
+ if (nodeList == null || nodeList.getLength() == 0)
+ throw new IllegalStateException("xenc:CipherData Element Missing");
Element cipherDataElement = (Element) nodeList.item(0);
Node cipherParent = cipherDataElement.getParentNode();
cipherParent.insertBefore(sigElement, cipherDataElement);
- }
- else
+ }
+ else
{
//Add the encrypted key as a child of the wrapping element
wrappingElement.appendChild(encryptedKeyElement);
}
}
-
-
+
/**
+ * <p>
+ * Encrypts an element in a XML document using the specified public key, secret key, and key size. This method
+ * doesn't wrap the encrypted element in a new element. Instead, it replaces the element with its encrypted version.
+ * </p>
+ * <p>
+ * For example, calling this method to encrypt the <tt><b>inner</b></tt> element in the following XML document
+ * <pre>
+ * <root>
+ * <outer>
+ * <inner>
+ * ...
+ * </inner>
+ * </outer>
+ * </root>
+ * </pre>
+ *
+ * would result in a document similar to
+ * <pre>
+ * <root>
+ * <outer>
+ * <xenc:EncryptedData xmlns:xenc="...">
+ * ...
+ * </xenc:EncryptedData>
+ * </outer>
+ * </root>
+ * </pre>
+ * </p>
+ *
+ * @param document the {@code Document} that contains the element to be encrypted.
+ * @param element the {@code Element} to be encrypted.
+ * @param publicKey the {@code PublicKey} that must be used to encrypt the secret key.
+ * @param secretKey the {@code SecretKey} used to encrypt the specified element.
+ * @param keySize the size (in bits) of the secret key.
+ * @throws ProcessingException if an error occurs while encrypting the element with the specified params.
+ */
+ public static void encryptElement(Document document, Element element, PublicKey publicKey, SecretKey secretKey,
+ int keySize) throws ProcessingException
+ {
+ if (element == null)
+ throw new IllegalArgumentException("element is null");
+ if (document == null)
+ throw new IllegalArgumentException("document is null");
+
+ XMLCipher cipher = null;
+ EncryptedKey encryptedKey = encryptKey(document, secretKey, publicKey, keySize);
+ String encryptionAlgorithm = getXMLEncryptionURL(secretKey.getAlgorithm(), keySize);
+
+ //Encrypt the Document
+ try
+ {
+ cipher = XMLCipher.getInstance(encryptionAlgorithm);
+ cipher.init(XMLCipher.ENCRYPT_MODE, secretKey);
+ }
+ catch (XMLEncryptionException e1)
+ {
+ throw new ProcessingException(e1);
+ }
+
+ Document encryptedDoc;
+ try
+ {
+ encryptedDoc = cipher.doFinal(document, element);
+ }
+ catch (Exception e)
+ {
+ throw new ProcessingException(e);
+ }
+
+ // The EncryptedKey element is added
+ Element encryptedKeyElement = cipher.martial(document, encryptedKey);
+
+ // Outer ds:KeyInfo Element to hold the EncryptionKey
+ Element sigElement = encryptedDoc.createElementNS(XMLSIG_NS, DS_KEY_INFO);
+ sigElement.setAttributeNS(XMLNS, "xmlns:ds", XMLSIG_NS);
+ sigElement.appendChild(encryptedKeyElement);
+
+ //Insert the Encrypted key before the CipherData element
+ NodeList nodeList = encryptedDoc.getElementsByTagNameNS(XMLENC_NS, CIPHER_DATA_LOCALNAME);
+ if (nodeList == null || nodeList.getLength() == 0)
+ throw new IllegalStateException("xenc:CipherData Element Missing");
+ Element cipherDataElement = (Element) nodeList.item(0);
+ Node cipherParent = cipherDataElement.getParentNode();
+ cipherParent.insertBefore(sigElement, cipherDataElement);
+ }
+
+ /**
* Encrypt the root document element inside a Document.
* <b>NOTE:</> The document root element will be replaced
* by the wrapping element.
@@ -288,18 +369,17 @@
* @throws ProcessingException
* @throws ConfigurationException
*/
- public static Element encryptElementInDocument(Document document,
- PublicKey publicKey,
- SecretKey secretKey, int keySize, QName wrappingElementQName,
- boolean addEncryptedKeyInKeyInfo) throws ProcessingException, ConfigurationException
+ public static Element encryptElementInDocument(Document document, PublicKey publicKey, SecretKey secretKey,
+ int keySize, QName wrappingElementQName, boolean addEncryptedKeyInKeyInfo) throws ProcessingException,
+ ConfigurationException
{
String wrappingElementPrefix = wrappingElementQName.getPrefix();
- if(wrappingElementPrefix == null || wrappingElementPrefix == "")
+ if (wrappingElementPrefix == null || wrappingElementPrefix == "")
throw new IllegalArgumentException("Wrapping element prefix invalid");
-
- XMLCipher cipher = null;
- EncryptedKey encryptedKey = encryptKey(document, secretKey, publicKey, keySize);
-
+
+ XMLCipher cipher = null;
+ EncryptedKey encryptedKey = encryptKey(document, secretKey, publicKey, keySize);
+
String encryptionAlgorithm = getXMLEncryptionURL(secretKey.getAlgorithm(), keySize);
//Encrypt the Document
try
@@ -320,46 +400,45 @@
catch (Exception e)
{
throw new ProcessingException(e);
- }
-
+ }
+
// The EncryptedKey element is added
- Element encryptedKeyElement = cipher.martial(document, encryptedKey);
+ Element encryptedKeyElement = cipher.martial(document, encryptedKey);
- String wrappingElementName = wrappingElementPrefix + ":" + wrappingElementQName.getLocalPart();
-
+ String wrappingElementName = wrappingElementPrefix + ":" + wrappingElementQName.getLocalPart();
+
//Create the wrapping element and set its attribute NS
Element wrappingElement = encryptedDoc.createElementNS(wrappingElementQName.getNamespaceURI(),
wrappingElementName);
-
- if(wrappingElementPrefix == null || wrappingElementPrefix == "")
+
+ if (wrappingElementPrefix == null || wrappingElementPrefix == "")
{
wrappingElementName = wrappingElementQName.getLocalPart();
}
- wrappingElement.setAttributeNS(XMLNS,
- "xmlns:" + wrappingElementPrefix, wrappingElementQName.getNamespaceURI());
-
- Element encryptedDocRootElement = encryptedDoc.getDocumentElement();
+ wrappingElement.setAttributeNS(XMLNS, "xmlns:" + wrappingElementPrefix, wrappingElementQName.getNamespaceURI());
+
+ Element encryptedDocRootElement = encryptedDoc.getDocumentElement();
//Bring in the encrypted wrapping element to wrap the root node
encryptedDoc.replaceChild(wrappingElement, encryptedDocRootElement);
-
+
wrappingElement.appendChild(encryptedDocRootElement);
-
- if (addEncryptedKeyInKeyInfo)
+
+ if (addEncryptedKeyInKeyInfo)
{
// Outer ds:KeyInfo Element to hold the EncryptionKey
Element sigElement = encryptedDoc.createElementNS(XMLSIG_NS, DS_KEY_INFO);
- sigElement.setAttributeNS(XMLNS, "xmlns:ds", XMLSIG_NS);
+ sigElement.setAttributeNS(XMLNS, "xmlns:ds", XMLSIG_NS);
sigElement.appendChild(encryptedKeyElement);
-
+
//Insert the Encrypted key before the CipherData element
NodeList nodeList = encryptedDocRootElement.getElementsByTagNameNS(XMLENC_NS, CIPHER_DATA_LOCALNAME);
- if (nodeList == null || nodeList.getLength() == 0)
- throw new IllegalStateException("xenc:CipherData Element Missing");
+ if (nodeList == null || nodeList.getLength() == 0)
+ throw new IllegalStateException("xenc:CipherData Element Missing");
- Element cipherDataElement = (Element) nodeList.item(0);
+ Element cipherDataElement = (Element) nodeList.item(0);
encryptedDocRootElement.insertBefore(sigElement, cipherDataElement);
- }
- else
+ }
+ else
{
//Add the encrypted key as a child of the wrapping element
wrappingElement.appendChild(encryptedKeyElement);
@@ -367,7 +446,7 @@
return encryptedDoc.getDocumentElement();
}
-
+
/**
* Decrypt an encrypted element inside a document
* @param documentWithEncryptedElement
@@ -376,78 +455,78 @@
* @throws XMLEncryptionException
* @throws ProcessingException
*/
- public static Element decryptElementInDocument(Document documentWithEncryptedElement,
- PrivateKey privateKey) throws ProcessingException
+ public static Element decryptElementInDocument(Document documentWithEncryptedElement, PrivateKey privateKey)
+ throws ProcessingException
{
- if(documentWithEncryptedElement == null)
+ if (documentWithEncryptedElement == null)
throw new IllegalArgumentException("Input document is null");
-
+
//Look for encrypted data element
Element documentRoot = documentWithEncryptedElement.getDocumentElement();
Element encDataElement = getNextElementNode(documentRoot.getFirstChild());
- if(encDataElement == null)
- throw new IllegalStateException("No element representing the encrypted data found");
-
+ if (encDataElement == null)
+ throw new IllegalStateException("No element representing the encrypted data found");
+
//Look at siblings for the key
Element encKeyElement = getNextElementNode(encDataElement.getNextSibling());
- if(encKeyElement == null)
- {
+ if (encKeyElement == null)
+ {
//Search the enc data element for enc key
- NodeList nodeList = encDataElement.getElementsByTagNameNS( XMLENC_NS, ENCRYPTED_KEY_LOCALNAME);
-
- if(nodeList == null || nodeList.getLength() == 0)
+ NodeList nodeList = encDataElement.getElementsByTagNameNS(XMLENC_NS, ENCRYPTED_KEY_LOCALNAME);
+
+ if (nodeList == null || nodeList.getLength() == 0)
throw new IllegalStateException("Encrypted Key not found in the enc data");
-
- encKeyElement = (Element) nodeList.item(0);
+
+ encKeyElement = (Element) nodeList.item(0);
}
-
+
XMLCipher cipher;
EncryptedData encryptedData;
EncryptedKey encryptedKey;
try
{
- cipher = XMLCipher.getInstance();
- cipher.init(XMLCipher.DECRYPT_MODE, null);
- encryptedData = cipher.loadEncryptedData(documentWithEncryptedElement, encDataElement);
+ cipher = XMLCipher.getInstance();
+ cipher.init(XMLCipher.DECRYPT_MODE, null);
+ encryptedData = cipher.loadEncryptedData(documentWithEncryptedElement, encDataElement);
encryptedKey = cipher.loadEncryptedKey(documentWithEncryptedElement, encKeyElement);
}
catch (XMLEncryptionException e1)
{
throw new ProcessingException(e1);
}
-
+
Document decryptedDoc = null;
-
- if (encryptedData != null && encryptedKey != null)
+
+ if (encryptedData != null && encryptedKey != null)
{
try
{
String encAlgoURL = encryptedData.getEncryptionMethod().getAlgorithm();
- XMLCipher keyCipher = XMLCipher.getInstance();
- keyCipher.init(XMLCipher.UNWRAP_MODE, privateKey);
- Key encryptionKey = keyCipher.decryptKey( encryptedKey, encAlgoURL );
- cipher = XMLCipher.getInstance();
- cipher.init(XMLCipher.DECRYPT_MODE, encryptionKey);
+ XMLCipher keyCipher = XMLCipher.getInstance();
+ keyCipher.init(XMLCipher.UNWRAP_MODE, privateKey);
+ Key encryptionKey = keyCipher.decryptKey(encryptedKey, encAlgoURL);
+ cipher = XMLCipher.getInstance();
+ cipher.init(XMLCipher.DECRYPT_MODE, encryptionKey);
decryptedDoc = cipher.doFinal(documentWithEncryptedElement, encDataElement);
}
catch (Exception e)
{
throw new ProcessingException(e);
- }
+ }
}
-
+
Element decryptedRoot = decryptedDoc.getDocumentElement();
Element dataElement = getNextElementNode(decryptedRoot.getFirstChild());
- if (dataElement == null)
+ if (dataElement == null)
throw new IllegalStateException("Data Element after encryption is null");
decryptedRoot.removeChild(dataElement);
decryptedDoc.replaceChild(dataElement, decryptedRoot);
-
- return decryptedDoc.getDocumentElement();
+
+ return decryptedDoc.getDocumentElement();
}
-
+
/**
* From the secret key, get the W3C XML Encryption URL
* @param publicKeyAlgo
@@ -456,23 +535,25 @@
*/
private static String getXMLEncryptionURLForKeyUnwrap(String publicKeyAlgo, int keySize)
{
- if("AES".equals(publicKeyAlgo))
+ if ("AES".equals(publicKeyAlgo))
{
- switch(keySize)
+ switch (keySize)
{
- case 192: return XMLCipher.AES_192_KeyWrap;
- case 256: return XMLCipher.AES_256_KeyWrap;
- default:
- return XMLCipher.AES_128_KeyWrap;
+ case 192 :
+ return XMLCipher.AES_192_KeyWrap;
+ case 256 :
+ return XMLCipher.AES_256_KeyWrap;
+ default :
+ return XMLCipher.AES_128_KeyWrap;
}
}
- if(publicKeyAlgo.contains("RSA"))
+ if (publicKeyAlgo.contains("RSA"))
return XMLCipher.RSA_v1dot5;
- if(publicKeyAlgo.contains("DES"))
- return XMLCipher.TRIPLEDES_KeyWrap;
+ if (publicKeyAlgo.contains("DES"))
+ return XMLCipher.TRIPLEDES_KeyWrap;
throw new IllegalArgumentException("unsupported publicKey Algo:" + publicKeyAlgo);
}
-
+
/**
* From the secret key, get the W3C XML Encryption URL
* @param secretKey
@@ -480,35 +561,37 @@
* @return
*/
private static String getXMLEncryptionURL(String algo, int keySize)
- {
- if("AES".equals(algo))
+ {
+ if ("AES".equals(algo))
{
- switch(keySize)
+ switch (keySize)
{
- case 192: return XMLCipher.AES_192;
- case 256: return XMLCipher.AES_256;
- default:
- return XMLCipher.AES_128;
+ case 192 :
+ return XMLCipher.AES_192;
+ case 256 :
+ return XMLCipher.AES_256;
+ default :
+ return XMLCipher.AES_128;
}
}
- if(algo.contains("RSA"))
+ if (algo.contains("RSA"))
return XMLCipher.RSA_v1dot5;
- if(algo.contains("DES"))
- return XMLCipher.TRIPLEDES_KeyWrap;
+ if (algo.contains("DES"))
+ return XMLCipher.TRIPLEDES_KeyWrap;
throw new IllegalArgumentException("Secret Key with unsupported algo:" + algo);
}
-
+
/**
* Returns the next Element node.
*/
- private static Element getNextElementNode(Node node)
+ private static Element getNextElementNode(Node node)
{
- while(node != null)
+ while (node != null)
{
- if(Node.ELEMENT_NODE == node.getNodeType())
+ if (Node.ELEMENT_NODE == node.getNodeType())
return (Element) node;
node = node.getNextSibling();
}
- return null;
- }
+ return null;
+ }
}
\ No newline at end of file
Modified: identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/wstrust/StandardRequestHandler.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/wstrust/StandardRequestHandler.java 2009-11-09 20:36:15 UTC (rev 923)
+++ identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/wstrust/StandardRequestHandler.java 2009-11-11 13:18:39 UTC (rev 924)
@@ -27,12 +27,17 @@
import java.security.PublicKey;
import java.security.cert.Certificate;
+import javax.crypto.SecretKey;
+import javax.crypto.spec.SecretKeySpec;
import javax.xml.bind.JAXBElement;
import javax.xml.crypto.dsig.DigestMethod;
import javax.xml.crypto.dsig.SignatureMethod;
+import javax.xml.namespace.QName;
import org.apache.log4j.Logger;
+import org.jboss.identity.federation.core.exceptions.ProcessingException;
import org.jboss.identity.federation.core.saml.v2.util.DocumentUtil;
+import org.jboss.identity.federation.core.util.XMLEncryptionUtil;
import org.jboss.identity.federation.core.util.XMLSignatureUtil;
import org.jboss.identity.federation.core.wstrust.wrappers.RequestSecurityToken;
import org.jboss.identity.federation.core.wstrust.wrappers.RequestSecurityTokenResponse;
@@ -65,7 +70,7 @@
private boolean trace = log.isTraceEnabled();
- private static long KEY_SIZE = 256;
+ private static long KEY_SIZE = 128;
private STSConfiguration configuration;
@@ -463,7 +468,7 @@
{
rstrDocument = DocumentUtil.normalizeNamespaces(rstrDocument);
- //Sign and encrypt
+ //Sign the security token
if (this.configuration.signIssuedToken() && this.configuration.getSTSKeyPair() != null)
{
KeyPair keyPair = this.configuration.getSTSKeyPair();
@@ -475,9 +480,8 @@
.getElementsByTagNameNS(WSTrustConstants.BASE_NAMESPACE, "RequestedSecurityToken").item(0);
Element tokenElement = (Element) rst.getFirstChild();
if (trace)
- {
log.trace("NamespaceURI of element to be signed:" + tokenElement.getNamespaceURI());
- }
+
rstrDocument = XMLSignatureUtil.sign(rstrDocument, tokenElement, keyPair, DigestMethod.SHA1,
signatureMethod, "#" + tokenElement.getAttribute("ID"));
if (trace)
@@ -501,6 +505,46 @@
throw new WSTrustException("Failed to sign security token", e);
}
}
+
+ // encrypt the security token if needed.
+ if (this.configuration.encryptIssuedToken())
+ {
+ // get the public key that will be used to encrypt the token.
+ PublicKey providerPublicKey = null;
+ if (request.getAppliesTo() != null)
+ {
+ String serviceName = WSTrustUtil.parseAppliesTo(request.getAppliesTo());
+ if (trace)
+ log.trace("Locating public key for service provider " + serviceName);
+ if (serviceName != null)
+ providerPublicKey = this.configuration.getServiceProviderPublicKey(serviceName);
+ }
+ if (providerPublicKey == null)
+ {
+ log.warn("Security token should be encrypted but no encrypting key could be found");
+ }
+ else
+ {
+ // generate the secret key.
+ long keySize = request.getKeySize();
+ byte[] secret = WSTrustUtil.createRandomSecret((int) keySize / 8);
+ SecretKey secretKey = new SecretKeySpec(secret, "AES");
+
+ // encrypt the security token.
+ Node rst = rstrDocument
+ .getElementsByTagNameNS(WSTrustConstants.BASE_NAMESPACE, "RequestedSecurityToken").item(0);
+ Element tokenElement = (Element) rst.getFirstChild();
+ try
+ {
+ XMLEncryptionUtil.encryptElement(rstrDocument, tokenElement, providerPublicKey, secretKey,
+ (int) keySize);
+ }
+ catch (ProcessingException e)
+ {
+ throw new WSTrustException("Unable to encrypt security token", e);
+ }
+ }
+ }
}
return rstrDocument;
Modified: identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/wstrust/WSTrustUtil.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/wstrust/WSTrustUtil.java 2009-11-09 20:36:15 UTC (rev 923)
+++ identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/wstrust/WSTrustUtil.java 2009-11-11 13:18:39 UTC (rev 924)
@@ -302,7 +302,7 @@
Document document = DocumentUtil.createDocument();
// TODO: XMLEncryptionUtil should allow for the specification of the key wrap algorithm.
EncryptedKey key = XMLEncryptionUtil.encryptKey(document, new SecretKeySpec(secret, "AES"), encryptionKey,
- secret.length);
+ secret.length * 8);
Element encryptedKeyElement = XMLCipher.getInstance().martial(key);
keyInfo = new KeyInfoType();
keyInfo.getContent().add(encryptedKeyElement);
Modified: identity-federation/trunk/jboss-identity-fed-core/src/test/java/org/jboss/test/identity/federation/core/wstrust/JBossSTSUnitTestCase.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-core/src/test/java/org/jboss/test/identity/federation/core/wstrust/JBossSTSUnitTestCase.java 2009-11-09 20:36:15 UTC (rev 923)
+++ identity-federation/trunk/jboss-identity-fed-core/src/test/java/org/jboss/test/identity/federation/core/wstrust/JBossSTSUnitTestCase.java 2009-11-11 13:18:39 UTC (rev 924)
@@ -153,7 +153,7 @@
// check the values that have been configured.
assertEquals("Unexpected service name", "Test STS", config.getSTSName());
assertEquals("Unexpected token timeout value", 7200 * 1000, config.getIssuedTokenTimeout());
- assertTrue("Encrypt token should be true", config.encryptIssuedToken());
+ assertFalse("Encrypt token should be true", config.encryptIssuedToken());
WSTrustRequestHandler handler = config.getRequestHandler();
assertNotNull("Unexpected null request handler found", handler);
assertTrue("Unexpected request handler type", handler instanceof StandardRequestHandler);
@@ -409,8 +409,8 @@
assertEquals("Unexpected proof token content", BinarySecretType.class, proofElement.getDeclaredType());
BinarySecretType serverBinarySecret = (BinarySecretType) proofElement.getValue();
assertNotNull("Unexpected null secret", serverBinarySecret.getValue());
- // default key size is 256 bits (32 bytes).
- assertEquals("Unexpected secret size", 32, serverBinarySecret.getValue().length);
+ // default key size is 128 bits (16 bytes).
+ assertEquals("Unexpected secret size", 16, serverBinarySecret.getValue().length);
}
/**
@@ -442,7 +442,7 @@
"http://services.testcorp.org/provider2");
request.setKeyType(URI.create(WSTrustConstants.KEY_TYPE_SYMMETRIC));
request.setEntropy(clientEntropy);
- request.setKeySize(128);
+ request.setKeySize(64);
// invoke the token service.
Source requestMessage = WSTrustJAXBFactory.getInstance().marshallRequestSecurityToken(request);
@@ -473,7 +473,7 @@
BinarySecretType serverBinarySecret = (BinarySecretType) serverEntropyContent.getValue();
assertEquals("Unexpected binary secret type", WSTrustConstants.BS_TYPE_NONCE, serverBinarySecret.getType());
assertNotNull("Unexpected null secret value", serverBinarySecret.getValue());
- assertEquals("Unexpected secret size", 16, serverBinarySecret.getValue().length);
+ assertEquals("Unexpected secret size", 8, serverBinarySecret.getValue().length);
}
/**
Modified: identity-federation/trunk/jboss-identity-fed-core/src/test/resources/jboss-sts.xml
===================================================================
--- identity-federation/trunk/jboss-identity-fed-core/src/test/resources/jboss-sts.xml 2009-11-09 20:36:15 UTC (rev 923)
+++ identity-federation/trunk/jboss-identity-fed-core/src/test/resources/jboss-sts.xml 2009-11-11 13:18:39 UTC (rev 924)
@@ -1,5 +1,5 @@
<JBossSTS xmlns="urn:jboss:identity-federation:config:1.0"
- STSName="Test STS" TokenTimeout="7200" EncryptToken="true">
+ STSName="Test STS" TokenTimeout="7200" EncryptToken="false">
<KeyProvider ClassName="org.jboss.identity.federation.core.impl.KeyStoreKeyManager">
<Auth Key="KeyStoreURL" Value="keystore/sts_keystore.jks"/>
<Auth Key="KeyStorePass" Value="testpass"/>
16 years, 6 months
JBoss Identity SVN: r923 - in idm/trunk/idm-hibernate: src/main/resources/mappings and 1 other directory.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2009-11-09 15:36:15 -0500 (Mon, 09 Nov 2009)
New Revision: 923
Modified:
idm/trunk/idm-hibernate/pom.xml
idm/trunk/idm-hibernate/src/main/resources/mappings/HibernateIdentityObjectAttribute.hbm.xml
idm/trunk/idm-hibernate/src/main/resources/mappings/HibernateIdentityObjectCredential.hbm.xml
Log:
toto
Modified: idm/trunk/idm-hibernate/pom.xml
===================================================================
--- idm/trunk/idm-hibernate/pom.xml 2009-11-09 19:21:21 UTC (rev 922)
+++ idm/trunk/idm-hibernate/pom.xml 2009-11-09 20:36:15 UTC (rev 923)
@@ -40,6 +40,16 @@
<artifactId>hibernate-core</artifactId>
<version>3.3.2.GA</version>
</dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-core</artifactId>
+ <version>3.3.2.GA</version>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-annotations</artifactId>
+ <version>3.4.0.GA</version>
+ </dependency>
<!--Javassist as Hibernate's bytecode provider-->
<dependency>
<groupId>javassist</groupId>
Modified: idm/trunk/idm-hibernate/src/main/resources/mappings/HibernateIdentityObjectAttribute.hbm.xml
===================================================================
--- idm/trunk/idm-hibernate/src/main/resources/mappings/HibernateIdentityObjectAttribute.hbm.xml 2009-11-09 19:21:21 UTC (rev 922)
+++ idm/trunk/idm-hibernate/src/main/resources/mappings/HibernateIdentityObjectAttribute.hbm.xml 2009-11-09 20:36:15 UTC (rev 923)
@@ -42,7 +42,7 @@
column="ATTR_VALUE"/>
</set>
<property name="binaryValue"
- type="clob"
+ type="org.hibernate.type.PrimitiveByteArrayBlobType"
access="field"
lazy="false"
not-null="true">
Modified: idm/trunk/idm-hibernate/src/main/resources/mappings/HibernateIdentityObjectCredential.hbm.xml
===================================================================
--- idm/trunk/idm-hibernate/src/main/resources/mappings/HibernateIdentityObjectCredential.hbm.xml 2009-11-09 19:21:21 UTC (rev 922)
+++ idm/trunk/idm-hibernate/src/main/resources/mappings/HibernateIdentityObjectCredential.hbm.xml 2009-11-09 20:36:15 UTC (rev 923)
@@ -13,7 +13,7 @@
<generator class="native"/>
</id>
<property name="binaryValue"
- type="clob"
+ type="org.hibernate.type.PrimitiveByteArrayBlobType"
access="field"
lazy="false"
not-null="true">
16 years, 6 months