You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by David Sean Taylor <d....@onehippo.com> on 2010/03/21 02:14:47 UTC

notes on JS2-964

Here are my notes on reviewing JS2-964, a contribution from Joachim
Muller just reviewed and committed.
I have run the new unit test on

* MySQL 5.5 and 5.1
* Derby (having troubles with the build in general there... still working on it)
If anyone is using other databases during tests, like Postgresql, the
test will automatically run, Im sure you will let me know if something
blows up :)

--- REVIEW NOTES ---

-------
API
------
UserManager: new API:

 /**
     * <p>
     * Retrieves a detached and modifiable {@link User} list matching
the corresponding
     * query context. It returns a {@link UserResultList}, containing
     * the actual result list an the total number of results from the query.
     *
     * </p>
     *
     * @param queryContext The (@see JetspeedPrincipalQueryContext)
for this query.
     * @return
     * @throws SecurityException
     */
    UserResultList getUsersExtended(JetspeedPrincipalQueryContext
queryContext) throws SecurityException;

New class in Jetspeed API, a principal query context, to put and get
casted types for query parameters:

public class JetspeedPrincipalQueryContext extends HashMap<String, Object> {


Jetspeed Principal Manager, new API:


    /**
     * Retrieve all principals that match the queryContext.
     * It returns a {@link JetspeedPrincipalResultList}, containing
     * the actual result list an the total number of results from the query.
     *
     * The returned principals are detached.
     *
     * @param queryContext The (@see JetspeedPrincipalQueryContext)
for this query.
     * @return
     */
    public JetspeedPrincipalResultList
getPrincipals(JetspeedPrincipalQueryContext queryContext);

New class, JetspeedPrincipalResultList:

 A container for principals that have been retrieved from storage with ranged
queries. Additional to the principals itself it also contains the total size
of the query result.

New class, UserResultList extending JetspeedPrincipalResultList:

 Wrapper for a {@link JetspeedPrincipalResultList}. Takes care of
casting to a {@link User}

public class UserResultList extends JetspeedPrincipalResultList {

----

New Assembly:

security-spi.xml, new JetspeedPrincipalLookManagerFactory bean
definition, with two impls, default and SQL:

  <bean id="org.apache.jetspeed.security.spi.impl.JetspeedPrincipalLookupManagerFactory"
class="org.apache.jetspeed.security.spi.impl.JetspeedPrincipalLookupManagerFactory">
    <meta key="j2:cat" value="default or security" />
    <property name="mappings">
     <map>
       <entry key="default"><ref
bean="org.apache.jetspeed.security.spi.impl.JetspeedPrincipalLookupManagerDefault"/></entry>
       <entry key="mysql"><ref
bean="org.apache.jetspeed.security.spi.impl.JetspeedPrincipalLookupManagerMySql"/></entry>
     </map>
   </property>
  </bean>

  <bean id="org.apache.jetspeed.security.spi.impl.JetspeedPrincipalLookupManagerDefault"
class="org.apache.jetspeed.security.spi.impl.JetspeedPrincipalLookupManagerDefault"
/>
  <bean id="org.apache.jetspeed.security.spi.impl.JetspeedPrincipalLookupManagerMySql"
class="org.apache.jetspeed.security.spi.impl.JetspeedPrincipalLookupManagerMySql"
/>

Additional constructor arg (ref bean) weaved into
JetspeedSecurityPersisteneManager:

   <bean id="org.apache.jetspeed.security.spi.impl.JetspeedSecurityPersistenceManager"
     class="org.apache.jetspeed.security.spi.impl.JetspeedSecurityPersistenceManager"
init-method="init">
...
    <constructor-arg index="1">
      <ref bean="org.apache.jetspeed.security.spi.impl.JetspeedPrincipalLookupManagerFactory"/>
    </constructor-arg>
   </bean>

-----------------------
Implementation
-----------------------

* UserManagerImpl.java implements getUsersExtended

* BaseJetspeedPrincipalManager.java implements
getPrincipals(JetspeedPrincipalQueryContext)

* JetspeedPrincipalLookupManagerMySql.java MySQL-specific impl of
scrollable result sets, special handling for limits on MySQL

extends JetspeedPrincipalLookupManagerAbstract

 Add limit operator if we are on MySql. This is much faster than
 paging via JDBC and also is a work around because the MySQL driver
 retrieves the complete result set. This would result in a very high
 memory consumption with large result sets.

* JetspeedPrincipalLookupManagerAbstract.java, look here for most JDBC
implementation details

