|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmedisyn.ScenarioConfig
public class ScenarioConfig
Represents a configuration with proxies and proxy groups. Provides saving and loading of configurations. Provides actions with the proxies like copying files to them...
Nested Class Summary | |
---|---|
private static class |
ScenarioConfig.HelperOpType
defines for what operations the HelperThread may be used for |
(package private) class |
ScenarioConfig.HelperThread
inner class to execute various functions using a thread |
Field Summary | |
---|---|
private boolean |
batchMode
|
private static java.lang.String |
BLACKLIST_FILE
|
private java.util.Vector<FileCategory> |
fileCategories
|
private java.lang.String |
fileName
|
private ScenarioConfig.HelperThread |
helper
|
private boolean |
loaded
|
private int |
MIN_BOOTSTRAP_WAIT_TIME_IN_SEC
Defines the minimum amount of secs to wait before the bootstrapping of some nodes is finished. |
private NodeEdgeMap |
nodeEdgeMap
|
private ScenarioNodeMgr |
nodeMgr
|
private java.util.Vector<ProxyGroup> |
proxyGroups
|
private static java.lang.String |
SCENARIO_FILE_EXT
|
Constructor Summary | |
---|---|
ScenarioConfig(java.lang.String fileName)
|
Method Summary | |
---|---|
boolean |
addNodeToScenario(Node selectedNode)
adds a node to the scenario |
boolean |
addSelectedNodesToSlice(PlanetLabMgr planetLabApi)
add selected nodes to slice |
boolean |
bootstrapSelectedNodes(PlanetLabMgr planetLabApi)
execute install.sh on nodes |
boolean |
bootstrapSelectedNodes(PlanetLabMgr planetLabApi,
boolean waitUntilFinished)
Calls the bootstrapSelectedNodes method and waits some defined time until this operation is finished. |
private boolean |
checkConsistency(java.util.Vector<X2XProxy> proxies,
java.util.Vector<ProxyGroup> proxyGroups)
Run a consistency check over the proxies and the proxyGroups. |
boolean |
copyDirToNodesInternal(PlanetLabMgr planetLabApi,
java.lang.String sourceDir,
java.lang.String remoteDir,
java.util.Vector<Node> nodes)
Copies the sourceDir from the local filesystem to the remoteDir of every node. |
boolean |
copyDirToSelectedNodes(PlanetLabMgr planetLabApi,
java.lang.String sourceDir,
java.lang.String remoteDir,
boolean asynchronous)
scp dir to nodes |
boolean |
copyDirToSelectedNodes(PlanetLabMgr planetLabApi,
java.lang.String sourceDir,
java.lang.String remoteDir,
boolean asynchronous,
java.util.Vector<Node> nodes)
scp dir to nodes |
void |
deleteAllProxyGroups()
Deletes the proxy-groups associations. |
void |
deleteFileCategory(FileCategory cat)
deletes a category frome category-vector |
boolean |
execCmdOnNodesInternal(PlanetLabMgr planetLabApi,
java.lang.String command,
java.util.Vector<Node> nodes)
Executes the given command on each node. |
boolean |
execCmdOnSelectedNodes(PlanetLabMgr planetLabApi,
java.lang.String command,
boolean asynchronous,
java.util.Vector<Node> nodes)
Executes the given command on each node. |
X2XProxy |
findNode(java.lang.String hostName)
Tries to find the X2XProxy which has the given hostname. |
boolean |
getClientVersionOfSelectedNodes(PlanetLabMgr planetLabApi,
java.util.Vector<X2XProxy> badNodes)
get the version of the scenario-nodes, remember the badNodes |
boolean |
getClientVersionOfSelectedNodesEx(PlanetLabMgr planetLabApi,
java.util.Vector<X2XProxy> badNodes)
get the version of the scenario-nodes and add the bad nodes to the blacklist |
boolean |
getDirFromNodesInternal(PlanetLabMgr planetLabApi,
java.lang.String remoteDir,
java.lang.String localDir,
java.util.Vector<Node> nodes)
Transfers the remote directory from each of the nodes and saves it to the local directory |
boolean |
getDirFromSelectedNodes(PlanetLabMgr planetLabApi,
java.lang.String remoteDir,
java.lang.String localDir,
boolean asynchronous)
Transfers the remote directory from each of the nodes and saves it to the local directory |
boolean |
getDirFromSelectedNodes(PlanetLabMgr planetLabApi,
java.lang.String remoteDir,
java.lang.String localDir,
boolean asynchronous,
java.util.Vector<Node> nodes)
Transfers the remote directory from each of the nodes and saves it to the local directory |
java.util.Vector<FileCategory> |
getFileCategories()
|
java.lang.String |
getFileName()
|
NodeEdgeMap |
getNodeEdgeMap()
|
ScenarioNodeMgr |
getNodeMgr()
|
java.util.Vector<X2XProxy> |
getNodes()
|
ProxyGroup |
getProxGroupByName(java.lang.String name)
returns the ProxyGroup which has the given name. |
java.util.Vector<java.awt.Color> |
getProxyGroupColors()
|
java.util.Vector<java.lang.String> |
getProxyGroupNames()
|
java.util.Vector<ProxyGroup> |
getProxyGroups()
|
static java.lang.String |
getSCENARIO_FILE_EXT()
|
boolean |
isBatchMode()
|
boolean |
loadConfig()
load an existing config file |
void |
printProxyGroups()
prints the proxy-grups and their proxies to stdout |
boolean |
randomSelectNodes(NodeEdgeMap map)
randomly select some nodes from different continents select at most one node from a City of the appropriate region TODO: write the selected nodes and their location to a file |
private void |
randomSelectNodesFromVec(java.util.Vector<Node> Nodes,
int nodesToSelect,
boolean atmostOneNodePerCity,
java.util.Vector<Node> selectedNodes)
helper function to randomly select N nodes from the Vector, The selected Nodes are removed from Vector "Nodes"! |
boolean |
removeNodeFromScenario(Node toRemove)
removes a node from the scenario |
boolean |
saveConfig()
save config into file for later use |
void |
setBatchMode(boolean batchMode)
|
void |
setFileCategories(java.util.Vector<FileCategory> fileCategories)
|
void |
setFileName(java.lang.String fileName)
|
void |
setNodeEdgeMap(NodeEdgeMap nodeEdgeMap)
Set the node edge map and recalculate the Nodes and Edges! |
void |
setNodeMgr(ScenarioNodeMgr nodeMgr)
|
void |
setProxyGroups(java.util.Vector<ProxyGroup> proxyGroups)
|
boolean |
updateEdgeData()
On each call the existing edges are deleted from the map first. |
boolean |
updateNodeData()
Iterate thrugh all the proxy-nodes, try to find the appropriate planetLabNode and update the data of each proxy |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final int MIN_BOOTSTRAP_WAIT_TIME_IN_SEC
private static final java.lang.String BLACKLIST_FILE
private static final java.lang.String SCENARIO_FILE_EXT
private java.lang.String fileName
private ScenarioNodeMgr nodeMgr
private java.util.Vector<FileCategory> fileCategories
private java.util.Vector<ProxyGroup> proxyGroups
private boolean loaded
private boolean batchMode
private NodeEdgeMap nodeEdgeMap
private ScenarioConfig.HelperThread helper
Constructor Detail |
---|
public ScenarioConfig(java.lang.String fileName)
fileName
- - including file-ext but without pathMethod Detail |
---|
public boolean updateNodeData()
public boolean updateEdgeData()
public void deleteFileCategory(FileCategory cat)
cat
- - the category to deleteprivate boolean checkConsistency(java.util.Vector<X2XProxy> proxies, java.util.Vector<ProxyGroup> proxyGroups)
public boolean saveConfig() throws java.lang.Exception
java.lang.Exception
- - if an exception occouredpublic boolean loadConfig()
public void deleteAllProxyGroups()
public boolean addNodeToScenario(Node selectedNode)
selectedNode
-
public boolean removeNodeFromScenario(Node toRemove)
toRemove
- - the node to remove
public boolean randomSelectNodes(NodeEdgeMap map)
map
- - NodeEdgeMap
ImageViewer.handleTakesPartChange(boolean)
private void randomSelectNodesFromVec(java.util.Vector<Node> Nodes, int nodesToSelect, boolean atmostOneNodePerCity, java.util.Vector<Node> selectedNodes)
Nodes
- - the pool of nodes to select some fromnodesToSelect
- - nr of nodes to chose from the poolatmostOneNodePerCity
- - if the option is true:
at most one node of a city in the region is selectedselectedNodes
- - result set, may already contain nodespublic boolean copyDirToSelectedNodes(PlanetLabMgr planetLabApi, java.lang.String sourceDir, java.lang.String remoteDir, boolean asynchronous)
sourceDir
- - local directory path to copy to the selected nodes.
If empty or null, the DEFAULT_COPY_DIR is taken.asynchronous
- - if true: copy operation will be asynchronously executed in a thread.
Note that only one asynchronous copy operation is allowed at a time.public boolean copyDirToSelectedNodes(PlanetLabMgr planetLabApi, java.lang.String sourceDir, java.lang.String remoteDir, boolean asynchronous, java.util.Vector<Node> nodes)
sourceDir
- - local directory path to copy to the selected nodes.
If empty or null, the DEFAULT_COPY_DIR is taken.asynchronous
- - if true: copy operation will be asynchronously executed in a thread.
Note that only one asynchronous copy operation is allowed at a time.nodes
- - The nodes to copy topublic boolean copyDirToNodesInternal(PlanetLabMgr planetLabApi, java.lang.String sourceDir, java.lang.String remoteDir, java.util.Vector<Node> nodes)
copyDirToNodesInternal
in interface IDataTransferrer
planetLabApi
- sourceDir
- - The directory to copy fromnodes
- - The nodes to copy topublic boolean getDirFromSelectedNodes(PlanetLabMgr planetLabApi, java.lang.String remoteDir, java.lang.String localDir, boolean asynchronous)
planetLabApi
- remoteDir
- - the remote directory which is located at each nodelocalDir
- - the local directory which is used as destination for the remote directories of the nodes.
A subdirectory named like the hostname of each node will be created to save the remote dir of the node.asynchronous
- - if true, then the work will be done using a separate threadpublic boolean getDirFromSelectedNodes(PlanetLabMgr planetLabApi, java.lang.String remoteDir, java.lang.String localDir, boolean asynchronous, java.util.Vector<Node> nodes)
planetLabApi
- remoteDir
- - the remote directory which is located at each nodelocalDir
- - the local directory which is used as destination for the remote directories of the nodes.
A subdirectory named like the hostname of each node will be created to save the remote dir of the node.asynchronous
- - if true, then the work will be done using a separate threadnodes
- - the nodes from which the directory will be copied to our pcpublic boolean getDirFromNodesInternal(PlanetLabMgr planetLabApi, java.lang.String remoteDir, java.lang.String localDir, java.util.Vector<Node> nodes)
getDirFromNodesInternal
in interface IDataTransferrer
planetLabApi
- remoteDir
- - the remote directory which is located at each nodelocalDir
- - the local directory which is used as destination for the remote directories of the nodes.
A subdirectory named like the hostname of each node will be created to save the remote dir of the node.nodes
- - the nodes from which the directory will be copied to our pcpublic boolean execCmdOnSelectedNodes(PlanetLabMgr planetLabApi, java.lang.String command, boolean asynchronous, java.util.Vector<Node> nodes)
planetLabApi
- command
- - The shell command to execute on each node.asynchronous
- - if true, then the work will be done using a separate threadnodes
- - the nodes from which the directory will be copied to our pcpublic boolean execCmdOnNodesInternal(PlanetLabMgr planetLabApi, java.lang.String command, java.util.Vector<Node> nodes)
execCmdOnNodesInternal
in interface IDataTransferrer
planetLabApi
- command
- - The shell command to execute on each node.nodes
- - the nodes from which the directory will be copied to our pcpublic boolean addSelectedNodesToSlice(PlanetLabMgr planetLabApi)
public boolean getClientVersionOfSelectedNodes(PlanetLabMgr planetLabApi, java.util.Vector<X2XProxy> badNodes)
public boolean getClientVersionOfSelectedNodesEx(PlanetLabMgr planetLabApi, java.util.Vector<X2XProxy> badNodes)
public boolean bootstrapSelectedNodes(PlanetLabMgr planetLabApi)
public boolean bootstrapSelectedNodes(PlanetLabMgr planetLabApi, boolean waitUntilFinished)
public java.lang.String getFileName()
public void setFileName(java.lang.String fileName)
fileName
- the fileName to setpublic ScenarioNodeMgr getNodeMgr()
public void setNodeMgr(ScenarioNodeMgr nodeMgr)
nodeMgr
- - containing the nodes to setpublic java.util.Vector<X2XProxy> getNodes()
public java.util.Vector<FileCategory> getFileCategories()
public void setFileCategories(java.util.Vector<FileCategory> fileCategories)
fileCategories
- the fileCategories to setpublic java.util.Vector<ProxyGroup> getProxyGroups()
public java.util.Vector<java.lang.String> getProxyGroupNames()
public java.util.Vector<java.awt.Color> getProxyGroupColors()
public ProxyGroup getProxGroupByName(java.lang.String name)
ProxyGroup
which has the given name.
name
-
ProxyGroup
with the given name, if it can be found, null otherwise.public X2XProxy findNode(java.lang.String hostName)
X2XProxy
which has the given hostname.
hostName
-
X2XProxy
with the given name, if it can be found, null otherwise.public void setProxyGroups(java.util.Vector<ProxyGroup> proxyGroups)
proxyGroups
- the proxyGroups to setpublic void printProxyGroups() throws java.lang.Exception
java.lang.Exception
ProxyGenerator.printProxyGroups(ProxyGroup)
public boolean isBatchMode()
public void setBatchMode(boolean batchMode)
batchMode
- the batchMode to setpublic NodeEdgeMap getNodeEdgeMap()
public void setNodeEdgeMap(NodeEdgeMap nodeEdgeMap)
nodeEdgeMap
- public static java.lang.String getSCENARIO_FILE_EXT()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |