@@ -0,0 +1,3354 @@
+/*%0A * Licensed to the Apache Software Foundation (ASF) under one%0A * or more contributor license agreements.  See the NOTICE file%0A * distributed with this work for additional information%0A * regarding copyright ownership.  The ASF licenses this file%0A * to you under the Apache License, Version 2.0 (the%0A * %22License%22); you may not use this file except in compliance%0A * with the License.  You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage org.apache.beam.sdk.io.jdbc;%0A%0Aimport com.google.auto.service.AutoService;%0Aimport java.util.Map;%0Aimport org.apache.beam.sdk.annotations.Experimental;%0Aimport org.apache.beam.sdk.annotations.Experimental.Kind;%0Aimport org.apache.beam.sdk.expansion.ExternalTransformRegistrar;%0Aimport org.apache.beam.sdk.io.jdbc.JdbcIO.DataSourceConfiguration;%0Aimport org.apache.beam.sdk.transforms.ExternalTransformBuilder;%0Aimport org.apache.beam.sdk.transforms.PTransform;%0Aimport org.apache.beam.sdk.values.PBegin;%0Aimport org.apache.beam.sdk.values.PCollection;%0Aimport org.apache.beam.sdk.values.Row;%0Aimport org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.ImmutableMap;%0A%0A/** Exposes %7B@link JdbcIO.ReadRows%7D as an external transform for cross-language usage. */%0A@Experimental(Kind.PORTABILITY)%0A@AutoService(ExternalTransformRegistrar.class)%0Apublic class JdbcReadRowsRegistrar implements ExternalTransformRegistrar %7B%0A%0A  public static final String URN = %22beam:external:java:jdbc:read_rows:v1%22;%0A%0A  @Override%0A  public Map%3CString, Class%3C? extends ExternalTransformBuilder%3E%3E knownBuilders() %7B%0A    return ImmutableMap.of(URN, JdbcReadRowsRegistrar.Builder.class);%0A  %7D%0A%0A  /** Parameters class to expose the Read transform to an external SDK. */%0A  public static class ReadConfiguration extends CrossLanguageConfiguration %7B%0A    private String query;%0A    private Integer fetchSize;%0A    private Boolean outputParallelization;%0A%0A    public void setOutputParallelization(Boolean outputParallelization) %7B%0A      this.outputParallelization = outputParallelization;%0A    %7D%0A%0A    public void setFetchSize(Integer fetchSize) %7B%0A      this.fetchSize = fetchSize;%0A    %7D%0A%0A    public void setQuery(String query) %7B%0A      this.query = query;%0A    %7D%0A  %7D%0A%0A  public static class Builder%0A      implements ExternalTransformBuilder%3CReadConfiguration, PBegin, PCollection%3CRow%3E%3E %7B%0A    @Override%0A    public PTransform%3CPBegin, PCollection%3CRow%3E%3E buildExternal(ReadConfiguration configuration) %7B%0A      DataSourceConfiguration dataSourceConfiguration = configuration.getDataSourceConfiguration();%0A%0A      JdbcIO.ReadRows readRows =%0A          JdbcIO.readRows()%0A              .withDataSourceConfiguration(dataSourceConfiguration)%0A              .withQuery(configuration.query);%0A%0A      if (configuration.fetchSize != null) %7B%0A        readRows = readRows.withFetchSize(configuration.fetchSize);%0A      %7D%0A      if (configuration.outputParallelization != null) %7B%0A        readRows = readRows.withOutputParallelization(configuration.outputParallelization);%0A      %7D%0A      return readRows;%0A    %7D%0A  %7D%0A%7D%0A

Add JdbcIO Read Cross-language transform