SOLR dataimport data import source code analysis (6)

Source: Internet
Author: User
Tags solr
The brief code of the docbuilder class is as follows: Pass the context parameter to the constructor of the entityprocessorwrapper class, and then execute the init () method of entityprocessorwrapper to initialize the data source;

Then, call the entityprocessorwrapper method to obtain the data (all or incrementally import the data)

Public class docbuilder {

Private void dofulldump (){

Builddocument (getvariableresolver (), null, null, root, true, null );

}


Private void dodelta (){

Set <Map <string, Object> deletedkeys = new hashset <Map <string, Object> ();

Set <Map <string, Object> allpks = collectdelta (root, resolver, deletedkeys );

Builddocument (vri, null, MAP, root, true, null );

}


Private void builddocument (variableresolverimpl VR, docwrapper doc, Map <string, Object> PK, dataconfig. entity, Boolean isroot, contextimpl parentctx ){

Builddocument (VR, Doc, PK, entity, isroot, parentctx, entitiestodestroy );

}


Private void builddocument (variableresolverimpl VR, docwrapper doc, Map <string, Object> PK, dataconfig. entity, Boolean isroot, contextimpl parentctx, list <entityprocessorwrapper> entitiestodestroy ){

Entityprocessorwrapper entityprocessor = getentityprocessor (entity );

Contextimpl CTX = new contextimpl (entity, VR, null,
PK = NULL? Context. full_dump: context. delta_dump,
Session, parentctx, this );
Entityprocessor. INIT (CTX );

// Map <string, Object> Arow = entityprocessor. nextrow ();

// Other Code omitted

}


Private entityprocessorwrapper getentityprocessor (dataconfig. entity ){

Entityprocessor = new sqlentityprocessor ();

Return entity. processor = new entityprocessorwrapper (entityprocessor, this );
}


Dataimporter;


Public static final string last_index_time = "last_index_time ";

Public static final string index_start_time = "index_start_time ";


Public docbuilder (dataimporter, solrwriter, dihpropertieswriter propwriter, dataimporter. requestparams reqparams ){

This. dataimporter = dataimporter;

}


Public void execute (){
Dodelta ();
Dofulldump ();
}


Public set <Map <string, Object> collectdelta (dataconfig. entity, variableresolverimpl resolver, set <Map <string, Object> deletedrows ){
// Someone called abort

Entityprocessor = getentityprocessor (entity );
Contextimpl context1 = new contextimpl (entity, resolver, null, context. find_delta, session, null, this );
Entityprocessor. INIT (context1 );

Set <Map <string, Object> mymodifiedpks = new hashset <Map <string, Object> ();

// Map <string, Object> ROW = entityprocessor. nextmodifiedrowkey ();

Return mymodifiedpks;

}

}

The related class diagram is as follows:

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.