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

java.lang.Object
  extended by com.poscoict.glueframework.batch.item.GlueDefaultItemWriter<T>
All Implemented Interfaces:
org.springframework.batch.item.ItemStream, org.springframework.batch.item.ItemStreamWriter<T>, org.springframework.batch.item.ItemWriter<T>

public class GlueDefaultItemWriter<T>
extends Object
implements org.springframework.batch.item.ItemStreamWriter<T>

ItemStreamWriter ±¸Çöü.

 Bean Property
 
 - dataSource : (¼±ÅÃ) javax.sql.DataSource ±¸Çöü
 
 - queryManager : (¼±ÅÃ) com.poscoict.glueframework.dao.manager.GlueQueryManager ±¸Çöü
 
 
 ¿¹Á¦
 »ç¿ë ¿¹# 1
 
     <bean id="writer" class="com.poscoict.glueframework.batch.item.GlueDefaultItemWriter">
         <property name="dataSource" ref="dataSource" />
         <property name="queryManager" ref="queryManager" />
     </bean>
     <bean id="dataSource" .../>
     <bean id="queryManager" ...>
 
 
 »ç¿ë ¿¹# 2
 
     <bean id="writer" class="com.poscoict.glueframework.batch.item.GlueDefaultItemWriter">
         <property name="dataSource" ref="dataSource" />
     </bean>
     <bean id="dataSource" .../>
 
 
 »ç¿ë ¿¹# 3
 
     <bean id="writer" class="com.poscoict.glueframework.batch.item.GlueDefaultItemWriter"/>
 
 
 
 Âü°í : {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.writer.resource.type", "jdbcDb" );
             builder.addString( "step-A.writer.query.id", "insert.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.writer.resource.type" value="jdbcDb"/>
                 <entry key="step-A.writer.query.id" value="insert.emp"/>
             </map>
         </property>
     </bean>
 


Field Summary
static String DELIMITED_FILE_TYPE
           
static String FORMAT_FILE_TYPE
           
static String JDBC_DB_TYPE
           
static String WRITER_DELIMITER_KEY
           
static String WRITER_FIELD_FORMAT
           
static String WRITER_FIELD_NAMES_KEY
           
static String WRITER_QUERY_ID_KEY
           
static String WRITER_RESOURCE_NAME_KEY
           
static String WRITER_RESOURCE_TYPE_KEY
           
static String WRITER_SQL_KEY
           
 
Constructor Summary
GlueDefaultItemWriter()
           
 
Method Summary
 void beforeStep(org.springframework.batch.core.StepExecution stepExecution)
           
 void close()
           
 void open(org.springframework.batch.item.ExecutionContext executionContext)
           
 void setDataSource(DataSource dataSource)
          setter method for DI.
 void setQueryManager(GlueQueryManager queryManager)
          setter method for DI.
 void update(org.springframework.batch.item.ExecutionContext executionContext)
           
 void write(List<? extends T> items)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WRITER_RESOURCE_TYPE_KEY

public static final String WRITER_RESOURCE_TYPE_KEY
See Also:
Constant Field Values

WRITER_RESOURCE_NAME_KEY

public static final String WRITER_RESOURCE_NAME_KEY
See Also:
Constant Field Values

WRITER_FIELD_NAMES_KEY

public static final String WRITER_FIELD_NAMES_KEY
See Also:
Constant Field Values

WRITER_FIELD_FORMAT

public static final String WRITER_FIELD_FORMAT
See Also:
Constant Field Values

WRITER_DELIMITER_KEY

public static final String WRITER_DELIMITER_KEY
See Also:
Constant Field Values

WRITER_SQL_KEY

public static final String WRITER_SQL_KEY
See Also:
Constant Field Values

WRITER_QUERY_ID_KEY

public static final String WRITER_QUERY_ID_KEY
See Also:
Constant Field Values

DELIMITED_FILE_TYPE

public static final String DELIMITED_FILE_TYPE
See Also:
Constant Field Values

FORMAT_FILE_TYPE

public static final String FORMAT_FILE_TYPE
See Also:
Constant Field Values

JDBC_DB_TYPE

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

GlueDefaultItemWriter

public GlueDefaultItemWriter()
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 ClassNotFoundException
Throws:
ClassNotFoundException

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

write

public void write(List<? extends T> items)
           throws Exception
Specified by:
write in interface org.springframework.batch.item.ItemWriter<T>
Throws:
Exception


Copyright © 2013–2015 POSCO ICT SWÁ¦Ç°±â¼úÆÀ. All rights reserved.