com.poscoict.glueframework.batch.item
Class GlueDefaultItemReader<T>

java.lang.Object
  extended by com.poscoict.glueframework.batch.item.GlueDefaultItemReader<T>
All Implemented Interfaces:
org.springframework.batch.item.ItemReader<T>, org.springframework.batch.item.ItemStream, org.springframework.batch.item.ItemStreamReader<T>

public class GlueDefaultItemReader<T>
extends Object
implements org.springframework.batch.item.ItemStreamReader<T>

ItemStreamReader ±¸Çöü.

 Bean Property
 
 - dataSource : (¼±ÅÃ) javax.sql.DataSource ±¸Çöü
 
 - queryManager : (¼±ÅÃ) com.poscoict.glueframework.dao.manager.GlueQueryManager ±¸Çöü
 
 
 
 ¿¹Á¦
 »ç¿ë ¿¹# 1
 
     <bean id="reader" class="com.poscoict.glueframework.batch.item.GlueDefaultItemReader">
         <property name="dataSource" ref="dataSource" />
         <property name="queryManager" ref="queryManager" />
     </bean>
     <bean id="dataSource" .../>
     <bean id="queryManager" ...>
 
 
 »ç¿ë ¿¹# 2
 
     <bean id="reader" class="com.poscoict.glueframework.batch.item.GlueDefaultItemReader">
         <property name="dataSource" ref="dataSource" />
     </bean>
     <bean id="dataSource" .../>
 
 
 »ç¿ë ¿¹# 3
 
     <bean id="reader" class="com.poscoict.glueframework.batch.item.GlueDefaultItemReader"/>
 
 
 
 Âü°í : {batch}.xml
 
     <batch:job id="job">
         <batch:step id="step-A">
             <batch:tasklet>
                 <batch:chunk reader="reader" processor="processor" writer="writer" commit-interval="1000" />
             </batch:tasklet>
         </batch:step>
     </batch:job>
     <bean id="jobLauncher" .../>
     <bean id="jobRepository" .../>
     <bean id="transactionManager" .../>
     <bean id="reader" ...>
     <bean id="processor" ...>
     <bean id="writer" ...>
 
 
 Âü°í : {main}.java
 
     import org.springframework.batch.core.*;
     import org.springframework.batch.core.launch.*;
     import com.poscoict.glueframework.context.*;
     public class Run_Batch {
         public static void main( String arg[] ) throws Exception {
             JobLauncher jobLauncher = GlueStaticContext.getBeanFactory().getBeanObject( "jobLauncher", JobLauncher.class );
             Job job = GlueStaticContext.getBeanFactory().getBeanObject( "job", Job.class );
             JobParametersBuilder builder = new JobParametersBuilder();
             builder.addString( "step-A.reader.resource.type", "jdbcDb" );
             builder.addString( "step-A.reader.query.id", "select.emp");
             jobLauncher.run( job, builder.toJobParameters() );
         }
     }
 
 
 Âü°í : {scheduler}.xml
 
     <bean id="jobDetail" class="org.springframework.scheduling.quartz.JobDetailBean">
         <property name="jobClass" value="com.poscoict.glueframework.batch.quartz.GlueQuartzJobLauncher"/>
         <property name="jobDataAsMap">
             <map>
                 <entry key="JobName" value="job"/>
                 <entry key="JobLauncherName" value="jobLauncher"/>
                 <entry key="step-A.reader.resource.type" value="jdbcDb"/>
                 <entry key="step-A.reader.query.id" value="select.emp"/>
             </map>
         </property>
     </bean>
 


Field Summary
static String DELIMITED_FILE_TYPE
           
static String FIXED_LENGTH_FILE_TYPE
           
static String JDBC_DB_TYPE
           
static String READER_COLUMNS_KEY
           
static String READER_DELIMITER_KEY
           
static String READER_FIELD_NAMES_KEY
           
static String READER_QUERY_ID_KEY
           
static String READER_RESOURCE_NAME_KEY
           
static String READER_RESOURCE_TYPE_KEY
           
static String READER_SQL_KEY
           
static String READER_VO_TYPE_KEY
           
 
Constructor Summary
GlueDefaultItemReader()
           
 
Method Summary
 void beforeStep(org.springframework.batch.core.StepExecution stepExecution)
           
 void close()
           
 void open(org.springframework.batch.item.ExecutionContext executionContext)
           
 T read()
           
 void setDataSource(DataSource dataSource)
          setter method for DI.
 void setQueryManager(GlueQueryManager queryManager)
          setter method for DI.
 void update(org.springframework.batch.item.ExecutionContext executionContext)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

READER_RESOURCE_TYPE_KEY

public static final String READER_RESOURCE_TYPE_KEY
See Also:
Constant Field Values

READER_RESOURCE_NAME_KEY

public static final String READER_RESOURCE_NAME_KEY
See Also:
Constant Field Values

READER_FIELD_NAMES_KEY

public static final String READER_FIELD_NAMES_KEY
See Also:
Constant Field Values

READER_VO_TYPE_KEY

public static final String READER_VO_TYPE_KEY
See Also:
Constant Field Values

READER_DELIMITER_KEY

public static final String READER_DELIMITER_KEY
See Also:
Constant Field Values

READER_COLUMNS_KEY

public static final String READER_COLUMNS_KEY
See Also:
Constant Field Values

READER_SQL_KEY

public static final String READER_SQL_KEY
See Also:
Constant Field Values

READER_QUERY_ID_KEY

public static final String READER_QUERY_ID_KEY
See Also:
Constant Field Values

DELIMITED_FILE_TYPE

public static final String DELIMITED_FILE_TYPE
See Also:
Constant Field Values

FIXED_LENGTH_FILE_TYPE

public static final String FIXED_LENGTH_FILE_TYPE
See Also:
Constant Field Values

JDBC_DB_TYPE

public static final String JDBC_DB_TYPE
See Also:
Constant Field Values
Constructor Detail

GlueDefaultItemReader

public GlueDefaultItemReader()
Method Detail

setDataSource

public void setDataSource(DataSource dataSource)
setter method for DI.

Parameters:
dataSource -

setQueryManager

public void setQueryManager(GlueQueryManager queryManager)
setter method for DI.

Parameters:
queryManager -

beforeStep

public void beforeStep(org.springframework.batch.core.StepExecution stepExecution)
                throws Exception
Throws:
Exception

open

public void open(org.springframework.batch.item.ExecutionContext executionContext)
          throws org.springframework.batch.item.ItemStreamException
Specified by:
open in interface org.springframework.batch.item.ItemStream
Throws:
org.springframework.batch.item.ItemStreamException

close

public void close()
           throws org.springframework.batch.item.ItemStreamException
Specified by:
close in interface org.springframework.batch.item.ItemStream
Throws:
org.springframework.batch.item.ItemStreamException

update

public void update(org.springframework.batch.item.ExecutionContext executionContext)
            throws org.springframework.batch.item.ItemStreamException
Specified by:
update in interface org.springframework.batch.item.ItemStream
Throws:
org.springframework.batch.item.ItemStreamException

read

public T read()
       throws Exception,
              org.springframework.batch.item.UnexpectedInputException,
              org.springframework.batch.item.ParseException,
              org.springframework.batch.item.NonTransientResourceException
Specified by:
read in interface org.springframework.batch.item.ItemReader<T>
Throws:
Exception
org.springframework.batch.item.UnexpectedInputException
org.springframework.batch.item.ParseException
org.springframework.batch.item.NonTransientResourceException


Copyright © 2013–2017 POSCO ICT. All rights reserved.