Package com.ikanow.infinit.e.processing.generic

Examples of com.ikanow.infinit.e.processing.generic.GenericProcessingController


    System.out.println(Arrays.toString(args));
    Globals.setIdentity(Identity.IDENTITY_SERVICE);
    Globals.overrideConfigLocation(args[0]);
   
    // "-1"] Test initialization
    new GenericProcessingController().Initialize();
   
    // 0] Preparation: use the harvest library to get various sets of files to test out...
    HarvestController hc = new HarvestController();
    hc.setStandaloneMode(5);
    LinkedList<DocumentPojo> toAdd_feed = new LinkedList<DocumentPojo>();
    LinkedList<DocumentPojo> toUpdate_feed = new LinkedList<DocumentPojo>();
    LinkedList<DocumentPojo> toDelete_feed = new LinkedList<DocumentPojo>();
    // File type:
    BasicDBObject query = new BasicDBObject("extractType", "Feed");
    // A useful source known to work during V0S1 testing:
    query.put("key", "arstechnica.com.tech-policy.2012.10.last-android-vendor-f.147.4.");
   
    SourcePojo feedSource = SourcePojo.fromDb(DbManager.getIngest().getSource().findOne(query), SourcePojo.class);
    hc.harvestSource(feedSource, toAdd_feed, toUpdate_feed, toDelete_feed);
    System.out.println("############# Retrieved sample feed documents: " + toAdd_feed.size() + " from " + feedSource.getUrl());
   
    // 1] Test the store and index manager by itself:
    StoreAndIndexManager.setDiagnosticMode(true);
   
//    // Test all public calls
    //1.1] (resize DB)
//    StoreAndIndexManager storeManager = new StoreAndIndexManager();
//    storeManager.resizeDB(7365793L);
//    System.exit(0);
   
//    StoreAndIndexManager storeManager = new StoreAndIndexManager();
//    storeManager.addToDatastore(toAdd_feed, true);
//    // (addToSearch called from addToDatastore so not duplicated here)
//    storeManager.removeFromDatastore_byURL(toAdd_feed, true);
//    storeManager.removeFromDatastore_byId(toAdd_feed, true);
//    // (removeFromSearch called from removeFromDatastore_byId so not duplicated here)
//        // Finally, test the index switching/bulk indexing logic standalone:
//    if (toAdd_feed.size() > 4) {
//      toAdd_feed.get(2).setIndex("document_index");
//      toAdd_feed.get(3).setIndex(null);
//      storeManager.addToSearch(toAdd_feed);
//    }
//    if (toAdd_feed.size() > 4) {
//      toAdd_feed.get(2).setIndex(toAdd_feed.get(0).getIndex());
//      toAdd_feed.get(3).setIndex(toAdd_feed.get(0).getIndex());
//      toAdd_feed.get(0).setIndex(null);
//      toAdd_feed.get(3).setIndex(null);
//      storeManager.removeFromSearch(toAdd_feed);
//    }   
//    if (toAdd_feed.size() < 5) {
//      System.out.println("************** Couldn't test StoreAndIndexManager indexing fully because <5 docs");     
//    }   
//    System.out.println("############# Tested StoreAndIndexManager calls");
     
    // 2] Now run through a full store/aggregation cycle
   
    // 2.0] Need to rerun the harvester because adding/removing from index changes to docs
//    toAdd_feed.clear(); toUpdate_feed.clear(); toDelete_feed.clear();
//    hc.harvestSource(feedSource, toAdd_feed, toUpdate_feed, toDelete_feed);
//    System.out.println("############# ReRetrieved sample feed documents");

    // 2.1] Logic:
    AggregationManager.setDiagnosticMode(true);
    GenericProcessingController pxControl_feed = new GenericProcessingController();
    // No need to do this, thoroughly tested during beta (and a bit slow)
    //pxControl.Initialize();
   
    // Comment in the desired test...
   
    // 2.1.1] Only adding:
    // (+Check that the feeds' entities statistics have been updated:)
//    pxControl_feed.processDocuments(InfiniteEnums.FEEDS, toAdd_feed, toUpdate_feed, toDelete_feed); // (add, update, delete)
//    System.out.println(new GsonBuilder().setPrettyPrinting().create().toJson(toAdd_feed));
    // 2.1.2] Updating:
    DocumentPojo docToUpdate1 = toAdd_feed.get(0);
    DocumentPojo docToUpdate2 = toAdd_feed.get(1);
    // Couple of options:
    docToUpdate1.setId(null); // (should be unnecessary, _id shouldn't have been set)
    docToUpdate2.setId(null);
    docToUpdate2.setUpdateId(new ObjectId("5277fec1256f16a6d3def633")); // (Doesn't matter what it is, just check the diagnostic from StoreAndIndexManager.removeFromSearch matches)
    toUpdate_feed.add(docToUpdate1);
    toUpdate_feed.add(docToUpdate2);
    pxControl_feed.processDocuments(InfiniteEnums.FEEDS, toAdd_feed, toUpdate_feed, toDelete_feed); // (add, update, delete)
    // 2.1.3] Deleting some docs, adding others
