001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019package org.apache.reef.driver.task; 020 021import org.apache.reef.annotations.Provided; 022import org.apache.reef.annotations.audience.DriverSide; 023import org.apache.reef.annotations.audience.Public; 024import org.apache.reef.runtime.common.evaluator.task.defaults.DefaultCloseHandler; 025import org.apache.reef.runtime.common.evaluator.task.defaults.DefaultDriverMessageHandler; 026import org.apache.reef.runtime.common.evaluator.task.defaults.DefaultSuspendHandler; 027import org.apache.reef.tang.annotations.Name; 028import org.apache.reef.tang.annotations.NamedParameter; 029import org.apache.reef.task.TaskMessageSource; 030import org.apache.reef.task.events.*; 031import org.apache.reef.wake.EventHandler; 032 033import java.util.Set; 034 035/** 036 * Configuration parameters for the TaskConfiguration class. 037 */ 038@Public 039@DriverSide 040@Provided 041public final class TaskConfigurationOptions { 042 043 /** 044 * The Identifier of the Task. 045 */ 046 @NamedParameter(default_value = "Unnamed Task", doc = "The Identifier of the Task") 047 public static final class Identifier implements Name<String> { 048 } 049 050 /** 051 * The memento to be used for the Task. 052 */ 053 @NamedParameter(doc = "The memento to be used for the Task.") 054 public final class Memento implements Name<String> { 055 } 056 057 /** 058 * TaskMessageSource instances. 059 */ 060 @NamedParameter(doc = "TaskMessageSource instances.") 061 public final class TaskMessageSources implements Name<Set<TaskMessageSource>> { 062 } 063 064 /** 065 * The set of event handlers for the TaskStart event. 066 */ 067 @NamedParameter(doc = "The set of event handlers for the TaskStart event.") 068 public final class StartHandlers implements Name<Set<EventHandler<TaskStart>>> { 069 } 070 071 /** 072 * The set of event handlers for the TaskStop event. 073 */ 074 @NamedParameter(doc = "The set of event handlers for the TaskStop event.") 075 public final class StopHandlers implements Name<Set<EventHandler<TaskStop>>> { 076 } 077 078 /** 079 * The event handler that receives the close event. 080 */ 081 @NamedParameter(doc = "The event handler that receives the close event.", 082 default_class = DefaultCloseHandler.class) 083 public final class CloseHandler implements Name<EventHandler<CloseEvent>> { 084 } 085 086 /** 087 * The event handler that receives the suspend event. 088 */ 089 @NamedParameter(doc = "The event handler that receives the suspend event.", 090 default_class = DefaultSuspendHandler.class) 091 public final class SuspendHandler implements Name<EventHandler<SuspendEvent>> { 092 } 093 094 /** 095 * The event handler that receives messages from the driver. 096 */ 097 @NamedParameter(doc = "The event handler that receives messages from the driver.", 098 default_class = DefaultDriverMessageHandler.class) 099 public final class MessageHandler implements Name<EventHandler<DriverMessage>> { 100 } 101}