Examples of ColumnDefinition


Examples of org.apache.cassandra.config.ColumnDefinition

                           : ct.types.size() - 1;
        }

        for (Map.Entry<ColumnIdentifier, AbstractType> col : columns.entrySet())
        {
            columnDefs.put(col.getKey().key, new ColumnDefinition(col.getKey().key, col.getValue(), null, null, null, componentIndex));
        }

        return columnDefs;
    }
View Full Code Here

Examples of org.apache.cassandra.config.ColumnDefinition

                ByteBuffer columnName = comparator.fromString(col.getKey().getText());
                String validatorClassName = CFPropDefs.comparators.containsKey(col.getValue())
                                          ? CFPropDefs.comparators.get(col.getValue())
                                          : col.getValue();
                AbstractType<?> validator = TypeParser.parse(validatorClassName);
                columnDefs.put(columnName, new ColumnDefinition(columnName, validator, null, null, null, null));
            }
            catch (ConfigurationException e)
            {
                InvalidRequestException ex = new InvalidRequestException(e.toString());
                ex.initCause(e);
View Full Code Here

Examples of org.apache.cassandra.config.ColumnDefinition

        if (descriptor.cfname.contains(SECONDARY_INDEX_NAME_SEPARATOR))
        {
            int i = descriptor.cfname.indexOf(SECONDARY_INDEX_NAME_SEPARATOR);
            String parentName = descriptor.cfname.substring(0, i);
            CFMetaData parent = Schema.instance.getCFMetaData(descriptor.ksname, parentName);
            ColumnDefinition def = parent.getColumnDefinitionForIndex(descriptor.cfname.substring(i + 1));
            metadata = CFMetaData.newIndexMetadata(parent, def, SecondaryIndex.getIndexComparator(parent, def));
        }
        else
        {
            metadata = Schema.instance.getCFMetaData(descriptor.ksname, descriptor.cfname);
View Full Code Here

Examples of org.apache.cassandra.config.ColumnDefinition

        rm = new RowMutation("Keyspace1", ByteBufferUtil.bytes("k1"));
        rm.add(new QueryPath("Indexed2", null, ByteBufferUtil.bytes("birthdate")), ByteBufferUtil.bytes(1L), 1);
        rm.apply();

        ColumnFamilyStore cfs = table.getColumnFamilyStore("Indexed2");
        ColumnDefinition old = cfs.metadata.getColumn_metadata().get(ByteBufferUtil.bytes("birthdate"));
        ColumnDefinition cd = new ColumnDefinition(old.name, old.getValidator(), IndexType.KEYS, null, "birthdate_index");
        Future<?> future = cfs.indexManager.addIndexedColumn(cd);
        future.get();
        // we had a bug (CASSANDRA-2244) where index would get created but not flushed -- check for that
        assert cfs.indexManager.getIndexForColumn(cd.name).getIndexCfs().getSSTables().size() > 0;
View Full Code Here

Examples of org.apache.cassandra.config.ColumnDefinition

        // future: if/when we have modifiable settings for secondary indexes,
        // they'll need to be handled here.
        Collection<ByteBuffer> indexedColumnNames = getIndexedColumns();
        for (ByteBuffer indexedColumn : indexedColumnNames)
        {
            ColumnDefinition def = baseCfs.metadata.getColumn_metadata().get(indexedColumn);
            if (def == null || def.getIndexType() == null)
                removeIndexedColumn(indexedColumn);
        }

        for (ColumnDefinition cdef : baseCfs.metadata.getColumn_metadata().values())
            if (cdef.getIndexType() != null && !indexedColumnNames.contains(cdef.name))
View Full Code Here

Examples of org.apache.cassandra.config.ColumnDefinition

   
    public void init()
    {
        assert baseCfs != null && columnDefs != null;

        ColumnDefinition columnDef = columnDefs.iterator().next();
        CFMetaData indexedCfMetadata = CFMetaData.newIndexMetadata(baseCfs.metadata, columnDef, indexComparator());
        indexCfs = ColumnFamilyStore.createColumnFamilyStore(baseCfs.table,
                                                             indexedCfMetadata.cfName,
                                                             new LocalPartitioner(columnDef.getValidator()),
                                                             indexedCfMetadata);
    }
View Full Code Here

Examples of org.apache.cassandra.config.ColumnDefinition

        if (descriptor.cfname.contains("."))
        {
            int i = descriptor.cfname.indexOf(".");
            String parentName = descriptor.cfname.substring(0, i);
            CFMetaData parent = Schema.instance.getCFMetaData(descriptor.ksname, parentName);
            ColumnDefinition def = parent.getColumnDefinitionForIndex(descriptor.cfname.substring(i + 1));
            metadata = CFMetaData.newIndexMetadata(parent, def, KeysIndex.indexComparator());
        }
        else
        {
            metadata = Schema.instance.getCFMetaData(descriptor.ksname, descriptor.cfname);
View Full Code Here

Examples of org.apache.cassandra.config.ColumnDefinition

        {
            // look up index metadata from parent
            int i = descriptor.cfname.indexOf(".");
            String parentName = descriptor.cfname.substring(0, i);
            CFMetaData parent = Schema.instance.getCFMetaData(descriptor.ksname, parentName);
            ColumnDefinition def = parent.getColumnDefinitionForIndex(descriptor.cfname.substring(i + 1));
            metadata = CFMetaData.newIndexMetadata(parent, def, KeysIndex.indexComparator());
        }
        else
        {
            metadata = Schema.instance.getCFMetaData(descriptor.ksname, descriptor.cfname);
View Full Code Here

Examples of org.encog.ml.data.versatile.columns.ColumnDefinition

   *            The column type.
   * @return The column definition
   */
  public ColumnDefinition defineSourceColumn(String name, int index,
      ColumnType colType) {
    ColumnDefinition result = new ColumnDefinition(name, colType);
    result.setIndex(index);
    addSourceColumn(result);
    return result;
  }
View Full Code Here

Examples of org.gwt.mosaic.ui.client.table.RowValue.ColumnDefinition

    SourceWriter srcWriter = composerFactory.createSourceWriter(context,
        printWriter);
    JMethod[] methods = rowValue.getMethods();
    List<JMethod> annotatedMethods = new ArrayList<JMethod>();
    for (JMethod method : methods) {
      ColumnDefinition annotation = method.getAnnotation(RowValue.ColumnDefinition.class);
      if (annotation != null) {
        annotatedMethods.add(method);
      }
    }
    Collections.sort(annotatedMethods, new Comparator<JMethod>() {
      public int compare(JMethod method1, JMethod method2) {
        return Integer.valueOf(
            method1.getAnnotation(RowValue.ColumnDefinition.class).column()).compareTo(
            Integer.valueOf(method1.getAnnotation(
                RowValue.ColumnDefinition.class).column()));
      }
    });
    // Create constructor
    srcWriter.println("public " + simpleName + "() {");
    srcWriter.indent();
    srcWriter.println("super();");
    for (JMethod method : annotatedMethods) {
      ColumnDefinition annotation = method.getAnnotation(RowValue.ColumnDefinition.class);
      String methodName = method.getName();
      String returnType = method.getReturnType().getSimpleSourceName();
      if (returnType.equals(String.class.getSimpleName())) {
        srcWriter.println("addColumnDefinition(new TextColumnDefinition<"
            + rowValue.getSimpleSourceName() + ">(\"" + annotation.header()
            + "\"," + annotation.sortable() + "," + annotation.filterable()
            + "," + annotation.editable() + ") {");
        srcWriter.indent();
        srcWriter.println("public String getCellValue("
            + rowValue.getSimpleSourceName() + " value) {");
        srcWriter.indentln("return value." + methodName + "();");
        srcWriter.println("}");
        srcWriter.outdent();
        srcWriter.println("});");
      } else if (returnType.equals(Date.class.getSimpleName())) {
        String dateTimeFormat = getDateTimeFormat(annotation.dateTimeFormat(),
            annotation.dateTimePattern());
        srcWriter.println("addColumnDefinition(new DateColumnDefinition<"
            + rowValue.getSimpleSourceName() + ">(\"" + annotation.header()
            + "\"," + dateTimeFormat + ", " + annotation.sortable() + ", "
            + annotation.filterable() + "," + annotation.editable() + ") {");
        srcWriter.indent();
        srcWriter.println("public Date getCellValue("
            + rowValue.getSimpleSourceName() + " value) {");
        srcWriter.indentln("return value." + methodName + "();");
        srcWriter.println("}");
        srcWriter.outdent();
        srcWriter.println("});");
      } else if (returnType.equals(Double.class.getSimpleName())
          || returnType.equals("double")) {
        String numberFormat = getNumberFormat(annotation.numberFormat(),
            annotation.numberPattern());
        srcWriter.println("addColumnDefinition(new NumberColumnDefinition<"
            + rowValue.getSimpleSourceName() + ">(\"" + annotation.header()
            + "\"," + numberFormat + "," + annotation.filterable() + ","
            + annotation.editable() + ") {");
        srcWriter.indent();
        srcWriter.println("public Double getCellValue("
            + rowValue.getSimpleSourceName() + " value) {");
        srcWriter.indentln("return value." + methodName + "();");
        srcWriter.println("}");
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.