Package com.alvazan.orm.api.z8spi.meta

Examples of com.alvazan.orm.api.z8spi.meta.DboTableMeta


    @Override
    public AbstractCursor<IndexColumn> scanIndex(ScanInfo scan, Key from, Key to, Integer batchSize, BatchListener l, MetaLookup mgr) {
        byte[] rowKey = scan.getRowKey();
        String indexTableName = scan.getIndexColFamily();
        DboColumnMeta colMeta = scan.getColumnName();
        DboTableMeta entityDbCollection = scan.getEntityColFamily();

        // Here we don't bother using an index at all since there is no where clause to begin with
        // ALSO, we don't want this code to be the case if we are doing a CursorToMany which has to
        // use an index so check the column type
/*        if (!entityDbCollection.isVirtualCf() && from == null && to == null && !(scan.getColumnName() instanceof DboColumnToManyMeta)
View Full Code Here


            "need to alias and then define PARTITIONS p(:partitionid) SELECT etc. etc.");
    }   
   
    for(ViewInfo view : wiring.getAllViews()) {
      ViewInfoImpl t = (ViewInfoImpl) view;
      DboTableMeta meta = t.getTableMeta();
      if(meta.getPartitionedColumns().size() > 0 && t.getPartition() == null)
        throw new IllegalArgumentException("You are missing a definition of a partition for alias='"+view.getAlias()+"' since table="
      +meta.getColumnFamily()+" IS a partitioned table.  For example, you should have PARTITIONS e(:partitionId) SELECT e FROM TABLE as e....");
    }
  }
View Full Code Here

    String column = aliasedColumn.getText();
    String alias = aliasNode.getText();
    String newAlias = newAliasNode.getText();
   
    ViewInfoImpl tableInfo = wiring.getInfoFromAlias(alias);
    DboTableMeta tableMeta = tableInfo.getTableMeta();
    DboColumnMeta columnMeta = facade.getFkMetaIfExist(tableMeta, column);
    if(!(columnMeta instanceof DboColumnToOneMeta))
      throw new IllegalArgumentException("Column="+column+" on table="+tableMeta.getColumnFamily()+" is NOT a OneToOne NOR ManyToOne relationship according to our meta data");
    else if(!columnMeta.isIndexed())
      throw new IllegalArgumentException("Column="+column+" on table="+tableMeta.getColumnFamily()+" is not indexed.  Add @NoSqlIndex or map/reduce a new index in place and add annotation");
    DboColumnToOneMeta toOne = (DboColumnToOneMeta) columnMeta;
    DboTableMeta fkTableMeta = toOne.getFkToColumnFamily();

    ViewInfoImpl existing = wiring.getInfoFromAlias(newAlias);
    if(existing == null) {
      existing = new ViewInfoImpl(newAlias, fkTableMeta);
      wiring.putAliasTable(newAlias, existing);
View Full Code Here

      throw new IllegalArgumentException("In your PARTITIONS clause, you have an alias='"+alias+"' that is not found in your FROM clause");
    else if(info.getPartition() != null)
      throw new IllegalArgumentException("In your PARTITIONS clause, you define a partition for alias='"+alias+"' twice.  you can only define it once");
   
    DboColumnMeta partitionColumn;
    DboTableMeta tableMeta = info.getTableMeta();
    List<DboColumnMeta> partitionedColumns = tableMeta.getPartitionedColumns();
    if(partitionedColumns.size() == 0)
      throw new IllegalArgumentException("The meta data contains no partitions for table="+tableMeta.getColumnFamily()+" so your alias="+alias+" in your query should not be in the PARTITIONS clause.  Delete it!!!!");
    else if(child.getChildCount() > 1) {
      CommonTree columnNode = (CommonTree) child.getChild(1);
      String nameOfColumn = columnNode.getText();
      String withoutQuotes = nameOfColumn.substring(1, nameOfColumn.length()-1)
      partitionColumn = findColumn(partitionedColumns, withoutQuotes);
View Full Code Here

    // What should we add to metaQuery here
    // AND later when we do joins, we need to tell the factory
    // here as well
    String tableName = tableNode.getText();
    String targetTable = wiring.getTargetTable();
    DboTableMeta metaClass = findTable(facade, tableName);
   
    //NOTE: special case for ORM layer only NOT for ad-hoc query!!!
    if(tableName.equals("TABLE") && targetTable != null) {
      metaClass = findTable(facade, targetTable);
    } else if(metaClass == null)
View Full Code Here

   
    wiring.setMetaQueryTargetTable(metaClass);
  }

  private DboTableMeta findTable(MetaFacade facade, String tableName) {
    DboTableMeta metaClass = facade.getColumnFamily(tableName);
    return metaClass;
  }
View Full Code Here

      if(tableInfo == null)
        throw new RuntimeException("The where clause attribute="
            +textInSql+" has no alias and from clause only has tables with alias");
    }
   
    DboTableMeta metaClass = tableInfo.getTableMeta();
    //At this point, we have looked up the metaClass associated with the alias
    DboColumnMeta colMeta = facade.getColumnMeta(metaClass, columnName);
    if (colMeta == null) {
      //okay, there is no column found, but maybe the column name for the id matches(id is a special case)
      colMeta = metaClass.getIdColumnMeta();
      if(!colMeta.getColumnName().equals(columnName)) {
        List<String> names = metaClass.getColumnNameList();
        throw new IllegalArgumentException("There is no column=" + columnName + " that exists for table "
            + metaClass.getColumnFamily()+" potential columns are="+names+"  rowkey col="+colMeta.getColumnName());
      }
    }
   
    wiring.addEagerlyJoinedView(tableInfo);
    StateAttribute attr = new StateAttribute(tableInfo, colMeta, textInSql);
View Full Code Here

      return;

    if (log.isInfoEnabled())
      log.info("CREATING column family="+virtualCf+" in MongoDb database= "+db);
   
    DboTableMeta meta = loadFromInMemoryOrDb(virtualCf, ormSession);
    if (log.isInfoEnabled())
      log.info("CREATING REAL cf="+meta.getRealColumnFamily()+" (virtual CF="+meta.getRealVirtual()+")");

    createColFamilyInMongoDb(meta);
  }
View Full Code Here

  private DboTableMeta loadFromInMemoryOrDb(String virtCf, MetaLookup lookup) {
    if (log.isInfoEnabled())
      log.info("looking up meta=" + virtCf
        + " so we can add table to memory(one time operation)");
    DboTableMeta meta = dbMetaFromOrmOnly.getMeta(virtCf);
    if (meta != null) {
      if (log.isInfoEnabled())
        log.info("found meta=" + virtCf + " locally");
      return meta;
    }

    DboTableMeta table = lookup.find(DboTableMeta.class, virtCf);
    if (table == null)
      throw new IllegalArgumentException(
          "We can't load the meta for virtual or real CF="
              + virtCf
              + " because there is not meta found in DboTableMeta table");
View Full Code Here

          log.info("NEVER MIND, someone beat us to loading it into memory, it is now there=" + virtCf + "(realcf=" + cfName + ")");
          return cfNameToMongodb.get(cfName);
        }
      }

      DboTableMeta table = loadFromInMemoryOrDb(virtCf, lookup);

      String realCf = table.getRealColumnFamily();

      String realCfLower = realCf.toLowerCase();
      Info info = cfNameToMongodb.get(realCfLower);
      if (info != null) {
        if (log.isInfoEnabled())
View Full Code Here

TOP

Related Classes of com.alvazan.orm.api.z8spi.meta.DboTableMeta

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.