//    toDelete_feed.add(toAdd_feed.pop());
//    pxControl_feed.processDocuments(InfiniteEnums.FEEDS, toAdd_feed, toUpdate_feed, toDelete_feed); // (add, update, delete)
    // 2.1.4] More logic:
//    DocumentPojo doc1 = null;
View Full Code Here


    if (null != sConfigPath) {
      com.ikanow.infinit.e.data_model.Globals.overrideConfigLocation(sConfigPath);
    }
    boolean bRebuildIndexOnFly = false;
    if (bRebuildIndex && ((null == sQuery) || sQuery.equals("{}"))) { // (else will do them 1-by-1)
      new GenericProcessingController().InitializeIndex(true, false, false);
    }
    else {
     
      // Have seen odd transport timeouts on occasion: this should ensure they never happen
      new GenericProcessingController().InitializeIndex(false, false, false, bVerifyIndex);
        // (don't delete anything, but do recalc)
     
      if (bRebuildIndex) {
        bRebuildIndexOnFly = true;
      }
View Full Code Here

  {
    // Let the client know the server is starting
        System.out.println("[SERVER] Harvest server is coming online");
               
    // Intialize/update generic process controller (do this here so that it blocks before threading fun starts)
    new GenericProcessingController().Initialize();
   
    //Start the background aggregation thread (will do nothing if disabled)
    EntityBackgroundAggregationManager.startThread();
    AssociationBackgroundAggregationManager.startThread();
   
View Full Code Here

    private SourcePojo _sourceToProcess = null;
   
    public void run() {
   
      HarvestController hc;
      GenericProcessingController gpc;
     
      try {       
        if (null == _harvesterController.get()) { // Some sort of internal bug? No idea...
          _harvesterController.set(new HarvestController());
        }
        if (null == _genericController.get()) { // (ditto, not seen this but better safe than sorry)
          _genericController.set(new GenericProcessingController());
        }
       
        List<DocumentPojo> toAdd = new LinkedList<DocumentPojo>();
        List<DocumentPojo> toUpdate = new LinkedList<DocumentPojo>();
        List<DocumentPojo> toRemove = new LinkedList<DocumentPojo>();       
       
        hc = _harvesterController.get();
        hc.harvestSource(_sourceToProcess, toAdd, toUpdate, toRemove);
          // (toAdd includes toUpdate)
       
        if (HarvestEnum.error != _sourceToProcess.getHarvestStatus().getHarvest_status()) {
          gpc = _genericController.get();
          gpc.processDocuments(SourceUtils.getHarvestType(_sourceToProcess), toAdd, toUpdate, toRemove, _sourceToProcess);
            // (toRemove includes toUpdate)
         
          SourceUtils.updateHarvestStatus(_sourceToProcess, HarvestEnum.success, toAdd, toRemove.size(), null);
            // (note also releases the "in_progress" lock)
            // (note also prunes sources based on "maxDocs")
View Full Code Here

    com.ikanow.infinit.e.data_model.Globals.setIdentity(com.ikanow.infinit.e.data_model.Globals.Identity.IDENTITY_SERVICE);
    if (null != sConfigPath) {
      com.ikanow.infinit.e.data_model.Globals.overrideConfigLocation(sConfigPath);
    }
    if (bRebuildIndex) {
      new GenericProcessingController().InitializeIndex(false, true, false);
    }
   
    BasicDBObject query = null;   
    if (null == sQuery) {
      query = new BasicDBObject();
View Full Code Here

    com.ikanow.infinit.e.data_model.Globals.setIdentity(com.ikanow.infinit.e.data_model.Globals.Identity.IDENTITY_SERVICE);
    if (null != sConfigPath) {
      com.ikanow.infinit.e.data_model.Globals.overrideConfigLocation(sConfigPath);
    }
    if (bRebuildIndex) {
      new GenericProcessingController().InitializeIndex(false, false, true);
    }
   
    BasicDBObject query = null;   
    if (null == sQuery) {
      query = new BasicDBObject();
View Full Code Here

TOP

Related Classes of com.ikanow.infinit.e.processing.generic.GenericProcessingController

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.