public final class FactoryUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
CloudProvider_CONTEXT |
static String |
Failures_CONTEXT |
static String |
Host_CONTEXT |
static String |
Job_CONTEXT |
static String |
NetworkInterface_CONTEXT |
static String |
NetworkLink_CONTEXT |
static String |
Switch_CONTEXT |
static String |
ThinClient_CONTEXT |
static String |
Topology_CONTEXT |
static String |
Trace_CONTEXT |
static String |
User_CONTEXT |
static String |
VirtualMachine_CONTEXT |
static String |
VmCheckpoint_CONTEXT |
static String |
VmCheckpointingHandler_CONTEXT |
static String |
Workload_CONTEXT |
static String |
Workload_TASK_CONTEXT |
Modifier and Type | Method and Description |
---|---|
static void |
connectToInternet(Config config,
NetworkDevice networkDevice,
long linkLatency,
double linkLossRate)
This calls
connectToInternet(Config, NetworkDevice, long, long, long, double)
such that linkUpBw and linkDownBw are directly gotten from the given config
or from the networkDevice contexted configuration (contexted using NetworkInterface_CONTEXT )
(default is 100MiB/s ). |
static void |
connectToInternet(Config config,
NetworkDevice networkDevice,
long linkUpBw,
long linkDownBw,
long linkLatency,
double linkLossRate)
This methods instantiates a factory using the given config and then
calls
Factory.connectToInternet(NetworkDevice, Class, Class, Class, long, long, long, double)
networkInterfaceClass: is gotten from networkDevice configuration contexted with NetworkInterface_CONTEXT ;
networkLinkClass: is gotten from given configuration contexted with NetworkLink_CONTEXT ;
networkProvisionerClass: is gotten from given configuration contexted with NetworkLink_CONTEXT . |
static CloudProvider |
generateCloudProvider(Config config) |
static Integer |
generateCount(Config config,
Integer defaultCount)
This method is used in factories when generating objects to define how
many objects will be generated.
For more details, see generateInt(String, Config, Integer) . |
static Double |
generateDouble(String configName,
Config config,
Double defaultValue)
Generates and returns a Double based on given arguments.
|
static void |
generateFailures(Config config) |
static Host |
generateHost(Config config,
CloudProvider parent)
Generates and returns a new Host based on the given configuration.
|
static Integer |
generateInt(String configName,
Config config,
Integer defaultValue)
Generates and returns a Integer based on given arguments.
|
static Job |
generateJob(Config config)
Generates and returns a new
Job . |
static Long |
generateLong(String configName,
Config config,
Long defaultValue)
Generates and returns a Long based on given arguments.
|
static Simulator |
generateSimulator() |
static Simulator |
generateSimulator(Config config) |
static Simulator |
generateSimulator(String configFilename) |
static Switch |
generateSwitch(Config config,
Entity parent)
Generates and returns a new
Switch . |
static ThinClient |
generateThinClient(Config config,
User parent)
Generate and returns a new thin client for the given user, and connects it to the Internet.
|
static ThinClientVirtualMachine |
generateThinClientVirtualMachine(Config config,
ThinClient parent) |
static void |
generateTopology(Config config,
CloudProvider cloudProvider) |
static Trace<?> |
generateTrace(Config config,
Probed parent)
Generates and returns a new
Trace . |
static void |
generateTraces(Config config,
Probed parent) |
static User |
generateUser(Config config,
CloudProvider parent) |
static VirtualMachine |
generateVirtualMachine(Config config,
CloudProvider cloudProvider,
User user)
Generates and returns a virtual machine after placing it using the cloud provider's placement policy.
|
static VirtualMachine |
generateVirtualMachine(Config config,
User user)
Generates and returns a virtual machine (but does not place it).
|
static VmCheckpointingHandler |
generateVmCheckpointingHandler(CloudProvider cloudProvider,
Config config) |
static Workload |
generateWorkload(Config config,
User owner,
boolean initiating)
After that the workload is generated,
a
NotificationCodes.FACTORY_WORKLOAD_GENERATED notification
is thrown. |
static Task |
generateWorkloadTask(Workload workload,
Config config) |
static NumberGenerator |
getDoubleGenerator(String configName,
Config config,
Double defaultValue) |
static NumberGenerator |
getIntGenerator(String configName,
Config config,
Integer defaultValue) |
static NumberGenerator |
getLongGenerator(String configName,
Config config,
Long defaultValue) |
static NetworkInterface[] |
linkDevices(Config config,
NetworkDevice device0,
NetworkDevice device1,
long linkLatency,
double linkLossRate)
This calls
linkDevices(Config, NetworkDevice, NetworkDevice, long, long, long, double)
such that linkUpBw and linkDownBw are gotten from the device0 configuration contexted with
NetworkInterface_CONTEXT (default is 100MiB/s ). |
static NetworkInterface[] |
linkDevices(Config config,
NetworkDevice device0,
NetworkDevice device1,
long linkUpBw,
long linkDownBw,
long linkLatency,
double linkLossRate)
This method calls
Factory.linkDevices(NetworkDevice, NetworkDevice, Class, Class, Class, Class, long, long, long, double)
with the following parameters:
networkInterface0Class: is gotten from device0 configuration contexted with NetworkInterface_CONTEXT ;
networkInterface1Class: is gotten from device1 configuration contexted with NetworkInterface_CONTEXT ;
networkLinkClass: is gotten from given configuration contexted with NetworkLink_CONTEXT ;
networkProvisionerClass: is gotten from given configuration contexted with NetworkLink_CONTEXT . |
static void |
logAdvancement(String s,
int total,
double percent) |
public static final String CloudProvider_CONTEXT
public static final String Failures_CONTEXT
public static final String NetworkInterface_CONTEXT
public static final String NetworkLink_CONTEXT
public static final String Host_CONTEXT
public static final String Switch_CONTEXT
public static final String ThinClient_CONTEXT
public static final String VirtualMachine_CONTEXT
public static final String Topology_CONTEXT
public static final String User_CONTEXT
public static final String Trace_CONTEXT
public static final String Job_CONTEXT
public static final String Workload_CONTEXT
public static final String Workload_TASK_CONTEXT
public static final String VmCheckpointingHandler_CONTEXT
public static final String VmCheckpoint_CONTEXT
public static Double generateDouble(String configName, Config config, Double defaultValue)
This method will check these next configurations sequentially in order to
compute the returned double (examples given assuming configName == "Example"
):
NumberGenerator
then
it is instantiated and used to generate the returned value;
configName
- config
- the configuration object, may be nulldefaultValue
- public static NumberGenerator getDoubleGenerator(String configName, Config config, Double defaultValue)
public static Long generateLong(String configName, Config config, Long defaultValue)
This method will check these next configurations sequentially in order to
compute the returned long (examples given assuming configName == "Example"
):
NumberGenerator
then
it is instantiated and used to generate the returned value;
configName
- config
- the configuration object, may be nulldefaultValue
- public static NumberGenerator getLongGenerator(String configName, Config config, Long defaultValue)
generateLong(String, Config, Long)
public static Integer generateInt(String configName, Config config, Integer defaultValue)
This method will check these next configurations sequentially in order to
compute the returned integer (examples given assuming configName == "Example"
):
NumberGenerator
then
it is instantiated and used to generate the returned value;
configName
- config
- the configuration object, may be nulldefaultValue
- public static NumberGenerator getIntGenerator(String configName, Config config, Integer defaultValue)
generateInt(String, Config, Integer)
public static Integer generateCount(Config config, Integer defaultCount)
generateInt(String, Config, Integer)
.public static void logAdvancement(String s, int total, double percent)
public static Simulator generateSimulator()
public static CloudProvider generateCloudProvider(Config config)
public static void generateFailures(Config config)
public static NetworkInterface[] linkDevices(Config config, NetworkDevice device0, NetworkDevice device1, long linkLatency, double linkLossRate)
linkDevices(Config, NetworkDevice, NetworkDevice, long, long, long, double)
such that linkUpBw and linkDownBw are gotten from the device0 configuration contexted with
NetworkInterface_CONTEXT
(default is 100MiB/s
).public static NetworkInterface[] linkDevices(Config config, NetworkDevice device0, NetworkDevice device1, long linkUpBw, long linkDownBw, long linkLatency, double linkLossRate)
Factory.linkDevices(NetworkDevice, NetworkDevice, Class, Class, Class, Class, long, long, long, double)
with the following parameters:NetworkInterface_CONTEXT
;
NetworkInterface_CONTEXT
;
NetworkLink_CONTEXT
;
NetworkLink_CONTEXT
.
public static void connectToInternet(Config config, NetworkDevice networkDevice, long linkLatency, double linkLossRate)
connectToInternet(Config, NetworkDevice, long, long, long, double)
such that linkUpBw and linkDownBw are directly gotten from the given config
or from the networkDevice contexted configuration (contexted using NetworkInterface_CONTEXT
)
(default is 100MiB/s
).public static void connectToInternet(Config config, NetworkDevice networkDevice, long linkUpBw, long linkDownBw, long linkLatency, double linkLossRate)
Factory.connectToInternet(NetworkDevice, Class, Class, Class, long, long, long, double)
NetworkInterface_CONTEXT
;
NetworkLink_CONTEXT
;
NetworkLink_CONTEXT
.
public static Host generateHost(Config config, CloudProvider parent)
Default state of the host is PoweredEntity.PowerState.OFF
unless otherwise specified.
config
- contexted configurationparent
- public static Switch generateSwitch(Config config, Entity parent)
Switch
.config
- contexted configurationparent
- Switch
public static ThinClient generateThinClient(Config config, User parent)
After that the thin client is generated,
the NotificationCodes.FACTORY_THINCLIENT_GENERATED
notification
is thrown.
config
- contexted configurationparent
- ThinClient
public static ThinClientVirtualMachine generateThinClientVirtualMachine(Config config, ThinClient parent)
public static final VirtualMachine generateVirtualMachine(Config config, User user)
config
- contexted configuationuser
- VirtualMachine
public static final VirtualMachine generateVirtualMachine(Config config, CloudProvider cloudProvider, User user)
config
- contexted configuationcloudProvider
- user
- VirtualMachine
public static void generateTopology(Config config, CloudProvider cloudProvider)
public static User generateUser(Config config, CloudProvider parent)
public static Trace<?> generateTrace(Config config, Probed parent)
Trace
.config
- contexted configuationparent
- Trace
public static void generateTraces(Config config, Probed parent)
config
- configuation which contains all traces configurationsparent
- public static Job generateJob(Config config)
Job
.config
- contexted configuationJob
public static Workload generateWorkload(Config config, User owner, boolean initiating)
After that the workload is generated,
a NotificationCodes.FACTORY_WORKLOAD_GENERATED
notification
is thrown.
config
- owner
- initiating
- if true, then the simulator is initiating and workload is only
started after that the simulator is initiatedpublic static VmCheckpointingHandler generateVmCheckpointingHandler(CloudProvider cloudProvider, Config config)