com.atlassian.user.util.migration
Class OSUEntityMigrator

java.lang.Object
  extended bycom.atlassian.user.util.migration.OSUEntityMigrator
All Implemented Interfaces:
EntityMigrator

public class OSUEntityMigrator
extends java.lang.Object
implements EntityMigrator

Makes a raw JDBC connection to os_user tables and copies across information into the supplied UserManager, GroupManager, and PropertySetFactory


Constructor Summary
OSUEntityMigrator(RepositoryAccessor osuserRepositoryAccessor, RepositoryAccessor repositoryAccessor, net.sf.hibernate.SessionFactory sessionFactory)
           
 
Method Summary
 void migrate(MigratorConfiguration config, MigrationProgressListener progressListener)
          The method is organised in a 'strange' way for performance reasons.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OSUEntityMigrator

public OSUEntityMigrator(RepositoryAccessor osuserRepositoryAccessor,
                         RepositoryAccessor repositoryAccessor,
                         net.sf.hibernate.SessionFactory sessionFactory)
Method Detail

migrate

public void migrate(MigratorConfiguration config,
                    MigrationProgressListener progressListener)
             throws EntityException
The method is organised in a 'strange' way for performance reasons. DON'T change it. Every white space is there for a reason :) The performace problem was: every time we add a member to a hibernate group, hibernate marks this group object as dirty. Because hibernate group contains the list of all its members and needs to iterate through all of them when flush() is called. flush() is called every time hibernate thinks it needs to do it, for example when we call getUser() it first calls flush to make sure we get up to date data. We structured the code in a way so that flush is not called until we add all users to a group. That's why we cache the list of users. We also rely on the fact that targetGroupManager maintains its own cache and does not need to call flush() each time we get a group by a groupname.

Specified by:
migrate in interface EntityMigrator
Throws:
RepositoryException - if there is no non OSUser repository was included in target repository Accessor
EntityException


Copyright © 2005-2008 Atlassian Software Systems Pty Ltd. All Rights Reserved.