1515 */
1616package com .google .cloud .examples .bigtable ;
1717
18+ // [START bigtable_hw_imports_veneer]
1819import com .google .api .gax .rpc .NotFoundException ;
1920import com .google .api .gax .rpc .ServerStream ;
2021import com .google .cloud .bigtable .admin .v2 .BigtableTableAdminClient ;
2829import com .google .cloud .bigtable .data .v2 .models .RowMutation ;
2930import java .io .IOException ;
3031
32+ // [END bigtable_hw_imports_veneer]
33+
3134/**
3235 * An example of using Google Cloud Bigtable.
3336 *
@@ -66,7 +69,7 @@ public static void main(String[] args) throws Exception {
6669 public HelloWorld (String projectId , String instanceId , String tableId ) throws IOException {
6770 this .tableId = tableId ;
6871
69- // [START connecting_to_bigtable ]
72+ // [START bigtable_hw_connect_veneer ]
7073 // Creates the settings to configure a bigtable data client.
7174 BigtableDataSettings settings =
7275 BigtableDataSettings .newBuilder ().setProjectId (projectId ).setInstanceId (instanceId ).build ();
@@ -83,7 +86,7 @@ public HelloWorld(String projectId, String instanceId, String tableId) throws IO
8386
8487 // Creates a bigtable table admin client.
8588 adminClient = BigtableTableAdminClient .create (adminSettings );
86- // [END connecting_to_bigtable ]
89+ // [END bigtable_hw_connect_veneer ]
8790 }
8891
8992 public void run () throws Exception {
@@ -98,7 +101,7 @@ public void run() throws Exception {
98101
99102 /** Demonstrates how to create a table. */
100103 public void createTable () {
101- // [START creating_a_table ]
104+ // [START bigtable_hw_create_table_veneer ]
102105 // Checks if table exists, creates table if does not exist.
103106 if (!adminClient .exists (tableId )) {
104107 System .out .println ("Creating table: " + tableId );
@@ -107,12 +110,12 @@ public void createTable() {
107110 adminClient .createTable (createTableRequest );
108111 System .out .printf ("Table %s created successfully%n" , tableId );
109112 }
110- // [END creating_a_table ]
113+ // [END bigtable_hw_create_table_veneer ]
111114 }
112115
113116 /** Demonstrates how to write some rows to a table. */
114117 public void writeToTable () {
115- // [START writing_rows ]
118+ // [START bigtable_hw_write_rows_veneer ]
116119 try {
117120 System .out .println ("\n Writing some greetings to the table" );
118121 String [] greetings = {"Hello World!" , "Hello Bigtable!" , "Hello Java!" };
@@ -126,12 +129,12 @@ public void writeToTable() {
126129 } catch (NotFoundException e ) {
127130 System .err .println ("Failed to write to non-existent table: " + e .getMessage ());
128131 }
129- // [END writing_rows ]
132+ // [END bigtable_hw_write_rows_veneer ]
130133 }
131134
132135 /** Demonstrates how to read a single row from a table. */
133136 public void readSingleRow () {
134- // [START reading_a_row ]
137+ // [START bigtable_hw_get_by_key_veneer ]
135138 try {
136139 System .out .println ("\n Reading a single row by row key" );
137140 Row row = dataClient .readRow (tableId , ROW_KEY_PREFIX + 0 );
@@ -144,12 +147,12 @@ public void readSingleRow() {
144147 } catch (NotFoundException e ) {
145148 System .err .println ("Failed to read from a non-existent table: " + e .getMessage ());
146149 }
147- // [END reading_a_row ]
150+ // [END bigtable_hw_get_by_key_veneer ]
148151 }
149152
150153 /** Demonstrates how to read an entire table. */
151154 public void readTable () {
152- // [START scanning_all_rows ]
155+ // [START bigtable_hw_scan_all_veneer ]
153156 try {
154157 System .out .println ("\n Reading the entire table" );
155158 Query query = Query .create (tableId );
@@ -165,19 +168,19 @@ public void readTable() {
165168 } catch (NotFoundException e ) {
166169 System .err .println ("Failed to read a non-existent table: " + e .getMessage ());
167170 }
168- // [END scanning_all_rows ]
171+ // [END bigtable_hw_scan_all_veneer ]
169172 }
170173
171174 /** Demonstrates how to delete a table. */
172175 public void deleteTable () {
173- // [START deleting_a_table ]
176+ // [START bigtable_hw_delete_table_veneer ]
174177 System .out .println ("\n Deleting table: " + tableId );
175178 try {
176179 adminClient .deleteTable (tableId );
177180 System .out .printf ("Table %s deleted successfully%n" , tableId );
178181 } catch (NotFoundException e ) {
179182 System .err .println ("Failed to delete a non-existent table: " + e .getMessage ());
180183 }
181- // [END deleting_a_table ]
184+ // [END bigtable_hw_delete_table_veneer ]
182185 }
183186}
0 commit comments