 Abstract base class for the principal lookup manager. Defines possible
database specific abstract methods and provides more generic methods to all
database specific principal lookup managers.

* JetspeedPrincipalLookupManagerFactory.java

Factory for getting the database specific principal lookup manager. The
Database platform is determined by the OJB connection repository.
The factory is actually a singleton facade, since it returns always the same
instance of the {@see JetspeedPrincipalLookupManager} once it was determined.

* JetspeedSecurityPersistenceManager.java

implements new method:

JetspeedPrincipalResultList
getPrincipals(JetspeedPrincipalQueryContext queryContext,
JetspeedPrincipalType type)

* JetspeedPrincipalLookupManagerDefault.java

Default implementation of the principal lookup manager. This
implementation uses no database specifics.
Primitive methods provided: scrollToOffset, getPagingSql

* JetspeedPrincipalAccessManager.java

SPI def for new method

getPrincipals(JetspeedPrincipalQueryContext queryContext,
JetspeedPrincipalType type);

Retrieve all principals that match the queryContext.
It returns a {@link JetspeedPrincipalResultList}, containing
the actual result list an the total number of results from the query.
The returned principals are detached.
@param queryContext The (@see JetspeedPrincipalQueryContext) for this query.
@param type The principals type (@see JetspeedPrincipalType).

* JetspeedPrincipalLookupManager.java

new SPI def for Jetspeed Principal Lookup Manager

----------
Tests
----------

TestUserManagerExtLookupManager.java

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Re: notes on JS2-964

Posted by Woonsan Ko <wo...@yahoo.com>.
Hi David,

I've also run the unit tests with PostgreSQL 8.3.8 by the following commands:

$ mvn clean install
$ mvn jetspeed:mvn -Dtarget=testdb
$ export MAVEN_OPTS="-Xmx256m -XX:MaxPermSize=256m"
$ mvn jetspeed:mvn -Dtarget=test

The build was successful and also found the test result of TestUserManagerExtLookupManager has no failures/errors.

Cheers,

Woonsan



----- Original Message ----
> From: David Sean Taylor <d....@onehippo.com>
> To: Jetspeed Developers List <je...@portals.apache.org>
> Sent: Sun, March 21, 2010 2:14:47 AM
> Subject: notes on JS2-964
> 
> Here are my notes on reviewing JS2-964, a contribution from Joachim
Muller 
> just reviewed and committed.
I have run the new unit test on

* MySQL 
> 5.5 and 5.1
* Derby (having troubles with the build in general there... still 
> working on it)
If anyone is using other databases during tests, like 
> Postgresql, the
test will automatically run, Im sure you will let me know if 
> something
blows up :)

--- REVIEW NOTES 
> ---

-------
API
------
UserManager: new API:


> /**
     * <p>
     * Retrieves a detached and 
> modifiable {@link User} list matching
the corresponding
     * 
> query context. It returns a {@link UserResultList}, containing
    
> * the actual result list an the total number of results from the 
> query.
     *
     * </p>
    
> *
     * @param queryContext The (@see 
> JetspeedPrincipalQueryContext)
for this query.
     * 
> @return
     * @throws SecurityException
    
> */
    UserResultList 
> getUsersExtended(JetspeedPrincipalQueryContext
queryContext) throws 
> SecurityException;

New class in Jetspeed API, a principal query context, 
> to put and get
casted types for query parameters:

public class 
> JetspeedPrincipalQueryContext extends HashMap<String, Object> 
> {


Jetspeed Principal Manager, new API:


    
> /**
     * Retrieve all principals that match the 
> queryContext.
     * It returns a {@link 
> JetspeedPrincipalResultList}, containing
     * the actual result 
> list an the total number of results from the query.
    
> *
     * The returned principals are detached.
    
> *
     * @param queryContext The (@see 
> JetspeedPrincipalQueryContext)
for this query.
     * 
> @return
     */
    public 
> JetspeedPrincipalResultList
getPrincipals(JetspeedPrincipalQueryContext 
> queryContext);

New class, JetspeedPrincipalResultList:

A 
> container for principals that have been retrieved from storage with 
> ranged
queries. Additional to the principals itself it also contains the 
> total size
of the query result.

New class, UserResultList extending 
> JetspeedPrincipalResultList:

Wrapper for a {@link 
> JetspeedPrincipalResultList}. Takes care of
casting to a {@link 
> User}

public class UserResultList extends JetspeedPrincipalResultList 
> {

----

New Assembly:

security-spi.xml, new 
> JetspeedPrincipalLookManagerFactory bean
definition, with two impls, default 
> and SQL:

  <bean 
> id="org.apache.jetspeed.security.spi.impl.JetspeedPrincipalLookupManagerFactory"
class="org.apache.jetspeed.security.spi.impl.JetspeedPrincipalLookupManagerFactory">
  
>   <meta key="j2:cat" value="default or security" />
    
> <property name="mappings">
     <map>
    
>    <entry 
> key="default"><ref
bean="org.apache.jetspeed.security.spi.impl.JetspeedPrincipalLookupManagerDefault"/></entry>
  
>      <entry 
> key="mysql"><ref
bean="org.apache.jetspeed.security.spi.impl.JetspeedPrincipalLookupManagerMySql"/></entry>
  
>    </map>
   </property>
  
> </bean>

  <bean 
> id="org.apache.jetspeed.security.spi.impl.JetspeedPrincipalLookupManagerDefault"
class="org.apache.jetspeed.security.spi.impl.JetspeedPrincipalLookupManagerDefault"
/>
  
> <bean 
> id="org.apache.jetspeed.security.spi.impl.JetspeedPrincipalLookupManagerMySql"
class="org.apache.jetspeed.security.spi.impl.JetspeedPrincipalLookupManagerMySql"
/>

Additional 
> constructor arg (ref bean) weaved 
> into
JetspeedSecurityPersisteneManager:

   <bean 
> id="org.apache.jetspeed.security.spi.impl.JetspeedSecurityPersistenceManager"
  
>   
> class="org.apache.jetspeed.security.spi.impl.JetspeedSecurityPersistenceManager"
init-method="init">
...
  
>   <constructor-arg index="1">
      <ref 
> bean="org.apache.jetspeed.security.spi.impl.JetspeedPrincipalLookupManagerFactory"/>
  
>   </constructor-arg>
  
> </bean>

-----------------------
Implementation
-----------------------

* 
> UserManagerImpl.java implements getUsersExtended

* 
> BaseJetspeedPrincipalManager.java 
> implements
getPrincipals(JetspeedPrincipalQueryContext)

* 
> JetspeedPrincipalLookupManagerMySql.java MySQL-specific impl of
scrollable 
> result sets, special handling for limits on MySQL

extends 
> JetspeedPrincipalLookupManagerAbstract

Add limit operator if we are on 
> MySql. This is much faster than
paging via JDBC and also is a work around 
> because the MySQL driver
retrieves the complete result set. This would 
> result in a very high
memory consumption with large result sets.

* 
> JetspeedPrincipalLookupManagerAbstract.java, look here for most 
> JDBC
implementation details

Abstract base class for the principal 
> lookup manager. Defines possible
database specific abstract methods and 
> provides more generic methods to all
database specific principal lookup 
> managers.

* JetspeedPrincipalLookupManagerFactory.java

Factory for 
> getting the database specific principal lookup manager. The
Database platform 
> is determined by the OJB connection repository.
The factory is actually a 
> singleton facade, since it returns always the same
instance of the {@see 
> JetspeedPrincipalLookupManager} once it was determined.

* 
> JetspeedSecurityPersistenceManager.java

implements new 
> method:

JetspeedPrincipalResultList
getPrincipals(JetspeedPrincipalQueryContext 
> queryContext,
JetspeedPrincipalType type)

* 
> JetspeedPrincipalLookupManagerDefault.java

Default implementation of the 
> principal lookup manager. This
implementation uses no database 
> specifics.
Primitive methods provided: scrollToOffset, getPagingSql

* 
> JetspeedPrincipalAccessManager.java

SPI def for new 
> method

getPrincipals(JetspeedPrincipalQueryContext 
> queryContext,
JetspeedPrincipalType type);

Retrieve all principals 
> that match the queryContext.
It returns a {@link 
> JetspeedPrincipalResultList}, containing
the actual result list an the total 
> number of results from the query.
The returned principals are 
> detached.
@param queryContext The (@see JetspeedPrincipalQueryContext) for 
> this query.
@param type The principals type (@see 
> JetspeedPrincipalType).

* JetspeedPrincipalLookupManager.java

new 
> SPI def for Jetspeed Principal Lookup 
> Manager

----------
Tests
----------

TestUserManagerExtLookupManager.java

---------------------------------------------------------------------
To 
> unsubscribe, e-mail: 
> ymailto="mailto:jetspeed-dev-unsubscribe@portals.apache.org" 
> href="mailto:jetspeed-dev-unsubscribe@portals.apache.org">jetspeed-dev-unsubscribe@portals.apache.org
For 
> additional commands, e-mail: 
> ymailto="mailto:jetspeed-dev-help@portals.apache.org" 
> href="mailto:jetspeed-dev-help@portals.apache.org">jetspeed-dev-help@portals.apache.org


      

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org