/** * Reports the specification of the specified column. * * @param column Column to report the specification of. * @return the specification for the specified column. * @throws IOException on I/O error. */ public CellSpec getCellSpec(FijiColumnName column) throws IOException { return CellSpec.fromCellSchema(getCellSchema(column)) .setSchemaTable(mSchemaTable); }
/** @return whether this is a map-type family. */ public boolean isMapType() { return !isGroupType(); } } // class FamilyLayout
/** {@inheritDoc} */ @Override public HBaseColumnName getHBaseColumnName( final FijiColumnName fijiColumnName ) throws NoSuchColumnException { return mTranslator.toHBaseColumnName(fijiColumnName); } }
/** {@inheritDoc} */ @Override public byte[] getHBaseCellValue(FijiColumnName column, DecodedCell<?> fijiCell) throws IOException { final CellSpec cellSpec = mColumnNameTranslator.getTableLayout().getCellSpec(column) .setSchemaTable(mSchemaTable); final FijiCellEncoder encoder = DefaultFijiCellEncoderFactory.get().create(cellSpec); return encoder.encode(fijiCell); } }
/** {@inheritDoc} */ @Override public Schema getReaderSchema(final String family, final String qualifier) throws IOException { return mTableLayout.getCellSpec(FijiColumnName.create(family, qualifier)).getAvroSchema(); }
/** * Constructs a CellSpec instance from a CellSchema descriptor. * * @param cellSchema CellSchema record to initialize the CellSpec from. * @return a new CellSpec initialized from the given CellSchema descriptor. * @throws InvalidLayoutException if the cell specification is invalid. */ public static CellSpec fromCellSchema(final CellSchema cellSchema) throws InvalidLayoutException { return new CellSpec() .setCellSchema(cellSchema); }
/** * Lists the reader schemas registered for the specified column. * * @param columnName whose schemas to list. * @return The list of schemas. * Returns empty list if schema validation was not previously enabled. * @throws IOException if the cellSchema of the column can not be acquired. */ public Collection<Schema> getRegisteredReaders(final FijiColumnName columnName) throws IOException { return getRegisteredSchemas(columnName, SchemaRegistrationType.READER); }
/** * Initializes a layout builder with no reference layout. * * @param schemaTable Table to resolve Avro schemas. * @throws IOException on I/O error. */ public TableLayoutBuilder(FijiSchemaTable schemaTable) throws IOException { mSchemaTable = schemaTable; mSchemaResolver = new SchemaTableAvroResolver(schemaTable); mDescBuilder = null; }
/** * Register a writer schema to a column. * * @param columnName at which to register the schema. * @param schema to register. * @throws IOException If the parameters are invalid. * @return this. */ public TableLayoutBuilder withWriter( final FijiColumnName columnName, final Schema schema) throws IOException { return withSchema(columnName, schema, SchemaRegistrationType.WRITER); }
/** * Unregister a writer schema to a column. * * @param columnName at which to unregister the schema. * @param schema to unregister. * @throws IOException If the parameters are invalid. * @return this. */ public TableLayoutBuilder withoutWriter( final FijiColumnName columnName, final Schema schema) throws IOException { return withoutSchema(columnName, schema, SchemaRegistrationType.WRITER); }
/** * Returns a new unspecified CellSpec. * * <p> Use the setters to populate the necessary fields. </p> * * @return a new unspecified CellSpec. */ public static CellSpec create() { return new CellSpec(); }
/** * Creates and returns a new FijiTableLayout instance as specified by an Avro TableLayoutDesc * description record. * * @param layout The Avro TableLayoutDesc descriptor record that describes the actual layout. * of the table. * @return A new table layout. * @throws InvalidLayoutException If the descriptor is invalid. */ public static FijiTableLayout newLayout(TableLayoutDesc layout) throws InvalidLayoutException { return new FijiTableLayout(layout, null); }
/** {@inheritDoc} */ @Override public Schema getReaderSchema(final String family, final String qualifier) throws IOException { return mLayout.getCellSpec(FijiColumnName.create(family, qualifier)).getAvroSchema(); }
/** {@inheritDoc} */ @Override public HBaseColumnName getHBaseColumnName(FijiColumnName fijiColumnName) throws NoSuchColumnException { return mColumnNameTranslator.toHBaseColumnName(fijiColumnName); }
/** * List the written schemas recorded for the specified column. * * @param columnName whose schemas to list. * @return The list of schemas. * Returns empty list if schema validation was not previously enabled. * @throws IOException if the cellSchema of the column can not be acquired. */ public Collection<Schema> getRegisteredWritten(final FijiColumnName columnName) throws IOException { return getRegisteredSchemas(columnName, SchemaRegistrationType.WRITTEN); }
/** * Sets the Schema table used to resolve Avro schemas. * * <p> Also sets the Avro schema resolver. </p> * * @param schemaTable Schema table to resolve Avro schemas. * @return this CellSpec. */ public CellSpec setSchemaTable(final FijiSchemaTable schemaTable) { mSchemaTable = schemaTable; mAvroSchemaResolver = new SchemaTableAvroResolver(mSchemaTable); return this; }
/** * Register a written schema to a column. * * @param columnName at which to register the schema. * @param schema to register. * @throws IOException If the parameters are invalid. * @return this. */ public TableLayoutBuilder withWritten( final FijiColumnName columnName, final Schema schema) throws IOException { return withSchema(columnName, schema, SchemaRegistrationType.WRITTEN); }
/** * Unregister a written schema to a column. * * @param columnName at which to unregister the schema. * @param schema to unregister. * @throws IOException If the parameters are invalid. * @return this. */ public TableLayoutBuilder withoutWritten( final FijiColumnName columnName, final Schema schema) throws IOException { return withoutSchema(columnName, schema, SchemaRegistrationType.WRITTEN); }
/** * Lists the writer schemas registered for the specified column. * * @param columnName whose schemas to list. * @return The list of schemas. * Returns empty list if schema validation was not previously enabled. * @throws IOException if the cellSchema of the column can not be acquired. */ public Collection<Schema> getRegisteredWriters(final FijiColumnName columnName) throws IOException { return getRegisteredSchemas(columnName, SchemaRegistrationType.WRITER); }