wt.access
Class AccessControlObjectMigrator

java.lang.Object
  extended bywt.access.AccessControlObjectMigrator
All Implemented Interfaces:
JavaMigrator

public class AccessControlObjectMigrator
extends Object
implements JavaMigrator


Field Summary
private static String ACCESSPOLICYRULE_FILENAME
           
private static String ADHOCCONTROLLED_FILENAME
           
private  File adHocControlledFile
           
private static String ALL_ID
           
private static String BLOB_PREFIX
           
private  int blobBatchSize
           
private  int blobCount
           
private static String CABINET
           
private static String CLASS_INDICATOR
           
private static String CLASSNAME
           
private static String COLON
           
private  Connection connection
           
private  DirectiveServices ds
           
private  long endTime
           
private  int entryCount
           
private  Statement globalStatement_
           
private static String GROUP_TARGET_KEY
           
private static String INSERT_SQL
           
private  int insertBatchSize
           
private static int MAX_BATCH_SIZE
           
private  int noBlobBatchSize
           
private  int noBlobCount
           
private static String OWNER_ID
           
private  File policyRulesFile
           
private static String PROXYGROUP_TARGET_KEY
           
private static String PROXYUSER_TARGET_KEY
           
private static String ROLE_TARGET_KEY
           
private static String ROLEPERMISSIONS_FILENAME
           
private  File rolePermissionsFile
           
private  long startTime
           
private static short STREAM_VERSION
           
private static String SUBFOLDER
           
private static String TMP_DIRECTORY_NAME
           
private static String TMP_FILE_DELIM
           
private  File tmpdir
           
private static String USER_TARGET_KEY
           
private static boolean VERBOSE
           
private static boolean VERBOSE_TIMING
           
private static String WTACLENTRY
           
private static String WTGROUP
           
private static String WTPRINCIPALREFERENCE
           
private static String WTUSER
           
 
Constructor Summary
AccessControlObjectMigrator()
           
 
Method Summary
private  Object createWTAclEntries(PreparedStatement insertStmt, String entrySet, String aclClassName, long aclId)
           
private  void deleteTmpFiles()
           
private  Object evaluateCachedEntries(HashMap positiveEntries, HashMap negativeEntries)
           
private  void gatherAccessPolicyRules()
           
private  void gatherAdHocControlled()
           
private  void gatherRolePermissions()
           
private  PreparedStatement getUpdateInlineBlobStmt(String tableName, String columnName, boolean blob)
           
private  Blob initEmptyBlob(String tableName, String blobColumnName, String aclIdStr)
           
 boolean runMigration(DirectiveServices ds)
          Run the migration.
private static void safeClose(ResultSet rs)
          If the ResultSet is not null, try to close it, catching and smothering any SQLException that results.
private  void safeClose(Statement stmt)
          If the Statement is not null, try to close it, catching and smothering any SQLException that results.
private  void setupTmpFiles()
           
private  void updateAdHocAclSpecs()
           
private  void updateWTAclEntryObjects()
           
private  void writeInlineBlob(PreparedStatement noBlobStmt, PreparedStatement blobStmt, Object blob, String blobColumnName, String tableName, String aclIdStr)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASSNAME

private static final String CLASSNAME

CABINET

private static final String CABINET

SUBFOLDER

private static final String SUBFOLDER

WTACLENTRY

private static final String WTACLENTRY

WTGROUP

private static final String WTGROUP

WTPRINCIPALREFERENCE

private static final String WTPRINCIPALREFERENCE

WTUSER

private static final String WTUSER

ALL_ID

private static final String ALL_ID

OWNER_ID

private static final String OWNER_ID

ACCESSPOLICYRULE_FILENAME

private static final String ACCESSPOLICYRULE_FILENAME
See Also:
Constant Field Values

ADHOCCONTROLLED_FILENAME

private static final String ADHOCCONTROLLED_FILENAME
See Also:
Constant Field Values

ROLEPERMISSIONS_FILENAME

private static final String ROLEPERMISSIONS_FILENAME
See Also:
Constant Field Values

CLASS_INDICATOR

private static final String CLASS_INDICATOR
See Also:
Constant Field Values

TMP_DIRECTORY_NAME

private static final String TMP_DIRECTORY_NAME
See Also:
Constant Field Values

TMP_FILE_DELIM

private static final String TMP_FILE_DELIM
See Also:
Constant Field Values

COLON

private static final String COLON
See Also:
Constant Field Values

BLOB_PREFIX

private static final String BLOB_PREFIX
See Also:
Constant Field Values

INSERT_SQL

private static final String INSERT_SQL
See Also:
Constant Field Values

STREAM_VERSION

private static final short STREAM_VERSION
See Also:
Constant Field Values

GROUP_TARGET_KEY

private static final String GROUP_TARGET_KEY
See Also:
Constant Field Values

PROXYGROUP_TARGET_KEY

private static final String PROXYGROUP_TARGET_KEY
See Also:
Constant Field Values

