All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.intel.jndn.utils.server.DynamicServer Maven / Gradle / Ivy

Go to download

Collection of tools to simplify synchronous and asynchronous data transfer over the NDN network

There is a newer version: 1.1.1
Show newest version
/*
 * jndn-utils
 * Copyright (c) 2015, Intel Corporation.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms and conditions of the GNU Lesser General Public License,
 * version 3, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
 * more details.
 */
package com.intel.jndn.utils.server;

import com.intel.jndn.utils.Server;

import java.io.IOException;

/**
 * Defines the API for a {@link Server} producing data packets
 * dynamically; in other words, when an interest arrives, this server
 * will run a callback to determine what packet to send back. As good practice,
 * keep callback methods as short as possible.
 *
 * @author Andrew Brown, [email protected]
 */
public interface DynamicServer extends Server {

  /**
   * Set the callback method to run when an interest packet is passed to
   * this server. This method should either return a data packet that
   * satisfies the Interest or throw an Exception to avoid sending. Calling this
   * method a second time should replace the callback.
   *
   * @param callback the callback instance
   * @throws java.io.IOException if the server fails to register a prefix
   */
  void respondUsing(RespondWithData callback) throws IOException;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy