Examples of NoSqlSession


Examples of com.alvazan.orm.api.z5api.NoSqlSession

    @Override
    public void run() {
      long count = 0;
     
      NoSqlEntityManager mgr = mgrFactory.createEntityManager();
      NoSqlSession session = mgr.getSession();
     
      while(shouldRun) {
       
        //let's write  rows for every flush we do..
        for(int i = 0; i < 1; i++) {
          String rowKey = UniqueKeyGenerator.generateKey();
          byte[] key = table.getIdColumnMeta().convertToStorage2(rowKey);
          List<Column> columns = createColumns(i, table);
          session.put(table, key, columns);
          count++;
        }
        addCount(count);
        count = 0;
       
        session.flush();
      }
     
      finished(threadNum);
    }
View Full Code Here

Examples of com.alvazan.orm.api.z5api.NoSqlSession

   
    mgr.flush();
   
    //Here we have to go raw and update the index ourselves with another fake PartAccount that does
    //not exist
    NoSqlSession session = mgr.getSession();
    DboTableMeta table = mgr.find(DboTableMeta.class, "PartAccount");
    DboColumnMeta colMeta = table.getColumnMeta("businessName");
    ScanInfo info = ScanInfo.createScanInfo(colMeta, null, null);
    IndexColumn col = new IndexColumn();
    col.setColumnName("businessName");
    String key = "nonexistpk";
    byte[] pk = StandardConverters.convertToBytes(key);
    byte[] value = StandardConverters.convertToBytes(acc.getBusinessName());
    col.setIndexedValue(value);
    col.setPrimaryKey(pk);
    session.persistIndex(table, info.getIndexColFamily(), info.getRowKey(), col);
   
    mgr.flush();
   
    Iterable<KeyValue<PartAccount>> all = PartAccount.findWithBizName(mgr, acc.getBusinessName());
    List keys = new ArrayList();
View Full Code Here

