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.wake.remote;
020
021import org.apache.reef.tang.annotations.Name;
022import org.apache.reef.tang.annotations.NamedParameter;
023import org.apache.reef.wake.EStage;
024import org.apache.reef.wake.EventHandler;
025import org.apache.reef.wake.remote.impl.DefaultTransportEStage;
026import org.apache.reef.wake.remote.impl.ObjectSerializableCodec;
027import org.apache.reef.wake.remote.impl.TransportEvent;
028
029/**
030 * Configuration options and helper methods for Wake remoting.
031 */
032public final class RemoteConfiguration {
033
034  @NamedParameter(short_name = "rm_name", doc = "The name of the remote manager.", default_value = "REEF_CLIENT")
035  public static final class ManagerName implements Name<String> {
036    // Intentionally empty
037  }
038
039  @NamedParameter(short_name = "rm_host", doc = "The host address to be used for messages.",
040      default_value = "##UNKNOWN##")
041  public static final class HostAddress implements Name<String> {
042    // Intentionally empty
043  }
044
045  @NamedParameter(short_name = "rm_port", doc = "The port to be used for messages.", default_value = "0")
046  public static final class Port implements Name<Integer> {
047    // Intentionally empty
048  }
049
050  @NamedParameter(doc = "The codec to be used for messages.", default_class = ObjectSerializableCodec.class)
051  public static final class MessageCodec implements Name<Codec<?>> {
052    // Intentionally empty
053  }
054
055  @NamedParameter(doc = "The event handler to be used for throwables", default_class = DefaultErrorHandler.class)
056  public static final class ErrorHandler implements Name<EventHandler<Throwable>> {
057    // Intentionally empty
058  }
059
060  @NamedParameter(short_name = "rm_order",
061      doc = "Whether or not to use the message ordering guarantee", default_value = "true")
062  public static final class OrderingGuarantee implements Name<Boolean> {
063    // Intentionally empty
064  }
065
066  @NamedParameter(doc = "The number of tries", default_value = "3")
067  public static final class NumberOfTries implements Name<Integer> {
068    // Intentionally empty    
069  }
070
071  @NamedParameter(doc = "The timeout of connection retrying", default_value = "10000")
072  public static final class RetryTimeout implements Name<Integer> {
073    // Intentionally empty       
074  }
075
076  @NamedParameter(doc = "Client stage for messaging transport", default_class = DefaultTransportEStage.class)
077  public static final class RemoteClientStage implements Name<EStage<TransportEvent>> {
078    // Intentionally empty
079  }
080
081  @NamedParameter(doc = "Server stage for messaging transport", default_class = DefaultTransportEStage.class)
082  public static final class RemoteServerStage implements Name<EStage<TransportEvent>> {
083    // Intentionally empty
084  }
085}