Commit f4559a45 authored by Björn Richerzhagen's avatar Björn Richerzhagen
Browse files

initialized clean Simonstrator-PeerfactSim.KOM-repository to FINALLY get rid...

initialized clean Simonstrator-PeerfactSim.KOM-repository to FINALLY get rid of huge blob objects and ancient history that is not relevant to the simonstrator-branch of PeerfactSim.KOM
parents
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!--
-->
</head>
<body bgcolor="white">
Provides interfaces necessary to implement the network layer and all its subcomponents such as the used latency model or
a specific subnet implementation.
</body>
</html>
/*
* Copyright (c) 2005-2010 KOM – Multimedia Communications Lab
*
* This file is part of PeerfactSim.KOM.
*
* PeerfactSim.KOM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* PeerfactSim.KOM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PeerfactSim.KOM. If not, see <http://www.gnu.org/licenses/>.
*
*/
package de.tud.kom.p2psim.api.network.routing;
import de.tud.kom.p2psim.api.common.SimHostComponent;
import de.tud.kom.p2psim.api.linklayer.LinkLayer;
import de.tud.kom.p2psim.api.linklayer.mac.MacAddress;
import de.tud.kom.p2psim.api.linklayer.mac.PhyType;
import de.tud.kom.p2psim.api.network.NetMessage;
import de.tud.kom.p2psim.api.network.NetProtocol;
import de.tudarmstadt.maki.simonstrator.api.component.network.NetInterface;
import de.tudarmstadt.maki.simonstrator.api.component.network.NetworkComponent.NetInterfaceName;
import de.tudarmstadt.maki.simonstrator.api.component.transport.ConnectivityListener;
/**
* Interface for a Routing Algorithm on the Network-Layer. A routing algorithm
* might span multiple PHYs, for example WIFI (infrastructure) + ETHERNET, to
* provide routing from end-system to end-system or it might just work on one
* PHY, for example on Bluetooth-devices. Which algorithm to choose depends on
* the {@link NetProtocol} that is chosen by the TransLayer.
*
*
* @author Bjoern Richerzhagen
* @version 1.0, 25.02.2012
*/
public interface RoutingAlgorithm extends SimHostComponent, ConnectivityListener {
public static enum RoutingType {
/**
* The algorithm is adaptive, but tries to maintain a routing table all
* the time.
*/
PROACTIVE,
/**
* The algorithm does not maintain a routing-table all the time but
* instead creates a route as soon as it is requested
*/
REACTIVE,
/**
* The algorithm uses static routing tables (entries do not change)
*/
STATIC
}
/**
* Returns the Type of the RoutingAlgorithm
*
* @return
*/
public RoutingType getType();
public void initialize();
/**
*
* @param net
*/
public void setNetInterface(NetInterface net);
/**
*
* @return
*/
public NetInterfaceName getNetInterfaceName();
/**
* @deprecated later on, remove PhyType completely in favor of
* NetInterfaceName?
* @return
*/
public PhyType getPhyType();
/**
* The NetLayer will register itself as a Listener here. It will be notified
* as soon as a payload-message arrives that is destined for this NetLayer
*
* @param listener
*/
public void setMessageListener(RoutingListener listener);
/**
* Route a message through the network towards the provided destination.
* Uses the information and methods of the {@link LinkLayer} to send
* messages to fulfill this task. This is called on the first node of the route towards the destination.
*
* @param msg
* beware, this might be a broadcast - you might use it to
* piggyback information but you also have to ensure that it is
* not "routed" but instead just executed by passing it to the
* linkLayer
*/
public void route(NetMessage msg);
/**
* The NetLayer received a Message that has to be handled by this routing
* Algorithm.
*
* @param msg
* @param phy
* the PHY over which this message arrived. Might be important to
* an Algorithm that spans multiple PHYs
* @param lastHop
* the MacAddress of the last Hop of this message
*/
public void handleMessage(NetMessage msg, PhyType phy, MacAddress lastHop);
}
/*
* Copyright (c) 2005-2010 KOM – Multimedia Communications Lab
*
* This file is part of PeerfactSim.KOM.
*
* PeerfactSim.KOM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* PeerfactSim.KOM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PeerfactSim.KOM. If not, see <http://www.gnu.org/licenses/>.
*
*/
package de.tud.kom.p2psim.api.network.routing;
import de.tud.kom.p2psim.api.common.SimHost;
import de.tud.kom.p2psim.impl.network.routed.RoutedNetLayer;
/**
* Configuration interface for the routing-Algorithms inside the
* {@link RoutedNetLayer}. Implementations of this Interface should be used
* inside the config-xml to create the components for each host.
*
* @author Bjoern Richerzhagen
* @version 1.0, 26.04.2012
*/
public interface RoutingConfiguration {
/**
* Return a fully configured {@link RoutingAlgorithm} for the given Host.
*
* @param host
* @return
*/
public RoutingAlgorithm getConfiguredRoutingAlgorithm(SimHost host);
}
/*
* Copyright (c) 2005-2010 KOM – Multimedia Communications Lab
*
* This file is part of PeerfactSim.KOM.
*
* PeerfactSim.KOM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* PeerfactSim.KOM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PeerfactSim.KOM. If not, see <http://www.gnu.org/licenses/>.
*
*/
package de.tud.kom.p2psim.api.network.routing;
import de.tud.kom.p2psim.api.network.NetMessage;
/**
* Listener for the Netlayer
*
* @author Bjoern Richerzhagen
* @version 1.0, 29.02.2012
*/
public interface RoutingListener {
/**
* Tells the NetLayer to deliver the message to the upper layers
*
* @param protocol
* @param sender
* @param msg
*/
public void deliverMessage(NetMessage msg);
}
/*
* Copyright (c) 2005-2010 KOM – Multimedia Communications Lab
*
* This file is part of PeerfactSim.KOM.
*
* PeerfactSim.KOM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* PeerfactSim.KOM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PeerfactSim.KOM. If not, see <http://www.gnu.org/licenses/>.
*
*/
package de.tud.kom.p2psim.api.network.routing;
import de.tud.kom.p2psim.api.network.NetMessage;
import de.tudarmstadt.maki.simonstrator.api.Message;
/**
* A message that is packed inside a {@link NetMessage} by a
* {@link RoutingAlgorithm}
*
* @author Bjoern Richerzhagen
* @version 1.0, 04.03.2012
*/
public interface RoutingMessage extends Message {
// in its essence, this is only a marker
}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!--
@(#)package.html 1.60 98/01/27
Copyright 1998
-->
</head>
<body bgcolor="white">
Provides interfaces to the simulator and its components.
</body>
</html>
/*
* Copyright (c) 2005-2011 KOM - Multimedia Communications Lab
*
* This file is part of PeerfactSim.KOM.
*
* PeerfactSim.KOM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* PeerfactSim.KOM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PeerfactSim.KOM. If not, see <http://www.gnu.org/licenses/>.
*
*/
package de.tud.kom.p2psim.api.scenario;
import org.dom4j.Element;
import de.tudarmstadt.maki.simonstrator.api.component.Component;
/**
* Another way (than to implement Configurable or Composable interface) to
* configure simulator modules from an XML file: here, the
* <code>Configurator</code> will pass the control to the builder which in turn
* can build objects from the XML data. This is mainly designed for complex
* things, e.g. creation of hosts.
* <p>
* Note, that we use the <a href="http://www.dom4j.org/">dom4j</a> library to
* process the XML data.
*
* @author Konstantin Pussep
* @author Sebastian Kaune
* @version 3.0, 03.12.2007
*
* @see Composable
* @see Configurator
*/
public interface Builder extends Component {
/**
* Parse the XML subtree (with the provided element as a root) and create
* all the necessary data.
*
* @param elem
* - root of an XML subtree with configuration data (represented
* as with the help from dom4j)
* @param config
* - configurator which can be used to obtain other configurables
* or call helper methods
*/
public void parse(Element elem, Configurator config);
}
/*
* Copyright (c) 2005-2011 KOM - Multimedia Communications Lab
*
* This file is part of PeerfactSim.KOM.
*
* PeerfactSim.KOM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* PeerfactSim.KOM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PeerfactSim.KOM. If not, see <http://www.gnu.org/licenses/>.
*
*/
package de.tud.kom.p2psim.api.scenario;
/**
* An implementation of this interface indicates that it requires other
* configurables in order to configure itself properly. These configurables can
* be retrieved from the <code>Configurator</code> which calls the
* <code>compose(configurator)</code> method on this composable configurable.
*
* @author Konstantin Pussep
* @author Sebastian Kaune
* @version 3.0, 03.12.2007
*
* @see Configurator#getConfigurable(String)
*
*/
public interface Composable {
/**
* Upon the call of this method the composable configurable can access other
* configurables by accessing the <code>Configurator</code>.
*
* @param config
* <code>Configurator</code> instance holding all available
* configurables.
*/
public void compose(Configurator config);
}
/*
* Copyright (c) 2005-2011 KOM - Multimedia Communications Lab
*
* This file is part of PeerfactSim.KOM.
*
* PeerfactSim.KOM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* PeerfactSim.KOM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PeerfactSim.KOM. If not, see <http://www.gnu.org/licenses/>.
*
*/
package de.tud.kom.p2psim.api.scenario;
/**
* Thrown if the simulator was not configured properly.
*
* @author Konstantin Pussep
* @author Sebastian Kaune
* @version 3.0, 03.12.2007
*
*/
public class ConfigurationException extends RuntimeException {
/**
* Constructs a new configuration exception with an error message and a
* nested exception
*
* @param message
* - error description
* @param cause
* - nested exception
*/
public ConfigurationException(String message, Throwable cause) {
super(message, cause);
}
/**
* Constructs a new configuration exception with an error message only.
*
* @param message
* - error description
*/
public ConfigurationException(String message) {
super(message);
}
}
/*
* Copyright (c) 2005-2011 KOM - Multimedia Communications Lab
*
* This file is part of PeerfactSim.KOM.
*
* PeerfactSim.KOM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* PeerfactSim.KOM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PeerfactSim.KOM. If not, see <http://www.gnu.org/licenses/>.
*
*/
package de.tud.kom.p2psim.api.scenario;
import java.io.File;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import de.tudarmstadt.maki.simonstrator.api.component.Component;
/**
* An implementation of this interface is used to access and probably parse the
* file describing the configuration of the simulator. The simulator is
* configured from XML files with a flexible but still constrained structure.
* Few features of this files are
* <ul>
* <li>Support for variables which can be passed to the configurator from
* outside (e.g. command line)
* <li>Arbitrary new components can be configured via this configurator without
* to change the configurator
* </ul>
* TODO describe an example config file and the rules (or point to the
* documentation)
*
* @author Konstantin Pussep
* @author Sebastian Kaune
* @version 3.0, 03.12.2007
*
*/
public interface Configurator {
/**
* This tag denotes the root element of the XML-file that embodies the
* configuration
*/
public static final String CONFIGURATION_ROOT_TAG = "Configuration";
/**
* Tag to be used in the config file in order to define some default values.
*/
public final static String DEFAULT_TAG = "Default";
/**
* This tag is used in the config-file in order to access the xml-element,
* that specifies the component, which implements and represents the basis
* for the simulator
*/
public static final String CORE = "SimulatorCore";
/**
* This tag is used in the config-file in order to access the xml-element,
* that embodies the logic for creating the defined amount of peers
*/
public static final String HOST_BUILDER = "HostBuilder";
/**
* This tag is used in the config-file in order to access the xml-element,
* that comprises the functionality to extract the action out of different
* types of action files
*/
public static final String SCENARIO_TAG = "Scenario";
public static final String DATABASE_TAG = "Database";
/**
* Tag to be used in the config file in order to define default values for a
* single variable.
*/
public final static String VARIABLE_TAG = "Variable";
/**
* Predefined name of the attribute within the <code>Variable</code>
* -element, that contains the name of the variable as value
*/
public static final String VARIABLE_NAME_TAG = "name";
/**
* Predefined name of the attribute within the <code>Variable</code>
* -element, that contains the value of the variable as value
*/
public static final String VARIABLE_VALUE_TAG = "value";
public static final String SPECIAL_IF_EQUAL_STR = "IfEqualStr";
public static final String SPECIAL_IF_NOT_EQUAL_STR = "IfNotEqualStr";
/**
* Tag for the nested element within a <code>host</code>- oder
* <code>group</code>-element, that defines the values of the given
* properties for a single host or a group of hosts
*/
public static final String HOST_PROPERTIES_TAG = "Properties";
/**
* Tag for the nested element within the <code>Scenario</code>-element,
* which is used to create a new action method inside config-file
*/
public static final String ACTION_TAG = "Action";
public static final String VARIATION_VANILLA = "Vanilla";
/**
* Get a configurable which was already parsed and configured. This is the
* common way how configurables can access each other during the
* configuration process or how the simulation engine can obtain the
* configuration result.
*
* @param name
* - configurable's name (which is same as in the configuration
* file).
*
* @return configured configurable or null if there is no configurable with
* the given name
*/
public Object getConfigurable(String name);
public List<Object> getConfigurable(Class type);
/**
* Parse value. If the argument starts with a <b>$</b> sign then it will be
* interpreted as a variable name and the variable value will be returned.
* If the variable was not set the result will be <code>null</code>. If the
* argument contains no <b>$</b> sign, the <code>valueString</code>
* parameter will be just forwarded as the return value.
*
* @param valueString
* - string to be parsed, either plain value or variable name
* with preceding $
* @return the value of the variable named <code>valueString</code>, null,
* or the valueString
*/
public String parseValue(String valueString);
public void setVariables(Map<String, String> variables);
public void register(String name, Component component);
public Collection<Object> configureAll();
public File getConfigFile();
public Map<String, String> getVariables();
public String getResolvedConfiguration();
}
/*
* Copyright (c) 2005-2011 KOM - Multimedia Communications Lab
*
* This file is part of PeerfactSim.KOM.
*
* PeerfactSim.KOM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* PeerfactSim.KOM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PeerfactSim.KOM. If not, see <http://www.gnu.org/licenses/>.
*
*/
package de.tud.kom.p2psim.api.scenario;
import java.util.List;
import java.util.Map;
import org.dom4j.Element;
import de.tud.kom.p2psim.api.common.SimHost;
import de.tudarmstadt.maki.simonstrator.api.component.GlobalComponent;
import de.tudarmstadt.maki.simonstrator.api.component.HostComponentFactory;
/**
* HostBuilder is used to parse a portion of the configuration file and to build
* hosts based on it. HostBuilder will use other modules already configured by
* the <code>Configurator</code>, mainly the {@linkplain HostComponentFactory
* component factories} to create single components for this host.
*
* @author Konstantin Pussep
* @author Sebastian Kaune
* @version 3.0, 03.12.2007
*
* @see SimHost
* @see Configurator
*/
public interface HostBuilder extends Builder, GlobalComponent {
/**
* Return a map with all hosts indexed by group ids.
*
* @return map with groupId -> hosts mappings
*/
public Map<String, List<SimHost>> getAllHostsWithGroupIDs();
/**
* Return all hosts regardless group ids.
*
* @return all hosts created
*/
public List<SimHost> getAllHosts();
/*
* @see de.tud.kom.p2psim.api.scenario.Builder#parse(org.dom4j.Element,
* de.tud.kom.p2psim.api.scenario.Configurator)
*/
public void parse(Element elem, Configurator config);
/**
* Return the group of hosts with the given ID. This must be the same id as
* specified in the configuration file. Single hosts with an own id will be
* returned by this method too (as a list with only one entry).
*
* @param groupId
* same group or host id as in the configuration file
* @return list of hosts (or single host packed in a list).
*/
public List<SimHost> getHosts(String groupId);
}
/*
* Copyright (c) 2005-2011 KOM - Multimedia Communications Lab
*
* This file is part of PeerfactSim.KOM.
*
* PeerfactSim.KOM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* PeerfactSim.KOM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PeerfactSim.KOM. If not, see <http://www.gnu.org/licenses/>.
*
*/
package de.tud.kom.p2psim.api.scenario;
import java.util.List;
import java.util.Map;
import de.tud.kom.p2psim.api.common.SimHost;
/**
* Scenario configures hosts to make them usable for simulator, i.e. mainly
* creating some initial events. Different implementations may offer different
* ways to prepare a simulation run.
*
* @author Sebastian Kaune
* @author Konstantin Pussep
* @version 3.0, 03.12.2007
*/
public interface Scenario {
/**
* Prepare the scenario to be started. Typically, a scenario would schedule
* some initial simulation events.
*
*/
public void prepare();
/**
* Set all hosts available for this scenario.
*
* @param allHosts
* - groups of hosts indexed by group ids
*/
public void setHosts(Map<String, List<SimHost>> allHosts);
/**
* Returns all hosts of the scenario, ordered by groups.
*
* @return
*/
public Map<String, List<SimHost>> getHosts();
/**
* Create (one or many) actions for a group of hosts (or a single host if
* group size is one).
*
* @param groupID
* - id of the host group
* @param timeInterval
* - absolute point of time or an interval (then as
* "starttime-endtime")
* @param methodName
* - method name to execute
* @param params
* - list of method params (as strings which will be converted to
* appropriate types)
* @return number of actions created
*/
public int createActions(String groupID, String timeInterval,
String methodName, String[] params);
}
/*
* Copyright (c) 2005-2011 KOM - Multimedia Communications Lab
*
* This file is part of PeerfactSim.KOM.
*
* PeerfactSim.KOM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* PeerfactSim.KOM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PeerfactSim.KOM. If not, see <http://www.gnu.org/licenses/>.
*
*/
package de.tud.kom.p2psim.api.scenario;
/**
* Represents an action which can be specified in the action file and will be
* used to pre-initialize the simulator queue.
*
* @author Konstantin Pussep
* @author Sebastian Kaune
* @version 3.0, 14.12.2007
*
*/
public interface ScenarioAction {
/**
* Schedule this action in the simulator queue.
*/
public void schedule();
}
\ No newline at end of file
/*
* Copyright (c) 2005-2011 KOM - Multimedia Communications Lab
*
* This file is part of PeerfactSim.KOM.
*
* PeerfactSim.KOM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* PeerfactSim.KOM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PeerfactSim.KOM. If not, see <http://www.gnu.org/licenses/>.
*
*/
package de.tud.kom.p2psim.api.scenario;
import de.tudarmstadt.maki.simonstrator.api.component.GlobalComponent;
/**
* Right way to create a scenario is to use a factory extending this interface.
*
* @author Sebastian Kaune
* @author Konstantin Pussep
* @version 3.0, 03.12.2007
*
* @see Scenario
*/
public interface ScenarioFactory extends GlobalComponent {
/**
* Create the scenario by using the data provided via the
* <code>Configurator</code>.
*
* @return scenario generated by this factory
*/
public Scenario createScenario();
}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!--
-->
</head>
<body bgcolor="white">
Defines interfaces for the scenario and its factory.
</body>
</html>
/*
* Copyright (c) 2005-2010 KOM – Multimedia Communications Lab
*
* This file is part of PeerfactSim.KOM.
*
* PeerfactSim.KOM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* PeerfactSim.KOM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PeerfactSim.KOM. If not, see <http://www.gnu.org/licenses/>.
*
*/
package de.tud.kom.p2psim.api.scenario.simcfg;
public interface SimCfgHostBuilder {
}
/*
* Copyright (c) 2005-2010 KOM – Multimedia Communications Lab
*
* This file is part of PeerfactSim.KOM.
*
* PeerfactSim.KOM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* PeerfactSim.KOM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PeerfactSim.KOM. If not, see <http://www.gnu.org/licenses/>.
*
*/
package de.tud.kom.p2psim.api.scenario.simcfg.converter;
import java.util.HashMap;
import de.tud.kom.p2psim.api.scenario.ConfigurationException;
import de.tud.kom.p2psim.impl.scenario.simcfg2.configuration.beans.Value;
import de.tud.kom.p2psim.impl.scenario.simcfg2.utils.converter.*;
import org.apache.log4j.Logger;
import de.tud.kom.p2psim.impl.util.logging.SimLogger;
public class SimCfgTypeConverter {
private static final Logger log = SimLogger.getLogger(SimCfgTypeConverter.class);
public static final String LOSS_OF_PRECISION = "and can lead to a loss of precision";
public static final String FAULTY_VALUES = "and can lead to faulty values";
public static final String FAULTY_VALUES_AND_LOSS_OF_PRECISION = "and can lead to faulty values and/or a loss of precision";
private static HashMap<Class<?>, TypeConverter> converters = new HashMap<Class<?>, TypeConverter>();
private static void addConverter(TypeConverter converter) {
converters.put(converter.responsibleForType(), converter);
}
static {
addConverter(new BooleanConverter());
addConverter(new ByteConverter());
addConverter(new ClassArrayConverter());
addConverter(new DoubleConverter());
addConverter(new IntegerConverter());
addConverter(new LongConverter());
addConverter(new ShortConverter());
addConverter(new ClassConverter());
addConverter(new StringArrayConverter());
addConverter(new StringConverter());
}
public static Object convertTo(String name, Value value, Class<?> type) {
Object parameter = null;
TypeConverter converter = converters.get(type);
if (converter == null) {
throw new ConfigurationException("Error: There is no converter for type '" + type.getSimpleName() + "'.");
}
parameter = converter.convert(name, value);
if (parameter == null) {
throw new ConfigurationException("Error: Conversion of parameter '" + name +
"' of type '" + value.getClass().getSimpleName() +
"' to type '" + type.getSimpleName() + "' is not supported.");
}
return parameter;
}
public static void warnAboutConversion(String parameterName, Object value, Class type, String canLeadTo) {
log.warn("Converted parameter '" + parameterName + "' of type " + value.getClass().getSimpleName() +
"' to type '" + type.getSimpleName() + "', this may not be wanted " + canLeadTo + ".");
}
}
package de.tud.kom.p2psim.api.simengine;
public interface SimulatorObserver {
public void simulationFinished();
}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!--
-->
</head>
<body bgcolor="white">
Defines a couple a basic classes belonging to the simulator engine. The concrete implementation
of relevant simengine classes can be found in the package <code>de.tud.kom.p2psim.impl.simengine</code>.
</body>
</html>
/*
* Copyright (c) 2005-2011 KOM - Multimedia Communications Lab
*
* This file is part of PeerfactSim.KOM.
*
* PeerfactSim.KOM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* PeerfactSim.KOM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PeerfactSim.KOM. If not, see <http://www.gnu.org/licenses/>.
*
*/
package de.tud.kom.p2psim.api.storage;
import java.util.Collection;
import de.tud.kom.p2psim.api.common.SimHostComponent;
import de.tudarmstadt.maki.simonstrator.api.common.UniqueID;
/**
*
* Represents a storage of documents inside of a host, which can be used by
* applications and overlays to store documents locally and fetch them again
* later.
*
* @author Sebastian Kaune <kaune@kom.tu-darmstadt.de>
* @author Konstantin Pussep <pussep@kom.tu-darmstadt.de>
* @version 1.0, 11/25/2007
*
* @deprecated Apps and App-related code is now part of the sim-runner project
*
*/
public interface ContentStorage extends SimHostComponent {
/**
* Fetch doc from the local storage.
*
* @param key
* - document's key
* @return the requested document if present, null otherwise
*/
public Document loadDocument(UniqueID key);
/**
* Store the document in the local storage.
*
* @param doc
* - document to stores
*/
public void storeDocument(Document doc);
/**
* List the keys of all locally stored documents
*
* @return documents stored locally.
*/
public Collection<UniqueID> listDocumentKeys();
/**
* The way to find out whether a document with the given key is inside of
* this storage.
*
* @param key
* - document key
* @return whether the document with the <code>key</code> is inside
*/
public boolean containsDocument(UniqueID key);
/**
*
* @return all documents stored inside of this storage
*/
public Collection<Document> listDocuments();
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment