edu.internet2.middleware.grouper.app.loader
Class GrouperLoader

java.lang.Object
  extended by edu.internet2.middleware.grouper.app.loader.GrouperLoader

public class GrouperLoader
extends Object

main class to start the grouper loader


Nested Class Summary
static class GrouperLoader.GrouperLoaderDryRunBean
          bean holds where the logging goes, and if there, then it means we are in dry run mode
 
Field Summary
static String ATTRIBUTE_LOADER_ACTION_QUERY
          SQL query with at least the following column: action_name
static String ATTRIBUTE_LOADER_ACTION_SET_QUERY
          SQL query with at least the following columns: if_has_action_name, then_has_action_name
static String ATTRIBUTE_LOADER_ATTR_QUERY
          SQL query with at least some of the following columns: attr_name, attr_display_name, attr_description
static String ATTRIBUTE_LOADER_ATTR_SET_QUERY
          SQL query with at least the following columns: if_has_attr_name, then_has_attr_name
static String ATTRIBUTE_LOADER_ATTRS_LIKE
          If empty, then orphans will be left alone (for attributeDefName and attributeDefNameSets).
static String ATTRIBUTE_LOADER_DB_NAME
          DB name in grouper-loader.properties or default grouper db if blank
static String ATTRIBUTE_LOADER_INTERVAL_SECONDS
          If a START_TO_START_INTERVAL schedule type, this is the number of seconds between runs
static String ATTRIBUTE_LOADER_PRIORITY
          Quartz has a fixed threadpool (max configured in the grouper-loader.properties), and when the max is reached, then jobs are prioritized by this integer.
static String ATTRIBUTE_LOADER_QUARTZ_CRON
          If a CRON schedule type, this is the cron setting string from the quartz product to run a job daily, hourly, weekly, etc.
static String ATTRIBUTE_LOADER_SCHEDULE_TYPE
          Type of schedule.
static String ATTRIBUTE_LOADER_TYPE
          Type of loader, e.g.
