3232import java .util .ArrayList ;
3333import java .util .List ;
3434
35+ /**
36+ * This example demonstrates the usage of BigtableTableAdminClient to create, configure and delete a
37+ * Cloud Bigtable schema bundle.
38+ *
39+ * <p>The example follows these steps:
40+ *
41+ * <ol>
42+ * <li>Creates a Bigtable table.
43+ * <li>Creates a schema bundle.
44+ * <li>Updates a schema bundle.
45+ * <li>Gets the schema bundle.
46+ * <li>Lists all schema bundles for the table.
47+ * <li>Deletes the schema bundle.
48+ * <li>Deletes the table.
49+ * </ol>
50+ */
3551public class SchemaBundleExample {
3652
3753 private static final String COLUMN_FAMILY = "cf" ;
54+ private static final String PROTO_FILE_PATH = "descriptors.pb" ;
3855 private final String tableId ;
3956 private final String schemaBundleId ;
4057 private final BigtableTableAdminClient adminClient ;
@@ -115,7 +132,7 @@ public void createSchemaBundle() {
115132 System .out .printf ("%nCreating schema bundle %s in table %s%n" , schemaBundleId , tableId );
116133 // [START bigtable_create_schema_bundle]
117134 try {
118- InputStream in = getClass ().getClassLoader ().getResourceAsStream ("descriptors.pb" );
135+ InputStream in = getClass ().getClassLoader ().getResourceAsStream (PROTO_FILE_PATH );
119136 CreateSchemaBundleRequest request =
120137 CreateSchemaBundleRequest .of (tableId , schemaBundleId )
121138 .setProtoSchema (ByteString .readFrom (in ));
@@ -136,7 +153,7 @@ public void updateSchemaBundle() {
136153 System .out .printf ("%nUpdating schema bundle %s in table %s%n" , schemaBundleId , tableId );
137154 // [START bigtable_update_schema_bundle]
138155 try {
139- InputStream in = getClass ().getClassLoader ().getResourceAsStream ("descriptors.pb" );
156+ InputStream in = getClass ().getClassLoader ().getResourceAsStream (PROTO_FILE_PATH );
140157 UpdateSchemaBundleRequest request =
141158 UpdateSchemaBundleRequest .of (tableId , schemaBundleId )
142159 .setProtoSchema (ByteString .readFrom (in ));
0 commit comments