[
https://issues.apache.org/jira/browse/BEAM-14081?focusedWorklogId=753908&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-753908
]
ASF GitHub Bot logged work on BEAM-14081:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 07/Apr/22 08:51
Start Date: 07/Apr/22 08:51
Worklog Time Spent: 10m
Work Description: Amar3tto commented on code in PR #17104:
URL: https://github.com/apache/beam/pull/17104#discussion_r844884509
##########
sdks/java/io/cdap/src/main/java/org/apache/beam/sdk/io/cdap/context/BatchContextImpl.java:
##########
@@ -0,0 +1,220 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.beam.sdk.io.cdap.context;
+
+import io.cdap.cdap.api.data.DatasetInstantiationException;
+import io.cdap.cdap.api.data.schema.Schema;
+import io.cdap.cdap.api.dataset.Dataset;
+import io.cdap.cdap.api.dataset.DatasetManagementException;
+import io.cdap.cdap.api.dataset.DatasetProperties;
+import io.cdap.cdap.api.metadata.Metadata;
+import io.cdap.cdap.api.metadata.MetadataEntity;
+import io.cdap.cdap.api.metadata.MetadataException;
+import io.cdap.cdap.api.metadata.MetadataScope;
+import io.cdap.cdap.api.plugin.PluginProperties;
+import io.cdap.cdap.etl.api.FailureCollector;
+import io.cdap.cdap.etl.api.Lookup;
+import io.cdap.cdap.etl.api.StageMetrics;
+import io.cdap.cdap.etl.api.action.SettableArguments;
+import io.cdap.cdap.etl.api.batch.BatchContext;
+import io.cdap.cdap.etl.api.lineage.field.FieldOperation;
+import java.net.URL;
+import java.sql.Timestamp;
+import java.util.List;
+import java.util.Map;
+import javax.annotation.Nullable;
+
+/**
+ * Class OperationContext is a common class for Batch, Sink and Stream CDAP
wrapper classes that use
+ * it to provide common details.
+ */
+@SuppressWarnings({"TypeParameterUnusedInFormals", "nullness"})
+public class BatchContextImpl implements BatchContext {
+
+ private final FailureCollectorWrapper failureCollector = new
FailureCollectorWrapper();
+
+ private final Timestamp startTime = new
Timestamp(System.currentTimeMillis());
+
+ @Override
+ public String getStageName() {
+ return null;
Review Comment:
For now, this class only provides `FailureCollectorWrapper` and stubs all
other methods as they are only needed for the CDAP environment.
Yes, it can be abstract, because we are only supposed to create objects of
its child classes.
Issue Time Tracking
-------------------
Worklog Id: (was: 753908)
Time Spent: 6h 40m (was: 6.5h)
> [CdapIO] Design and implement Context wrapper class
> ---------------------------------------------------
>
> Key: BEAM-14081
> URL: https://issues.apache.org/jira/browse/BEAM-14081
> Project: Beam
> Issue Type: Task
> Components: io-java-cdap
> Reporter: Elizaveta Lomteva
> Assignee: Igor Krasavin
> Priority: P2
> Labels: cdap-io-sprint-2
> Time Spent: 6h 40m
> Remaining Estimate: 0h
>
> h3. Context:
> CDAP plugins use context classes (ex.
> {{{}io.cdap.cdap.etl.api.batch.BatchSourceContext{}}}) to provide the updates
> and support additional logic (ex.
> [FailureCollector|https://github.com/data-integrations/salesforce/blob/d0d83fd82bbdbbb7ef07168f3b1698eebdc90c3e/src/main/java/io/cdap/plugin/salesforce/plugin/source/batch/SalesforceBatchSource.java#L96]
> or [getting
> timestamp|https://github.com/data-integrations/salesforce/blob/d0d83fd82bbdbbb7ef07168f3b1698eebdc90c3e/src/main/java/io/cdap/plugin/salesforce/plugin/source/batch/SalesforceBatchSource.java#L111])
> in Source or Sink class methods (ex. {{{}SalesforceBatchSink{}}}).
> h3. Task Description:
> Required to design wrapper class(es) (it could be an heir of the original
> class) for the CDAP context classes so that the CDAP context instance can be
> created in the Apache Beam connector and used when calling the Source/Sink
> methods that require the context as an argument (ex.
> {{prepareRun(BatchSinkContext context)}}
> [method|https://github.com/data-integrations/salesforce/blob/d0d83fd82bbdbbb7ef07168f3b1698eebdc90c3e/src/main/java/io/cdap/plugin/salesforce/plugin/sink/batch/SalesforceBatchSink.java#L67]).
> h3. Acceptance criteria:
> Class diagram and source code of CDAP context logic wrapper class(es) that
> will provide an original context class logic
--
This message was sent by Atlassian Jira
(v8.20.1#820001)