static String GROUPER_LOADER_AND_GROUPS
          groups to and with to restrict members (e.g.
static String GROUPER_LOADER_DB_NAME
          group attribute name of the db connection where this query comes from.
static String GROUPER_LOADER_GROUP_QUERY
          optional group information for a group list query: e.g.
static String GROUPER_LOADER_GROUP_TYPES
          types to add to loaded groups
static String GROUPER_LOADER_GROUPS_LIKE
          If you want the group (if not used from anywhere) or members deleted when no longer in loader sql results, list the sql like name, e.g.
static String GROUPER_LOADER_INTERVAL_SECONDS
          group attribute name of the interval in seconds for a schedule type like START_TO_START_INTERVAL.
static String GROUPER_LOADER_PRIORITY
          group attribute name of priority of job, optional, if not there, will be 5.
static String GROUPER_LOADER_QUARTZ_CRON
          group attribute name of quartz cron-like string to describe when the job should run
static String GROUPER_LOADER_QUERY
          group attribute name of query, must have the required columns for the grouperLoaderType
static String GROUPER_LOADER_SCHEDULE_TYPE
          group attribute name of type of schedule, must match one of the enums in GrouperLoaderScheduleType.
static String GROUPER_LOADER_TYPE
          group attribute name of type of the loader, must match one of the enums in GrouperLoaderType.
 
Constructor Summary
GrouperLoader()
           
 
Method Summary
static Hib3GrouperLoaderLog _internal_runJobOnceForAttributeDef(GrouperSession grouperSession, AttributeDef attributeDef)
           
static String dryRunJobOnceForGroup(GrouperSession grouperSession, Group group, String fileName)
           
static void dryRunWriteLine(String line)
           
static void internal_assignThreadLocalGrouperLoaderDryRun(GrouperLoader.GrouperLoaderDryRunBean theThreadLocalGrouperLoaderDryRun)
           
static GrouperLoader.GrouperLoaderDryRunBean internal_retrieveThreadLocalGrouperLoaderDryRun()
           
static boolean isDryRun()
           
static boolean isJobRunning(String jobName)
           
static void main(String[] args)
           
static void printAllSupportDdlUtilsPlatforms()
          print out all ddlutils platforms
static String runJobOnceForAttributeDef(GrouperSession grouperSession, AttributeDef attributeDef)
           
static String runJobOnceForGroup(GrouperSession grouperSession, Group group)
           
static String runOnceByJobName(GrouperSession grouperSession, String jobName)
           
static void scheduleBuiltinMessagingDaemonJob()
          schedule enabled/disabled job
static void scheduleChangeLogConsumers()
          schedule change log consumer jobs
static void scheduleChangeLogJobs()
          schedule change log jobs
static void scheduleChangeLogTempToChangeLogJob()
          schedule maintenance job for moving records from change log to change log temp
static void scheduleDailyReportJob()
          schedule maintenance job
static void scheduleEnabledDisabledJob()
          schedule enabled/disabled job
static void scheduleEsbListenerJobs()
           
static void scheduleExternalSubjCalcFieldsJob()
          schedule external subject subj calc fields
static void scheduleGroupSyncJobs()
          schedule rules job
static boolean scheduleJobIfNeeded(org.quartz.JobDetail jobDetail, org.quartz.Trigger trigger)
          Schedule job if new or something has changed
static void scheduleLogCleanerJob()
          schedule maintenance job
static void scheduleMaintenanceJobs()
          schedule maintenance jobs
static void scheduleMessagingListeners()
          schedule messaging listener jobs
static void scheduleOtherJobs()
          schedule other jobs
static void schedulePspFullSyncJob()
          schedule psp full sync job
static void schedulePspFullSyncRunAtStartupJob()
          schedule psp full sync job once at startup
static org.quartz.SchedulerFactory schedulerFactory()
          lazy load (and start the scheduler) the scheduler factory
static void scheduleRulesJob()
          schedule rules job
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GROUPER_LOADER_TYPE

public static final String GROUPER_LOADER_TYPE
group attribute name of type of the loader, must match one of the enums in GrouperLoaderType. If there is a query, and it has "group_name" before "from", then defaults to SQL_GROUP_LIST else defaults to SQL_SIMPLE

See Also:
Constant Field Values

GROUPER_LOADER_AND_GROUPS

public static final String GROUPER_LOADER_AND_GROUPS
groups to and with to restrict members (e.g. "and" with activeEmployees)

See Also:
Constant Field Values

GROUPER_LOADER_GROUPS_LIKE

public static final String GROUPER_LOADER_GROUPS_LIKE
If you want the group (if not used from anywhere) or members deleted when no longer in loader sql results, list the sql like name, e.g. stem1:stem2:%:%org

See Also:
Constant Field Values

GROUPER_LOADER_GROUP_QUERY

public static final String GROUPER_LOADER_GROUP_QUERY
optional group information for a group list query: e.g. to specify the display name of the group/stem when it is created

See Also:
Constant Field Values

GROUPER_LOADER_GROUP_TYPES

public static final String GROUPER_LOADER_GROUP_TYPES
types to add to loaded groups

See Also:
Constant Field Values

GROUPER_LOADER_SCHEDULE_TYPE

public static final String GROUPER_LOADER_SCHEDULE_TYPE
group attribute name of type of schedule, must match one of the enums in GrouperLoaderScheduleType. defaults to START_TO_START_INTERVAL if grouperLoaderQuartzCron is blank, else defaults to CRON

See Also:
Constant Field Values

GROUPER_LOADER_QUERY

public static final String GROUPER_LOADER_QUERY
group attribute name of query, must have the required columns for the grouperLoaderType

See Also:
Constant Field Values

GROUPER_LOADER_QUARTZ_CRON

public static final String GROUPER_LOADER_QUARTZ_CRON
group attribute name of quartz cron-like string to describe when the job should run

See Also:
Constant Field Values

GROUPER_LOADER_INTERVAL_SECONDS

public static final String GROUPER_LOADER_INTERVAL_SECONDS
group attribute name of the interval in seconds for a schedule type like START_TO_START_INTERVAL. defaults to 86400 (1 day)

See Also:
Constant Field Values

GROUPER_LOADER_PRIORITY

public static final String GROUPER_LOADER_PRIORITY
group attribute name of priority of job, optional, if not there, will be 5. More is better. if the threadpool is full, then this priority will help the schedule pick which job should go next

See Also:
Constant Field Values

GROUPER_LOADER_DB_NAME

public static final String GROUPER_LOADER_DB_NAME
group attribute name of the db connection where this query comes from. if the name is "grouper", then it will be the group db name. defaults to "grouper" for sql type loaders

See Also:
Constant Field Values

ATTRIBUTE_LOADER_TYPE

public static final String ATTRIBUTE_LOADER_TYPE
Type of loader, e.g. ATTR_SQL_SIMPLE

See Also:
Constant Field Values

ATTRIBUTE_LOADER_DB_NAME

public static final String ATTRIBUTE_LOADER_DB_NAME
DB name in grouper-loader.properties or default grouper db if blank

See Also:
Constant Field Values

ATTRIBUTE_LOADER_SCHEDULE_TYPE

public static final String ATTRIBUTE_LOADER_SCHEDULE_TYPE
Type of schedule. Defaults to CRON if a cron schedule is entered, or START_TO_START_INTERVAL if an interval is entered

See Also:
Constant Field Values

ATTRIBUTE_LOADER_QUARTZ_CRON

public static final String ATTRIBUTE_LOADER_QUARTZ_CRON
If a CRON schedule type, this is the cron setting string from the quartz product to run a job daily, hourly, weekly, etc. e.g. daily at 7am: 0 0 7 * * ?

See Also:
Constant Field Values

ATTRIBUTE_LOADER_INTERVAL_SECONDS

public static final String ATTRIBUTE_LOADER_INTERVAL_SECONDS
If a START_TO_START_INTERVAL schedule type, this is the number of seconds between runs

See Also:
Constant Field Values

ATTRIBUTE_LOADER_PRIORITY

public static final String ATTRIBUTE_LOADER_PRIORITY
Quartz has a fixed threadpool (max configured in the grouper-loader.properties), and when the max is reached, then jobs are prioritized by this integer. The higher the better, and the default if not set is 5.

See Also:
Constant Field Values

ATTRIBUTE_LOADER_ATTRS_LIKE

public static final String ATTRIBUTE_LOADER_ATTRS_LIKE
If empty, then orphans will be left alone (for attributeDefName and attributeDefNameSets). If %, then all orphans deleted. If a SQL like string, then only ones in that like string not in loader will be deleted

See Also:
Constant Field Values

ATTRIBUTE_LOADER_ATTR_QUERY

public static final String ATTRIBUTE_LOADER_ATTR_QUERY
SQL query with at least some of the following columns: attr_name, attr_display_name, attr_description

See Also:
Constant Field Values

ATTRIBUTE_LOADER_ATTR_SET_QUERY

public static final String ATTRIBUTE_LOADER_ATTR_SET_QUERY
SQL query with at least the following columns: if_has_attr_name, then_has_attr_name

See Also:
Constant Field Values

ATTRIBUTE_LOADER_ACTION_QUERY

public static final String ATTRIBUTE_LOADER_ACTION_QUERY
SQL query with at least the following column: action_name

See Also:
Constant Field Values

ATTRIBUTE_LOADER_ACTION_SET_QUERY

public static final String ATTRIBUTE_LOADER_ACTION_SET_QUERY
SQL query with at least the following columns: if_has_action_name, then_has_action_name

See Also:
Constant Field Values
Constructor Detail

GrouperLoader

public GrouperLoader()
Method Detail

main

public static void main(String[] args)
Parameters:
args -

printAllSupportDdlUtilsPlatforms

public static void printAllSupportDdlUtilsPlatforms()
print out all ddlutils platforms


schedulerFactory

public static org.quartz.SchedulerFactory schedulerFactory()
lazy load (and start the scheduler) the scheduler factory

Returns:
the scheduler factory

scheduleMaintenanceJobs

public static void scheduleMaintenanceJobs()
schedule maintenance jobs


scheduleChangeLogJobs

public static void scheduleChangeLogJobs()
schedule change log jobs


scheduleChangeLogTempToChangeLogJob

public static void scheduleChangeLogTempToChangeLogJob()
schedule maintenance job for moving records from change log to change log temp


scheduleChangeLogConsumers

public static void scheduleChangeLogConsumers()
schedule change log consumer jobs


scheduleMessagingListeners

public static void scheduleMessagingListeners()
schedule messaging listener jobs


scheduleOtherJobs

public static void scheduleOtherJobs()
schedule other jobs


scheduleDailyReportJob

public static void scheduleDailyReportJob()
schedule maintenance job


scheduleRulesJob

public static void scheduleRulesJob()
schedule rules job


scheduleEnabledDisabledJob

public static void scheduleEnabledDisabledJob()
schedule enabled/disabled job


scheduleBuiltinMessagingDaemonJob

public static void scheduleBuiltinMessagingDaemonJob()
schedule enabled/disabled job


scheduleExternalSubjCalcFieldsJob

public static void scheduleExternalSubjCalcFieldsJob()
schedule external subject subj calc fields


scheduleLogCleanerJob

public static void scheduleLogCleanerJob()
schedule maintenance job


scheduleEsbListenerJobs

public static void scheduleEsbListenerJobs()

runJobOnceForGroup

public static String runJobOnceForGroup(GrouperSession grouperSession,
                                        Group group)
Parameters:
group -
grouperSession -
Returns:
status

runOnceByJobName

public static String runOnceByJobName(GrouperSession grouperSession,
                                      String jobName)
Parameters:
grouperSession -
jobName -
Returns:
status

_internal_runJobOnceForAttributeDef

public static Hib3GrouperLoaderLog _internal_runJobOnceForAttributeDef(GrouperSession grouperSession,
                                                                       AttributeDef attributeDef)
Parameters:
attributeDef -
grouperSession -
Returns:
status

runJobOnceForAttributeDef

public static String runJobOnceForAttributeDef(GrouperSession grouperSession,
                                               AttributeDef attributeDef)
Parameters:
attributeDef -
grouperSession -
Returns:
status

scheduleGroupSyncJobs

public static void scheduleGroupSyncJobs()
schedule rules job


schedulePspFullSyncJob

public static void schedulePspFullSyncJob()
schedule psp full sync job


schedulePspFullSyncRunAtStartupJob

public static void schedulePspFullSyncRunAtStartupJob()
schedule psp full sync job once at startup


internal_retrieveThreadLocalGrouperLoaderDryRun

public static GrouperLoader.GrouperLoaderDryRunBean internal_retrieveThreadLocalGrouperLoaderDryRun()
Returns:
the threadLocalGrouperLoaderDryRun

internal_assignThreadLocalGrouperLoaderDryRun

public static void internal_assignThreadLocalGrouperLoaderDryRun(GrouperLoader.GrouperLoaderDryRunBean theThreadLocalGrouperLoaderDryRun)
Parameters:
theThreadLocalGrouperLoaderDryRun - the threadLocalGrouperLoaderDryRun to set

dryRunJobOnceForGroup

public static String dryRunJobOnceForGroup(GrouperSession grouperSession,
                                           Group group,
                                           String fileName)
Parameters:
group -
grouperSession -
fileName - is the file where output should go
Returns:
status

isDryRun

public static boolean isDryRun()
Returns:
true if dry run

dryRunWriteLine

public static void dryRunWriteLine(String line)
Parameters:
line -

scheduleJobIfNeeded

public static boolean scheduleJobIfNeeded(org.quartz.JobDetail jobDetail,
                                          org.quartz.Trigger trigger)
                                   throws org.quartz.SchedulerException
Schedule job if new or something has changed

Parameters:
jobDetail -
trigger -
Returns:
true if needed an update
Throws:
org.quartz.SchedulerException

isJobRunning

public static boolean isJobRunning(String jobName)
Parameters:
jobName -
Returns:
true if the job appears to currently be running