1/*2 * Licensed to the Apache Software Foundation (ASF) under one3 * or more contributor license agreements. See the NOTICE file4 * distributed with this work for additional information5 * regarding copyright ownership. The ASF licenses this file6 * to you under the Apache License, Version 2.0 (the7 * "License"); you may not use this file except in compliance8 * with the License. You may obtain a copy of the License at9 *10 * http://www.apache.org/licenses/LICENSE-2.011 *12 * Unless required by applicable law or agreed to in writing, software13 * distributed under the License is distributed on an "AS IS" BASIS,14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.15 * See the License for the specific language governing permissions and16 * limitations under the License.17 */18package org.apache.giraph.block_app.framework.output;
1920import org.apache.giraph.block_app.framework.api.BlockOutputApi;
21import org.apache.giraph.conf.GiraphConfiguration;
2223/**24 * Block output option, with apis to use from application code25 *26 * @param <OD> Output description type27 * @param <OW> Output writer type28 */29publicclass BlockOutputOption<OD extends BlockOutputDesc<OW>,
30 OW extends BlockOutputWriter> {
31privatefinal String key;
3233publicBlockOutputOption(String key) {
34this.key = key;
35 }
3637public String getKey() {
38return key;
39 }
4041publicvoid register(OD outputDesc, GiraphConfiguration conf) {
42 BlockOutputFormat.addOutputDesc(outputDesc, key, conf);
43 }
4445public OD getOutputDesc(BlockOutputApi outputApi) {
46return outputApi.<OW, OD>getOutputDesc(key);
47 }
4849public OW getWriter(BlockOutputApi outputApi) {
50return outputApi.getWriter(key);
51 }
52 }