Github user mjsax commented on a diff in the pull request:
https://github.com/apache/flink/pull/573#discussion_r27810893
--- Diff:
flink-staging/flink-streaming/flink-storm-compatibility/src/main/java/org/apache/flink/stormcompatibility/api/FlinkTopologyContext.java
---
@@ -0,0 +1,221 @@
+/*
+ * 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.flink.stormcompatibility.api;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import backtype.storm.generated.ComponentCommon;
+import backtype.storm.generated.StormTopology;
+import backtype.storm.hooks.ITaskHook;
+import backtype.storm.metric.api.CombinedMetric;
+import backtype.storm.metric.api.ICombiner;
+import backtype.storm.metric.api.IMetric;
+import backtype.storm.metric.api.IReducer;
+import backtype.storm.metric.api.ReducedMetric;
+import backtype.storm.state.ISubscribedState;
+import backtype.storm.task.TopologyContext;
+import backtype.storm.tuple.Fields;
+import clojure.lang.Atom;
+
+
+
+
+
+/**
+ * {@link FlinkTopologyContext} is a {@link TopologyContext} that
overwrites certain method that are not applicable when
+ * a Storm topology is executed within Flink.
+ *
+ * @author mjsax
+ */
+public class FlinkTopologyContext extends TopologyContext {
+ /**
+ * The topology belonging to this context.
+ */
+ private final StormTopology topology;
+
+
+
+ /**
+ * TODO remove unused parameters...
+ *
+ * @param topology
+ * @param stormConf
+ * @param taskToComponent
+ * @param componentToSortedTasks
+ * @param componentToStreamToFields
+ * @param stormId
+ * @param codeDir
+ * @param pidDir
+ * @param taskId
+ * @param workerPort
+ * @param workerTasks
+ * @param defaultResources
+ * @param userResources
+ * @param executorData
+ * @param registeredMetrics
+ * @param openOrPrepareWasCalled
+ */
+ public FlinkTopologyContext(final StormTopology topology,
@SuppressWarnings("rawtypes") final Map stormConf,
+ final Map<Integer, String> taskToComponent, final Map<String,
List<Integer>> componentToSortedTasks,
+ final Map<String, Map<String, Fields>>
componentToStreamToFields, final String stormId, final String codeDir,
+ final String pidDir, final Integer taskId, final Integer
workerPort, final List<Integer> workerTasks,
+ final Map<String, Object> defaultResources, final Map<String,
Object> userResources,
+ final Map<String, Object> executorData,
@SuppressWarnings("rawtypes") final Map registeredMetrics,
+ final Atom openOrPrepareWasCalled) {
+ super(topology, stormConf, taskToComponent,
componentToSortedTasks, componentToStreamToFields, stormId,
+ codeDir, pidDir, taskId, workerPort, workerTasks,
defaultResources, userResources, executorData,
+ registeredMetrics, openOrPrepareWasCalled);
+ this.topology = topology;
+ }
+
+
+
+ @Override
+ public ComponentCommon getComponentCommon(final String componentId) {
+ return super.getComponentCommon(componentId);
+ // final Bolt bolt = this.topology.get_bolts().get(componentId);
+ // if(bolt != null) {
+ // return bolt.get_common();
+ // }
+ // final SpoutSpec spoutSpec =
this.topology.get_spouts().get(componentId);
--- End diff --
I prefer throwing exceptions, such that the user is aware what Storm
features are not supported. However, this class is in an pre-alpha state... It
might be necessary to add some more stuff here, to get meta-data handling right
(ie, hand an correct TopooogyContext object to Spouts/Bolts within
.open()/.prepare().
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---