Examples of com.alvazan.orm.api.z5api.NoSqlSession

  @Test
  public void testDecimalColumnSlice() throws UnsupportedEncodingException {
    if (FactorySingleton.getServerType() == DbTypeEnum.HBASE )
                return; // This testcase is not supported for Hbase
        NoSqlSession session = mgr.getSession();
    String colFamily = "float_indexes";
   
    DboDatabaseMeta meta = mgr.find(DboDatabaseMeta.class, DboDatabaseMeta.META_DB_ROWKEY);

    DboTableMeta tableMeta = new DboTableMeta();
    tableMeta.setup(null, colFamily, false, false);
    tableMeta.setColNameType(double.class);
   
    DboColumnIdMeta idMeta = new DboColumnIdMeta();
    idMeta.setup(tableMeta, "id", String.class, false);
   
    mgr.put(idMeta);
    mgr.put(tableMeta);

    meta.addMetaClassDbo(tableMeta);
    mgr.put(meta);
   
    mgr.flush();
   
    byte[] rowKey = StandardConverters.convertToBytes("myone_index");
   
    List<Column> columns = new ArrayList<Column>();
   
    columns.add(new Column(toDecBytes(5000.5), new byte[0]));
    columns.add(new Column(toDecBytes(20.333), new byte[0]));
    columns.add(new Column(toDecBytes(200.1111111111111), new byte[0]));
    columns.add(new Column(toDecBytes(10.9999999999999999999999999), new byte[0]));
    columns.add(new Column(toDecBytes(60.5), new byte[0]));
    columns.add(new Column(toDecBytes(700), new byte[0]));
    columns.add(new Column(toDecBytes(500023432430.44), new byte[0]));
    columns.add(new Column(toDecBytes(550.32), new byte[0]));
    columns.add(new Column(toDecBytes(340), new byte[0]));
    columns.add(new Column(toDecBytes(40.5), new byte[0]));
    columns.add(new Column(toDecBytes(-40.8888888888888888), new byte[0]));
    columns.add(new Column(toDecBytes(-200.23), new byte[0]));
    columns.add(new Column(toDecBytes(-500), new byte[0]));
    columns.add(new Column(toDecBytes(new BigDecimal("123000111222333444555666.66666666")), new byte[0]));
    columns.add(new Column(toDecBytes(new BigDecimal("-123000111222333444555666.888888")), new byte[0]));
    columns.add(new Column(toDecBytes(new BigDecimal("3")), new byte[0]));
    columns.add(new Column(toDecBytes(new BigDecimal("-3")), new byte[0]));
   
    session.put(tableMeta, rowKey, columns);
    session.flush();

    byte[] from = toDecBytes(-250);
    byte[] to = toDecBytes(12);
    Cursor<Column> results = session.columnSlice(tableMeta, rowKey, from, to, 2, BigDecimal.class);//(scanInfo, from, to, 2);
   
    int counter = 0;
    while(results.next()) {
      Column col = results.getCurrent();
      if(counter == 0) {
View Full Code Here

Examples of com.alvazan.orm.api.z5api.NoSqlSession

    Assert.assertEquals(5, counter);   
  }

  @Test
  public void testIntegerColumnSlice() throws UnsupportedEncodingException {
    NoSqlSession session = mgr.getSession();
    String colFamily = "time_indexes";
   
    DboDatabaseMeta meta = mgr.find(DboDatabaseMeta.class, DboDatabaseMeta.META_DB_ROWKEY);

    DboTableMeta tableMeta = new DboTableMeta();
    tableMeta.setup(null, colFamily, false, false);
    tableMeta.setColNameType(long.class);
   
    DboColumnIdMeta idMeta = new DboColumnIdMeta();
    idMeta.setup(tableMeta, "id", String.class, false);
   
    mgr.put(idMeta);
    mgr.put(tableMeta);

    meta.addMetaClassDbo(tableMeta);
    mgr.put(meta);
   
    mgr.flush();
   
    byte[] rowKey = StandardConverters.convertToBytes("myone_index");
   
    List<Column> columns = new ArrayList<Column>();
   
    columns.add(new Column(toIntBytes(500), new byte[0]));
    columns.add(new Column(toIntBytes(20), new byte[0]));
    columns.add(new Column(toIntBytes(200), new byte[0]));
    columns.add(new Column(toIntBytes(10), new byte[0]));
    columns.add(new Column(toIntBytes(60), new byte[0]));
    columns.add(new Column(toIntBytes(700), new byte[0]));
    columns.add(new Column(toIntBytes(500023432430L), new byte[0]));
    columns.add(new Column(toIntBytes(550), new byte[0]));
    columns.add(new Column(toIntBytes(340), new byte[0]));
    columns.add(new Column(toIntBytes(40), new byte[0]));
    columns.add(new Column(toIntBytes(-40), new byte[0]));
    columns.add(new Column(toIntBytes(-200), new byte[0]));
    columns.add(new Column(toIntBytes(-500), new byte[0]));
    columns.add(new Column(toIntBytes(new BigInteger("123000111222333444555666")), new byte[0]));
    columns.add(new Column(toIntBytes(new BigInteger("-123000111222333444555666")), new byte[0]));
    columns.add(new Column(toIntBytes(new BigInteger("3")), new byte[0]));
    columns.add(new Column(toIntBytes(new BigInteger("-3")), new byte[0]));
   
    session.put(tableMeta, rowKey, columns);
    session.flush();

    byte[] from = toIntBytes(-250);
    byte[] to = toIntBytes(50);
    Cursor<Column> results = session.columnSlice(tableMeta, rowKey, from, to, 2, BigInteger.class);
   
    int counter = 0;
    while(results.next()) {
      Column col = results.getCurrent();
      if(counter == 0)
View Full Code Here

Examples of com.alvazan.orm.api.z5api.NoSqlSession

    @Override
    public void run() {
      long count = 0;
     
      NoSqlEntityManager mgr = mgrFactory.createEntityManager();
      NoSqlSession session = mgr.getSession();
     
      while(shouldRun) {
       
        //let's write  rows for every flush we do..
        for(int i = 0; i < 1; i++) {
          String rowKey = UniqueKeyGenerator.generateKey();
          byte[] key = table.getIdColumnMeta().convertToStorage2(rowKey);
          List<Column> columns = createColumns(i, table);
          session.put(table, key, columns);
          count++;
        }
        addCount(count);
        count = 0;
       
        session.flush();
      }
     
      finished(threadNum);
    }
View Full Code Here

Examples of com.alvazan.orm.api.z5api.NoSqlSession

    @Override
    public void run() {
      long count = 0;
     
      NoSqlEntityManager mgr = mgrFactory.createEntityManager();
      NoSqlSession session = mgr.getSession();
     
      while(shouldRun) {
       
        //let's write  rows for every flush we do..
        for(int i = 0; i < 1; i++) {
          String rowKey = UniqueKeyGenerator.generateKey();
          byte[] key = table.getIdColumnMeta().convertToStorage2(rowKey);
          List<Column> columns = createColumns(i, table);
          session.put(table, key, columns);
          count++;
        }
        addCount(count);
        count = 0;
       
        session.flush();
      }
     
      finished(threadNum);
    }
View Full Code Here

Examples of com.alvazan.orm.api.z5api.NoSqlSession

    @Override
    public void run() {
      long count = 0;
     
      NoSqlEntityManager mgr = mgrFactory.createEntityManager();
      NoSqlSession session = mgr.getSession();
     
      while(shouldRun) {
       
        //let's write  rows for every flush we do..
        for(int i = 0; i < 1; i++) {
          String rowKey = UniqueKeyGenerator.generateKey();
          byte[] key = table.getIdColumnMeta().convertToStorage2(rowKey);
          List<Column> columns = createColumns(i, table);
          session.put(table, key, columns);
          count++;
        }
        addCount(count);
        count = 0;
       
        session.flush();
      }
     
      finished(threadNum);
    }
View Full Code Here

Examples of org.eclipse.jetty.nosql.NoSqlSession

        protected void doGet(HttpServletRequest request, HttpServletResponse httpServletResponse) throws ServletException, IOException
        {
            String action = request.getParameter("action");
            if ("init".equals(action))
            {
                NoSqlSession session = (NoSqlSession)request.getSession(true);
                session.setAttribute("test",System.currentTimeMillis());
                session.setAttribute("objectTest", new Pojo("foo","bar"));
               
                sendResult(session,httpServletResponse.getWriter());
               
            }
            else
            {
                NoSqlSession session = (NoSqlSession)request.getSession(false);
                if (session != null)
                {
                    long value = System.currentTimeMillis();
                    session.setAttribute("test",value);

                }

                sendResult(session,httpServletResponse.getWriter());

                Pojo p = (Pojo)session.getAttribute("objectTest");
               
                //System.out.println(p.getName() + " / " + p.getValue() );
            }

        }
View Full Code Here

Examples of org.eclipse.jetty.nosql.NoSqlSession

        protected void doGet(HttpServletRequest request, HttpServletResponse httpServletResponse) throws ServletException, IOException
        {
            String action = request.getParameter("action");
            if ("init".equals(action))
            {
                NoSqlSession session = (NoSqlSession)request.getSession(true);
                session.setAttribute("a.b.c",System.currentTimeMillis());              
                sendResult(session,httpServletResponse.getWriter());
               
            }
            else
            {
                NoSqlSession session = (NoSqlSession)request.getSession(false);
                assertNotNull(session);    
                assertNotNull(session.getAttribute("a.b.c"));
                sendResult(session,httpServletResponse.getWriter());
            }

        }
View Full Code Here

Examples of org.eclipse.jetty.nosql.NoSqlSession

        {
            Object version = o.get(getContextAttributeKey(__VERSION));
            Long created = (Long)o.get(__CREATED);
            Long accessed = (Long)o.get(__ACCESSED);
         
            NoSqlSession session = null;

            // get the session for the context
            DBObject attrs = (DBObject)getNestedValue(o,getContextKey());

            __log.debug("MongoSessionManager:attrs {}", attrs);
            if (attrs != null)
            {
                __log.debug("MongoSessionManager: session {} present for context {}", clusterId, getContextKey());
                //only load a session if it exists for this context
                session = new NoSqlSession(this,created,accessed,clusterId,version);
               
                for (String name : attrs.keySet())
                {
                    //skip special metadata attribute which is not one of the actual session attributes
                    if ( __METADATA.equals(name) )
                        continue;
                   
                    String attr = decodeName(name);
                    Object value = decodeValue(attrs.get(name));

                    session.doPutOrRemove(attr,value);
                    session.bindValue(attr,value);
                }
                session.didActivate();
            }
            else
                __log.debug("MongoSessionManager: session  {} not present for context {}",clusterId, getContextKey());       

            return session;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.