DML 예제

Manager 화면을 이용하는게 원칙이며, 다음은 테스트 용입니다.

윈도우 환경에서 기본 설치과정을 따랐다고 가정합니다(RAMJobStore).
서버이름은 scheduler 이라고 가정합니다(startup 스크립트의 SCHEDULER_NM 값 참고).
서버설치위치는 C:/scheduler-server 이라고 가정합니다(startup 스크립트의 SCHEDULER_HOME 값 참고).
Java설치 위치는 C:/Java/jdk1.7.0_80 이라고 가정합니다(startup 스크립트의 JAVA_HOME 값 참고).

  1. case 1 : sample job 삭제
    insert into SCHEDULE_JOB_INFO(JOB_NAME,JOB_GROUP,JOB_CLASS,DURABILITY,RECOVERY,STATUS,SCHEDULER_NAME) values('job001','test','com.poscoict.app.quartz.GlueJavaProcessStartJobImpl','T','T','Y','scheduler');
    insert into SCHEDULE_JOB_RUN_OPTION(JOB_NAME,JOB_GROUP,JAVA_OPTION_KEY,JAVA_OPTION,JAVA_OPTION_TYPE)  values('job001','test','class',      'com.poscoict.app.job.GlueSimpleJob',  'usage');
    insert into SCHEDULE_JOB_RUN_OPTION(JOB_NAME,JOB_GROUP,JAVA_OPTION_KEY,JAVA_OPTION,JAVA_OPTION_TYPE)  values('job001','test','ref-all',    'C:/scheduler-server/apps/lib/*',      'cp');
    insert into SCHEDULE_JOB_RUN_OPTION(JOB_NAME,JOB_GROUP,JAVA_OPTION_KEY,JAVA_OPTION,JAVA_OPTION_TYPE)  values('job001','test','biz-app',    'C:/scheduler-server/apps/sample1.jar','cp');
    insert into SCHEDULE_JOB_RUN_OPTION(JOB_NAME,JOB_GROUP,JAVA_OPTION_KEY,JAVA_OPTION,JAVA_OPTION_TYPE)  values('job001','test','CONFIG_PATH','C:/scheduler-server/apps/conf',       'D');
    insert into SCHEDULE_JOB_RUN_OPTION(JOB_NAME,JOB_GROUP,JAVA_OPTION_KEY,JAVA_OPTION,JAVA_OPTION_TYPE)  values('job001','test','directory',  'C:/scheduler-server/logs',            'K');
    insert into SCHEDULE_JOB_RUN_OPTION(JOB_NAME,JOB_GROUP,JAVA_OPTION_KEY,JAVA_OPTION,JAVA_OPTION_TYPE)  values('job001','test','java',       'C:/Java/jdk1.7.0_80/bin/java',        'java');
    insert into SCHEDULE_JOB_DATA_INFO(JOB_NAME,JOB_GROUP,JOB_DATA_KEY,JOB_DATA_VALUE,JOB_DATA_TYPE)      values('job001','test','ServiceName', 'job001-service','S');
    insert into SCHEDULE_JOB_DATA_INFO(JOB_NAME,JOB_GROUP,JOB_DATA_KEY,JOB_DATA_VALUE,JOB_DATA_TYPE)      values('job001','test','sleep-second','5',             'S');
    
    insert into SCHEDULE_JOB_INFO(JOB_NAME,JOB_GROUP,JOB_CLASS,DURABILITY,RECOVERY,STATUS,SCHEDULER_NAME) values('SamplePgm','test','com.poscoict.app.quartz.GlueJavaProcessStartJobImpl','T','T','Y','scheduler');
    insert into SCHEDULE_JOB_RUN_OPTION(JOB_NAME,JOB_GROUP,JAVA_OPTION_KEY,JAVA_OPTION,JAVA_OPTION_TYPE)  values('SamplePgm','test','class',      'com.poscoict.app.job.GlueSimpleJob',  'usage');
    insert into SCHEDULE_JOB_RUN_OPTION(JOB_NAME,JOB_GROUP,JAVA_OPTION_KEY,JAVA_OPTION,JAVA_OPTION_TYPE)  values('SamplePgm','test','ref-all',    'C:/scheduler-server/apps/lib/*',      'cp');
    insert into SCHEDULE_JOB_RUN_OPTION(JOB_NAME,JOB_GROUP,JAVA_OPTION_KEY,JAVA_OPTION,JAVA_OPTION_TYPE)  values('SamplePgm','test','biz-app',    'C:/scheduler-server/apps/sample2.jar','cp');
    insert into SCHEDULE_JOB_RUN_OPTION(JOB_NAME,JOB_GROUP,JAVA_OPTION_KEY,JAVA_OPTION,JAVA_OPTION_TYPE)  values('SamplePgm','test','CONFIG_PATH','C:/scheduler-server/apps/conf',       'D');
    insert into SCHEDULE_JOB_RUN_OPTION(JOB_NAME,JOB_GROUP,JAVA_OPTION_KEY,JAVA_OPTION,JAVA_OPTION_TYPE)  values('SamplePgm','test','directory',  'C:/scheduler-server/logs',            'K');
    insert into SCHEDULE_JOB_RUN_OPTION(JOB_NAME,JOB_GROUP,JAVA_OPTION_KEY,JAVA_OPTION,JAVA_OPTION_TYPE)  values('SamplePgm','test','java',       'C:/Java/jdk1.7.0_80/bin/java',        'java');
    insert into SCHEDULE_JOB_DATA_INFO(JOB_NAME,JOB_GROUP,JOB_DATA_KEY,JOB_DATA_VALUE,JOB_DATA_TYPE)      values('SamplePgm','test','className',   'sample.job.SamplePgm','S');
    insert into SCHEDULE_JOB_DATA_INFO(JOB_NAME,JOB_GROUP,JOB_DATA_KEY,JOB_DATA_VALUE,JOB_DATA_TYPE)      values('SamplePgm','test','sleep-second','5',                   'S');
    
    insert into SCHEDULE_TRIGGER_INFO (TRIGGER_NAME, TRIGGER_GROUP, JOB_NAME,  JOB_GROUP, PRIORITY, TRIGGER_TYPE, REPEAT_CNT, INTERVAL, INTERVAL_TYPE, MISFIRE_HANDLING, STATUS) values ('simpletrigger', 'test', 'job001', 'test', 5, 'S', 3, 5, 'S', -1, 'Y');
    insert into SCHEDULE_TRIGGER_INFO (TRIGGER_NAME, TRIGGER_GROUP, JOB_NAME,  JOB_GROUP, PRIORITY, TRIGGER_TYPE,                     CRON_EXPRESSION, MISFIRE_HANDLING, STATUS) values ('crontrigger', 'test', 'SamplePgm', 'test', 5, 'C', '0 * * * * ?', -1, 'Y');
    
  2. case 2 : sample job 삭제
    delete from SCHEDULE_TRIGGER_INFO   where JOB_GROUP='test';
    delete from SCHEDULE_JOB_DATA_INFO  where JOB_GROUP='test';
    delete from SCHEDULE_JOB_RUN_OPTION where JOB_GROUP='test';
    delete from SCHEDULE_JOB_INFO       where JOB_GROUP='test';
    
  3. case 3 : group 생성 예제
    insert into GROUPS(GROUP_ID,GROUP_NAME,CREATE_DATE,CREATE_USER) 
    values (?,?,CURRENT_TIMESTAMP,'SQL');
    
    insert into GROUPS(GROUP_ID,GROUP_NAME,CREATE_DATE,CREATE_USER) 
    values ('M00_op','M00 IT 개발/운영 그룹',CURRENT_TIMESTAMP,'SQL');
    insert into GROUPS(GROUP_ID,GROUP_NAME,CREATE_DATE,CREATE_USER) 
    values ('M12_op','M12 IT 개발/운영 그룹',CURRENT_TIMESTAMP,'SQL');
    insert into GROUPS(GROUP_ID,GROUP_NAME,CREATE_DATE,CREATE_USER) 
    values ('M20_op','M20 IT 개발/운영 그룹',CURRENT_TIMESTAMP,'SQL');
    
  4. case 4 : resource 생성 예제
    insert into RESOURCES(RESOURCE_ID,RESOURCE_NAME,RESOURCE_PATTERN,RESOURCE_TYPE,CREATE_DATE,CREATE_USER) 
    values(?,?,?,'JobKey',CURRENT_TIMESTAMP,'SQL');
    
    insert into RESOURCES(RESOURCE_ID,RESOURCE_NAME,RESOURCE_PATTERN,RESOURCE_TYPE,CREATE_DATE,CREATE_USER) 
    values('data-all','모든 JobKey',     '.*',   'JobKey',CURRENT_TIMESTAMP,'SQL');
    insert into RESOURCES(RESOURCE_ID,RESOURCE_NAME,RESOURCE_PATTERN,RESOURCE_TYPE,CREATE_DATE,CREATE_USER) 
    values('data-m00','m00파트의 JobKey','M00.*','JobKey',CURRENT_TIMESTAMP,'SQL');
    insert into RESOURCES(RESOURCE_ID,RESOURCE_NAME,RESOURCE_PATTERN,RESOURCE_TYPE,CREATE_DATE,CREATE_USER) 
    values('data-m12','m12파트의 JobKey','M12.*','JobKey',CURRENT_TIMESTAMP,'SQL');
    insert into RESOURCES(RESOURCE_ID,RESOURCE_NAME,RESOURCE_PATTERN,RESOURCE_TYPE,CREATE_DATE,CREATE_USER) 
    values('data-m20','m20파트의 JobKey','M20.*','JobKey',CURRENT_TIMESTAMP,'SQL');
    
  5. case 5 : role 생성 예제
    insert into ROLES(ROLE_ID,ROLE_NAME,DESCRIPTION,CREATE_DATE,CREATE_USER) 
    values(?, ?, ?, CURRENT_TIMESTAMP,'SQL');
    
    insert into ROLES(ROLE_ID,ROLE_NAME,DESCRIPTION,CREATE_DATE,CREATE_USER) 
    values('ROLE_M00_OP', 'M00(공통)개발용','M00(공통) 운영자 롤',CURRENT_TIMESTAMP,'SQL');
    insert into ROLES(ROLE_ID,ROLE_NAME,DESCRIPTION,CREATE_DATE,CREATE_USER) 
    values('ROLE_M12_OP', 'M00(관제)개발용','M00(관제) 운영자 롤',CURRENT_TIMESTAMP,'SQL');
    insert into ROLES(ROLE_ID,ROLE_NAME,DESCRIPTION,CREATE_DATE,CREATE_USER) 
    values('ROLE_M20_OP', 'M00(조업)개발용','M00(조업) 운영자 롤',CURRENT_TIMESTAMP,'SQL');
    
  6. case 6 : role을 group에 할당하는 예제
    insert into GROUPS_ROLES(GROUP_ID,ROLE_ID,CREATE_DATE,CREATE_USER) 
    values(?, ?, CURRENT_TIMESTAMP,'SQL');
    
    insert into GROUPS_ROLES(GROUP_ID,ROLE_ID,CREATE_DATE,CREATE_USER) 
    values('M00_op', 'ROLE_M00_OP', CURRENT_TIMESTAMP,'SQL');
    insert into GROUPS_ROLES(GROUP_ID,ROLE_ID,CREATE_DATE,CREATE_USER) 
    values('M12_op', 'ROLE_M12_OP', CURRENT_TIMESTAMP,'SQL');
    insert into GROUPS_ROLES(GROUP_ID,ROLE_ID,CREATE_DATE,CREATE_USER) 
    values('M20_op', 'ROLE_M20_OP', CURRENT_TIMESTAMP,'SQL');
    
  7. case 7 : role에 resource를 할당하는 예제
    insert into RESOURCES_ROLES(RESOURCE_ID,ROLE_ID,CREATE_DATE,CREATE_USER) 
    values(?, ?, CURRENT_TIMESTAMP, 'SQL');
    
    insert into RESOURCES_ROLES(RESOURCE_ID,ROLE_ID,CREATE_DATE,CREATE_USER) 
    values('data-m00', 'ROLE_M00_OP', CURRENT_TIMESTAMP,'SQL');
    insert into RESOURCES_ROLES(RESOURCE_ID,ROLE_ID,CREATE_DATE,CREATE_USER) 
    values('data-m12', 'ROLE_M00_OP', CURRENT_TIMESTAMP,'SQL');
    insert into RESOURCES_ROLES(RESOURCE_ID,ROLE_ID,CREATE_DATE,CREATE_USER) 
    values('data-m20', 'ROLE_M00_OP', CURRENT_TIMESTAMP,'SQL');
    
  8. case 8 : job 추가 예제 - JobKey 생성
    insert into SCHEDULE_JOB_INFO(JOB_NAME,JOB_GROUP,JOB_CLASS,DURABILITY,RECOVERY,STATUS,SCHEDULER_NAME) 
    values(?,?,'com.poscoict.app.quartz.GlueJavaProcessStartJobImpl','T','T','N',?);
    
    insert into SCHEDULE_JOB_INFO(JOB_NAME,JOB_GROUP,JOB_CLASS,DURABILITY,RECOVERY,STATUS,SCHEDULER_NAME) 
    values('job001', 'M00', 'com.poscoict.app.quartz.GlueJavaProcessStartJobImpl', 'T', 'T', 'N', 'scheduler');
    insert into SCHEDULE_JOB_INFO(JOB_NAME,JOB_GROUP,JOB_CLASS,DURABILITY,RECOVERY,STATUS,SCHEDULER_NAME) 
    values('job002', 'M00', 'com.poscoict.app.quartz.GlueJavaProcessStartJobImpl', 'T', 'T', 'N', 'scheduler');
    insert into SCHEDULE_JOB_INFO(JOB_NAME,JOB_GROUP,JOB_CLASS,DURABILITY,RECOVERY,STATUS,SCHEDULER_NAME) 
    values('job003', 'M00', 'com.poscoict.app.quartz.GlueJavaProcessStartJobImpl', 'T', 'T', 'N', 'scheduler');
    
  9. case 9 : job 추가 예제 - 실행옵션 생성
    insert into SCHEDULE_JOB_RUN_OPTION(JOB_NAME,JOB_GROUP,JAVA_OPTION_KEY,JAVA_OPTION,JAVA_OPTION_TYPE) 
    values(?, ?, ?, ?, ?);
    
    insert into SCHEDULE_JOB_RUN_OPTION(JOB_NAME,JOB_GROUP,JAVA_OPTION_KEY,JAVA_OPTION,JAVA_OPTION_TYPE) 
    values('job001','M00','class',      'com.poscoict.app.job.GlueSimpleJob',  'usage');
    insert into SCHEDULE_JOB_RUN_OPTION(JOB_NAME,JOB_GROUP,JAVA_OPTION_KEY,JAVA_OPTION,JAVA_OPTION_TYPE) 
    values('job001','M00','ref-all',    'C:/scheduler-server/apps/lib/*',      'cp');
    insert into SCHEDULE_JOB_RUN_OPTION(JOB_NAME,JOB_GROUP,JAVA_OPTION_KEY,JAVA_OPTION,JAVA_OPTION_TYPE) 
    values('job001','M00','biz-app',    'C:/scheduler-server/apps/sample1.jar','cp');
    insert into SCHEDULE_JOB_RUN_OPTION(JOB_NAME,JOB_GROUP,JAVA_OPTION_KEY,JAVA_OPTION,JAVA_OPTION_TYPE) 
    values('job001','M00','CONFIG_PATH','C:/scheduler-server/apps/conf',       'D');
    insert into SCHEDULE_JOB_RUN_OPTION(JOB_NAME,JOB_GROUP,JAVA_OPTION_KEY,JAVA_OPTION,JAVA_OPTION_TYPE) 
    values('job001','M00','directory',  'C:/scheduler-server/logs',            'K');
    insert into SCHEDULE_JOB_RUN_OPTION(JOB_NAME,JOB_GROUP,JAVA_OPTION_KEY,JAVA_OPTION,JAVA_OPTION_TYPE) 
    values('job001','M00','java',       'C:/Java/jdk1.7.0_80/bin/java',        'java');
    
  10. case 10 : job 추가 예제 - job data 생성
    insert into SCHEDULE_JOB_DATA_INFO(JOB_NAME,JOB_GROUP,JOB_DATA_KEY,JOB_DATA_VALUE,JOB_DATA_TYPE) 
    values(?, ?, ?, ?, 'S');
    
    insert into SCHEDULE_JOB_DATA_INFO(JOB_NAME,JOB_GROUP,JOB_DATA_KEY,JOB_DATA_VALUE,JOB_DATA_TYPE) 
    values('job001','M00','ServiceName', 'job001-service','S');
    insert into SCHEDULE_JOB_DATA_INFO(JOB_NAME,JOB_GROUP,JOB_DATA_KEY,JOB_DATA_VALUE,JOB_DATA_TYPE) 
    values('job001','M00','sleep-second','5',             'S');