PROXYUSER_TARGET_KEY

private static final String PROXYUSER_TARGET_KEY
See Also:
Constant Field Values

ROLE_TARGET_KEY

private static final String ROLE_TARGET_KEY
See Also:
Constant Field Values

USER_TARGET_KEY

private static final String USER_TARGET_KEY
See Also:
Constant Field Values

VERBOSE

private static boolean VERBOSE

VERBOSE_TIMING

private static boolean VERBOSE_TIMING

MAX_BATCH_SIZE

private static int MAX_BATCH_SIZE

connection

private Connection connection

ds

private DirectiveServices ds

globalStatement_

private Statement globalStatement_

tmpdir

private File tmpdir

rolePermissionsFile

private File rolePermissionsFile

adHocControlledFile

private File adHocControlledFile

policyRulesFile

private File policyRulesFile

blobBatchSize

private int blobBatchSize

insertBatchSize

private int insertBatchSize

noBlobBatchSize

private int noBlobBatchSize

blobCount

private int blobCount

entryCount

private int entryCount

noBlobCount

private int noBlobCount

endTime

private long endTime

startTime

private long startTime
Constructor Detail

AccessControlObjectMigrator

public AccessControlObjectMigrator()
Method Detail

runMigration

public boolean runMigration(DirectiveServices ds)
                     throws ClassNotFoundException,
                            IOException,
                            SQLException,
                            WTException
Description copied from interface: JavaMigrator
Run the migration.

Migrators should log all output to the given PrintWriter. This is the log that is created by RunMigrators. It is an autoflush writer.

Migrators should return true if they successfully completed migration and false otherwise. It is the migrator's responsibility to log failure reasons to the log.

Migrators should not concern themselves with committing the work on the connection. The MigratorRunner will commit the connection work after running each Migrator.

Specified by:
runMigration in interface JavaMigrator
Parameters:
ds - provide access to database, logging, and versioning information
Throws:
ClassNotFoundException
IOException
SQLException
WTException

setupTmpFiles

private void setupTmpFiles()
                    throws IOException
Throws:
IOException

gatherAccessPolicyRules

private void gatherAccessPolicyRules()
                              throws ClassNotFoundException,
                                     DatastoreException,
                                     IOException,
                                     SQLException,
                                     WTException
Throws:
ClassNotFoundException
DatastoreException
IOException
SQLException
WTException

gatherAdHocControlled

private void gatherAdHocControlled()
                            throws ClassNotFoundException,
                                   DatastoreException,
                                   SQLException,
                                   IOException,
                                   WTException
Throws:
ClassNotFoundException
DatastoreException
SQLException
IOException
WTException

gatherRolePermissions

private void gatherRolePermissions()
                            throws DatastoreException,
                                   IOException,
                                   SQLException,
                                   WTException
Throws:
DatastoreException
IOException
SQLException
WTException

updateWTAclEntryObjects

private void updateWTAclEntryObjects()
                              throws ClassNotFoundException,
                                     IOException,
                                     SQLException,
                                     WTException
Throws:
ClassNotFoundException
IOException
SQLException
WTException

getUpdateInlineBlobStmt

private PreparedStatement getUpdateInlineBlobStmt(String tableName,
                                                  String columnName,
                                                  boolean blob)
                                           throws SQLException,
                                                  WTIntrospectionException
Throws:
SQLException
WTIntrospectionException

createWTAclEntries

private Object createWTAclEntries(PreparedStatement insertStmt,
                                  String entrySet,
                                  String aclClassName,
                                  long aclId)
                           throws IOException,
                                  SQLException,
                                  WTException
Throws:
IOException
SQLException
WTException

evaluateCachedEntries

private Object evaluateCachedEntries(HashMap positiveEntries,
                                     HashMap negativeEntries)
                              throws IOException
Throws:
IOException

writeInlineBlob

private void writeInlineBlob(PreparedStatement noBlobStmt,
                             PreparedStatement blobStmt,
                             Object blob,
                             String blobColumnName,
                             String tableName,
                             String aclIdStr)
                      throws IOException,
                             SQLException,
                             WTException
Throws:
IOException
SQLException
WTException

initEmptyBlob

private Blob initEmptyBlob(String tableName,
                           String blobColumnName,
                           String aclIdStr)
                    throws SQLException,
                           WTException
Throws:
SQLException
WTException

updateAdHocAclSpecs

private void updateAdHocAclSpecs()
                          throws DatastoreException,
                                 IOException,
                                 SQLException,
                                 WTException
Throws:
DatastoreException
IOException
SQLException
WTException

deleteTmpFiles

private void deleteTmpFiles()
                     throws IOException
Throws:
IOException

safeClose

private static void safeClose(ResultSet rs)
If the ResultSet is not null, try to close it, catching and smothering any SQLException that results.


safeClose

private void safeClose(Statement stmt)
If the Statement is not null, try to close it, catching and smothering any SQLException that results.