com.penguinwerks.jodene.managers
Class NetworkManager

java.lang.Object
  extended bycom.penguinwerks.jodene.managers.NetworkManager

public class NetworkManager
extends java.lang.Object

Manages collections of networks.

Author:
Paul Hoehne

Method Summary
 void addNetwork(Network network, DataStorageTag tag, java.lang.String name)
          Add a new network to the vault.
 void addNetwork(Network network, java.lang.String name)
          Add a network to the vault, using the default data storage tag.
 void cleanVault()
          Cleans the vault of all networks.
static NetworkManager getManager()
          Returns an instance of the network manager.
 Network getNetwork(java.lang.String name)
          Returns the named network from the vault.
 DataStorageTag getStorageTag(java.lang.String name)
          Returns the data storage tag for the named network.
 java.lang.String getVaultDirectory()
          Returns the base directory for the vault.
 java.util.List listNetworks()
          Lists the networks in the vault.
 void removeNetwork(java.lang.String name)
          Remove the network from the vault.
 void setVaultDirectory(java.lang.String directory)
          Set the directory path for the netwowrk vault.
 void updateNetwork(Network network, DataStorageTag tag, java.lang.String name)
          Update the given network and the data storage tag.
 void updateNetwork(Network network, java.lang.String name)
          Update the given network without changing the data storage tag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getManager

public static NetworkManager getManager()
Returns an instance of the network manager.

Returns:
The network manager.

addNetwork

public void addNetwork(Network network,
                       DataStorageTag tag,
                       java.lang.String name)
                throws java.io.IOException
Add a new network to the vault.

Parameters:
network - The network.
tag - The storage tag for this network.
name - The name of the network.
Throws:
IOException - Thrown if there is a problem adding this network.

addNetwork

public void addNetwork(Network network,
                       java.lang.String name)
                throws java.io.FileNotFoundException,
                       java.io.IOException,
                       java.lang.ClassNotFoundException
Add a network to the vault, using the default data storage tag.

Parameters:
network - The network.
name - The name of the network.
Throws:
FileNotFoundException - Thrown if there is a problem saving the network.
IOException - Thrown if there is a porblem saving the network.
java.lang.ClassNotFoundException - Thrown if there is a problem saving the network.

cleanVault

public void cleanVault()
Cleans the vault of all networks.


getVaultDirectory

public java.lang.String getVaultDirectory()
Returns the base directory for the vault.

Returns:
The file path to the vault.

getNetwork

public Network getNetwork(java.lang.String name)
                   throws java.io.IOException,
                          java.lang.ClassNotFoundException
Returns the named network from the vault.

Parameters:
name - The name of the network.
Returns:
The network.
Throws:
IOException - Thrown if there is a problem reading the network.
java.lang.ClassNotFoundException - Thrown if there is a problem retrieving the network.

getStorageTag

public DataStorageTag getStorageTag(java.lang.String name)
                             throws java.io.FileNotFoundException,
                                    java.io.IOException,
                                    java.lang.ClassNotFoundException
Returns the data storage tag for the named network.

Parameters:
name - The name of the network.
Returns:
The data storage tag.
Throws:
FileNotFoundException - Thrown if there is a problem reading the tag.
IOException - Thrown if there is a problem reading the tag.
java.lang.ClassNotFoundException - Thrown if there is a problem reading the tag.

listNetworks

public java.util.List listNetworks()
Lists the networks in the vault.

Returns:
A list of the networks in the vault.

removeNetwork

public void removeNetwork(java.lang.String name)
Remove the network from the vault.

Parameters:
name - The name of the network to remove.

setVaultDirectory

public void setVaultDirectory(java.lang.String directory)
Set the directory path for the netwowrk vault.

Parameters:
directory - The file path to the network vault.

updateNetwork

public void updateNetwork(Network network,
                          java.lang.String name)
                   throws java.io.FileNotFoundException,
                          java.io.IOException,
                          java.lang.ClassNotFoundException
Update the given network without changing the data storage tag.

Parameters:
network - The network data.
name - The name of the network to update.
Throws:
FileNotFoundException - Thrown if there is a problem saving the network.
IOException - Thrown if there is a problem saving the network.
java.lang.ClassNotFoundException - Thrown if there is a problem saving the network.

updateNetwork

public void updateNetwork(Network network,
                          DataStorageTag tag,
                          java.lang.String name)
                   throws java.io.IOException
Update the given network and the data storage tag.

Parameters:
network - The network data.
tag - The storage tag to update.
name - The name of the network.
Throws:
IOException - Thrown if there is an error updating the network.