/** * Constructs a CellSpec instance from a CellSchema descriptor. * * @param cellSchema CellSchema record to initialize the CellSpec from. * @param schemaTable Schema table to resolve schema hashes or UIDs. * @return a new CellSpec initialized from a CellSchema descriptor. * @throws InvalidLayoutException if the cell specification is invalid. */ public static CellSpec fromCellSchema( final CellSchema cellSchema, final FijiSchemaTable schemaTable) throws InvalidLayoutException { return fromCellSchema(cellSchema) .setSchemaTable(schemaTable); }
/** * 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); }
/** * Creates a new <code>HBaseTableLayoutDatabase</code> instance. * * <p>This class does not take ownership of the HTable. The caller should close it when * it is no longer needed.</p> * * @param fijiURI URI of the Fiji instance this layout database belongs to. * @param htable The HTable used to store the layout data. * @param family The name of the column family within the HTable used to store layout data. * @param schemaTable The Fiji schema table. * @throws IOException on I/O error. */ public HBaseTableLayoutDatabase( FijiURI fijiURI, HTableInterface htable, String family, FijiSchemaTable schemaTable) throws IOException { mFijiURI = fijiURI; mTable = Preconditions.checkNotNull(htable); mFamily = Preconditions.checkNotNull(family); mFamilyBytes = Bytes.toBytes(mFamily); mSchemaTable = Preconditions.checkNotNull(schemaTable); final CellSpec cellSpec = CellSpec.fromCellSchema(CELL_SCHEMA, mSchemaTable); mCellEncoder = new AvroCellEncoder(cellSpec); mCellDecoder = SpecificCellDecoderFactory.get().create(cellSpec); }
/** * Creates a new <code>CassandraTableLayoutDatabase</code> instance. * * <p>This class does not take ownership of the table. The caller should close it when * it is no longer needed.</p> * * @param fijiURI URI of the Fiji instance this layout database belongs to. * @param admin The Cassandra cluster connection. * @param schemaTable The Fiji schema table. * @throws java.io.IOException on I/O error. */ public CassandraTableLayoutDatabase( FijiURI fijiURI, CassandraAdmin admin, FijiSchemaTable schemaTable) throws IOException { mFijiURI = fijiURI; mMetaTableName = CassandraTableName.getMetaLayoutTableName(fijiURI); mAdmin = admin; mSchemaTable = Preconditions.checkNotNull(schemaTable); final CellSpec cellSpec = CellSpec.fromCellSchema(CELL_SCHEMA, mSchemaTable); mCellEncoder = new AvroCellEncoder(cellSpec); mCellDecoder = SpecificCellDecoderFactory.get().create(cellSpec); mGetRowsStatement = getGetRowsStatement(); mRemoveAllTableLayoutVersionsStatement = getRemoveAllTableLayoutVersionsStatement(); mUpdateTableLayoutStatement = getUpdateTableLayoutStatement(); mRemoveRecentTableLayoutVersionsStatement = getRemoveRecentTableLayoutVersionsStatement(); mListTablesStatement = getListTablesStatement(); }