Package me.prettyprint.cassandra.model

Examples of me.prettyprint.cassandra.model.BasicColumnFamilyDefinition


    this.hostName = keyspace.getAttributeValue(HOST_ATTRIBUTE);
   
    // load column family definitions
    List<Element> elements = keyspace.getChildren();
    for (Element element: elements) {
      BasicColumnFamilyDefinition cfDef = new BasicColumnFamilyDefinition();
     
      String familyName = element.getAttributeValue(NAME_ATTRIBUTE);
     
      String superAttribute = element.getAttributeValue(SUPER_ATTRIBUTE);
      if (superAttribute != null) {
        this.superFamilies.add(familyName);
        cfDef.setColumnType(ColumnType.SUPER);
        cfDef.setSubComparatorType(ComparatorType.UTF8TYPE);
      }
     
      cfDef.setKeyspaceName(this.keyspaceName);
      cfDef.setName(familyName);
      cfDef.setComparatorType(ComparatorType.UTF8TYPE);
      cfDef.setDefaultValidationClass(ComparatorType.UTF8TYPE.getClassName());
     
      this.columnFamilyDefinitions.put(familyName, cfDef);

    }
   
    // load column definitions   
    Element mapping = root.getChild(MAPPING_ELEMENT);
    elements = mapping.getChildren();
    for (Element element: elements) {
      String fieldName = element.getAttributeValue(NAME_ATTRIBUTE);
      String familyName = element.getAttributeValue(FAMILY_ATTRIBUTE);
      String columnName = element.getAttributeValue(COLUMN_ATTRIBUTE);
      BasicColumnFamilyDefinition columnFamilyDefinition = this.columnFamilyDefinitions.get(familyName);
      if (columnFamilyDefinition == null) {
        LOG.warn("Family " + familyName + " was not declared in the keyspace.");
      }
     
      this.familyMap.put(fieldName, familyName);
View Full Code Here


    }
   
    // load column family definitions
    List<Element> elements = keyspace.getChildren();
    for (Element element: elements) {
      BasicColumnFamilyDefinition cfDef = new BasicColumnFamilyDefinition();
     
      String familyName = element.getAttributeValue(NAME_ATTRIBUTE);
      if (familyName == null) {
        LOG.error("Error locating column family name attribute!");
        continue;
      } else {
        if (LOG.isDebugEnabled()) {
          LOG.debug("Located column family: '" + familyName + "'" );
        }
      }
      String gcgrace_scs = element.getAttributeValue(GCGRACE_SECONDS_ATTRIBUTE);
      if (gcgrace_scs == null) {
        LOG.warn("Error locating gc_grace_seconds attribute for '" + familyName + "' column family");
        LOG.warn("Using default set to: " + DEFAULT_GCGRACE_SECONDS);
      } else {
        if (LOG.isDebugEnabled()) {
        LOG.debug("Located gc_grace_seconds: '" + gcgrace_scs + "'" );
        }
      }

      String superAttribute = element.getAttributeValue(SUPER_ATTRIBUTE);
      if (superAttribute != null) {
        if (LOG.isDebugEnabled()) {
          LOG.debug("Located super column family");
        }
        this.superFamilies.add(familyName);
        if (LOG.isDebugEnabled()) {
          LOG.debug("Added super column family: '" + familyName + "'");
        }
        cfDef.setColumnType(ColumnType.SUPER);
        cfDef.setSubComparatorType(ComparatorType.BYTESTYPE);
      }

      cfDef.setKeyspaceName(this.keyspaceName);
      cfDef.setName(familyName);
      cfDef.setComparatorType(ComparatorType.BYTESTYPE);
      cfDef.setDefaultValidationClass(ComparatorType.BYTESTYPE.getClassName());

      cfDef.setGcGraceSeconds(gcgrace_scs!=null?Integer.parseInt(gcgrace_scs):DEFAULT_GCGRACE_SECONDS);
      this.columnFamilyDefinitions.put(familyName, cfDef);

    }
   
    // load column definitions   
    elements = mapping.getChildren();
    for (Element element: elements) {
      String fieldName = element.getAttributeValue(NAME_ATTRIBUTE);
      String familyName = element.getAttributeValue(FAMILY_ATTRIBUTE);
      String columnName = element.getAttributeValue(COLUMN_ATTRIBUTE);
      String ttlValue = element.getAttributeValue(COLUMNS_TTL_ATTRIBUTE);
      if (fieldName == null) {
       LOG.error("Field name is not declared.");
        continue;
      }
      if (familyName == null) {
        LOG.error("Family name is not declared for \"" + fieldName + "\" field.");
        continue;
      }
      if (columnName == null) {
        LOG.warn("Column name (qualifier) is not declared for \"" + fieldName + "\" field.");
        columnName = fieldName;
      }
      if (ttlValue == null) {
        LOG.warn("TTL value is not defined for \"" + fieldName + "\" field. \n Using default value: " + DEFAULT_COLUMNS_TTL);
      }

      BasicColumnFamilyDefinition columnFamilyDefinition = this.columnFamilyDefinitions.get(familyName);
      if (columnFamilyDefinition == null) {
        LOG.warn("Family " + familyName + " was not declared in the keyspace.");
      }

      this.familyMap.put(fieldName, familyName);
View Full Code Here

            keyspace = HFactory.createKeyspace(getProperties().getProperty("schema"), cluster, new AllOneConsistencyLevelPolicy());
            if (createKeyspace == null)
            {

                // Define column family...
                BasicColumnFamilyDefinition columnFamilyDefinition = new BasicColumnFamilyDefinition();
                columnFamilyDefinition.setKeyspaceName(getProperties().getProperty("schema"));
                columnFamilyDefinition.setName(column_family);

                ColumnFamilyDefinition cfDefStandard = new ThriftCfDef(columnFamilyDefinition);

                KeyspaceDefinition keyspaceDefinition = HFactory.createKeyspaceDefinition(getProperties().getProperty("schema"),
                        "org.apache.cassandra.locator.SimpleStrategy", 1, Arrays.asList(cfDefStandard));
View Full Code Here

TOP

Related Classes of me.prettyprint.cassandra.model.BasicColumnFamilyDefinition

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.