Package org.apache.cassandra.service

Examples of org.apache.cassandra.service.batch_mutation_super_t


    {
      for(int key = 1; key <= keys ; key++)
      {
              String stringKey = new Integer(key).toString();
              stringKey = stringKey + keyFix_ ;
              batch_mutation_super_t bt = new batch_mutation_super_t();
              bt.key = stringKey;
              bt.table = tablename_;
              bt.cfmap = new HashMap<String,List<superColumn_t>>();
              ArrayList<superColumn_t> superColumn_arr = new ArrayList<superColumn_t>();
             
View Full Code Here


        new FileInputStream(filepath)), 16 * 1024 * 1024);
    String line = null;
    String delimiter_ = new String(",");
    String firstuser = null;
    String nextuser = null;
    batch_mutation_super_t rmInbox = null;
    batch_mutation_super_t rmOutbox = null;
    while ((line = bufReader.readLine()) != null) {
      StringTokenizer st = new StringTokenizer(line, delimiter_);
      int i = 0;
      String threadId = null;
      int lastUpdated = 0;
      int isDeleted = 0;
      int folder = 0;
      int uid =0;
      String user = null;
      String subject = null;
      String body = null;
      while (st.hasMoreElements()) {
        switch (i) {
        case 0:
          user = (String) st.nextElement();// sb.append((String)st.nextElement());
                    if ( !isNumeric(user))
                        continue;
         
          break;

        case 1:
          folder = Integer.parseInt((String) st.nextElement());// sb.append((String)st.nextElement());
          break;

        case 2:
          threadId = (String) st.nextElement();
          break;

        case 3:
          lastUpdated = Integer.parseInt((String) st.nextElement());
          break;

        case 4:
          isDeleted = Integer.parseInt((String) st.nextElement());// (String)st.nextElement();
          break;

        case 5:
          st.nextElement();
          break;

        case 6:
          st.nextElement();
          break;

        case 7:
          subject = (String) st.nextElement();
          break;

        case 8:
          body = (String) st.nextElement();
          break;
        default:
          st.nextElement();
          break;
        }
        ++i;
      }

      nextuser = user;
      if (firstuser == null || firstuser.compareTo(nextuser) != 0) {
        firstuser = nextuser;
        if (rmInbox != null && !rmInbox.cfmap.isEmpty()) {
          fos_.write(rmInbox.key.getBytes());
          fos_.write( System.getProperty("line.separator").getBytes());
                  counter_.incrementAndGet();
          apply(rmInbox);
        }
        if (rmOutbox != null && !rmOutbox.cfmap.isEmpty()) {
          fos_.write(rmOutbox.key.getBytes());
          fos_.write( System.getProperty("line.separator").getBytes());
                  counter_.incrementAndGet();
          apply(rmOutbox);
        }
        rmInbox = new batch_mutation_super_t();
        rmInbox.table = "Mailbox";
        rmInbox.key = firstuser ;//+ ":0";
        rmInbox.cfmap = new HashMap<String, List<superColumn_t>>();

        rmOutbox = new batch_mutation_super_t();
        rmOutbox.table = "Mailbox";
        rmOutbox.key = firstuser ;//+ ":1";
        rmOutbox.cfmap = new HashMap<String, List<superColumn_t>>();
      }
      column_t columnData = new column_t();
View Full Code Here

        new FileInputStream(filepath)), 16 * 1024 * 1024);
    String line = null;
    String delimiter_ = new String(",");
    String firstuser = null;
    String nextuser = null;
    batch_mutation_super_t rmInbox = null;
    batch_mutation_super_t rmOutbox = null;
    while ((line = bufReader.readLine()) != null) {
      StringTokenizer st = new StringTokenizer(line, delimiter_);
      int i = 0;
      String threadId = null;
      int lastUpdated = 0;
      int isDeleted = 0;
      int folder = 0;
      int uid =0;
      String user = null;
      String subject = null;
      String body = null;
      String authors = null;
      String participants = null;
     
      while (st.hasMoreElements()) {
        switch (i) {
        case 0:
          user = (String) st.nextElement();// sb.append((String)st.nextElement());
                    if ( !isNumeric(user))
                        continue;
         
          break;

        case 1:
          folder = Integer.parseInt((String) st.nextElement());// sb.append((String)st.nextElement());
          break;

        case 2:
          threadId = (String) st.nextElement();
          break;

        case 3:
          lastUpdated = Integer.parseInt((String) st.nextElement());
          break;

        case 4:
          isDeleted = Integer.parseInt((String) st.nextElement());// (String)st.nextElement();
          break;

        case 5:
          authors = (String) st.nextElement();
          break;

        case 6:
          participants = (String)st.nextElement();
          break;

        case 7:
          subject = (String) st.nextElement();
          break;

        case 8:
          body = (String) st.nextElement();
          break;
        default:
          st.nextElement();
          break;
        }
        ++i;
      }

      nextuser = user;
      if (firstuser == null || firstuser.compareTo(nextuser) != 0) {
        firstuser = nextuser;
        if (rmInbox != null && !rmInbox.cfmap.isEmpty()) {
          fos_.write(rmInbox.key.getBytes());
          fos_.write( System.getProperty("line.separator").getBytes());
                  counter_.incrementAndGet();
          apply(rmInbox);
        }
        if (rmOutbox != null && !rmOutbox.cfmap.isEmpty()) {
          fos_.write(rmOutbox.key.getBytes());
          fos_.write( System.getProperty("line.separator").getBytes());
                  counter_.incrementAndGet();
          apply(rmOutbox);
        }
        rmInbox = new batch_mutation_super_t();
        rmInbox.table = "Mailbox";
        rmInbox.key = firstuser ;//+ ":0";
        rmInbox.cfmap = new HashMap<String, List<superColumn_t>>();

        rmOutbox = new batch_mutation_super_t();
        rmOutbox.table = "Mailbox";
        rmOutbox.key = firstuser ;//+ ":1";
        rmOutbox.cfmap = new HashMap<String, List<superColumn_t>>();
      }
      column_t columnData = new column_t();
View Full Code Here

TOP

Related Classes of org.apache.cassandra.service.batch_mutation_super_t

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.