|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--de.tubs.macs.util.net.NetManager
Network Manager.
This class provides methods to
a net implemantation has to provide the following classes:
net.types=lrmp tcp tcp.name=TCP Network tcp.group=localhost/9999 tcp.options=centralized tcp.netclass=de.tubs.macs.util.net.TCP tcp.addressclass=de.tubs.macs.util.net.TCPAddress tcp.dialogclass=de.tubs.macs.util.net.TCPDialog lrmp.name=LRMP Network lrmp.group=225.000.000.000/7000 lrmp.options=15/100 lrmp.netclass=de.tubs.macs.util.net.LRMP lrmp.addressclass=de.tubs.macs.util.net.LRMPAddress lrmp.dialogclass=de.tubs.macs.util.net.LRMPDialog
| Field Summary | |
(package private) Debug |
debug
the debug class and its key string |
(package private) static Log |
log
access to log for this class |
(package private) static Resource |
resource
Resource object |
| Constructor Summary | |
protected |
NetManager(Resource resource,
Log log)
creates a new NetManager. |
| Method Summary | |
boolean |
addAddress(NetAddress address)
add a new address to the set of used addresses. |
boolean |
addressUsed(NetAddress address)
address used ? |
boolean |
addressUsed(java.lang.String type,
java.lang.String group)
address used ? |
NetAddress |
createAddress(java.lang.String type)
creates an address for the given network type and adds it to the set of used addresses |
NetAddress |
createAddress(java.lang.String type,
java.lang.String label)
creates an address for the given network type and adds it to the set of used addresses |
NetAddress |
createAddress(java.lang.String type,
java.lang.String group,
java.lang.String options)
creates an address for the given network type and adds it to the set of used addresses |
void |
delAddress(NetAddress address)
remove an address from the set of used addresses. |
NetAddress |
getAddress(java.lang.String type,
java.util.Hashtable dialogs)
|
NetAddress |
getAddress(java.lang.String type,
java.lang.String group)
Retrieve an address from the set of used addresses. |
NetAddress |
getAddress(java.lang.String type,
java.lang.String name,
java.util.Hashtable dialogs)
Retrieve an address from a dialog. |
java.lang.String |
getName(java.lang.String type)
returns a name of the network type for use in NetSelectorPanel. |
Net |
getNet(NetReceiver receiver,
NetAddress group)
creates a new Net instance for the given group. |
static NetManager |
getNetManager()
returns the NetManager reference. |
static NetManager |
getNetManager(Resource res)
creates a NetManager if not yet done and returns a reference on this |
static NetManager |
getNetManager(Resource res,
Log l)
creates a NetManager if not yet done and returns a reference on this |
java.util.Enumeration |
getNetworks()
returns the enumeration of network-IDs (Strings) of the availabale networks. |
void |
showNetDialog(java.lang.String type,
java.util.Hashtable dialogs)
|
void |
showNetDialog(java.lang.String type,
java.lang.String name,
java.util.Hashtable dialogs)
show the setup dialog for NetAddresses of the given type |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
static Resource resource
static Log log
Debug debug
| Constructor Detail |
protected NetManager(Resource resource,
Log log)
| Method Detail |
public static NetManager getNetManager(Resource res,
Log l)
resource - a resource object holding infos about available networkslog - a log object (if null a new log object is created)public static NetManager getNetManager(Resource res)
resource - a resource object holding infos about available networkspublic static NetManager getNetManager()
public java.util.Enumeration getNetworks()
public java.lang.String getName(java.lang.String type)
type - type of the Network
public NetAddress createAddress(java.lang.String type)
throws NetException
type - the type of the network (tcp, lrmp, ...)
public NetAddress createAddress(java.lang.String type,
java.lang.String label)
throws NetException
type - the type of the network (tcp, lrmp, ...)label - the label for this address (optional, application specific)
public NetAddress createAddress(java.lang.String type,
java.lang.String group,
java.lang.String options)
throws NetException
type - the type of the network (tcp, lrmp, ...)options - options to be used for networks whith this addressgroup - a string representation from a NetAddress of the given type
public NetAddress getAddress(java.lang.String type,
java.lang.String group)
group - a string representation from a NetAddress of the given typetype - the type of the network (tcp, lrmp, ...)
public NetAddress getAddress(java.lang.String type,
java.lang.String name,
java.util.Hashtable dialogs)
throws NetException
If there is no dialog for the given type or the address from that dialog is not valid (e.g. already used somewhere else) a new address will be created and returned by calling createAddress(type). That means that you can use this method even when the user hasn't used any dialog yet.
see showNetDialog() for more details on dialogs.
type - the type of the network (tcp, lrmp, ...)name - the name given for the dialog used to edit this addressdialogs - a Hashtables that contains the dialogs.
public NetAddress getAddress(java.lang.String type,
java.util.Hashtable dialogs)
throws NetException
public boolean addAddress(NetAddress address)
address - the NetAddress to addpublic void delAddress(NetAddress address)
address - the NetAddress to removepublic boolean addressUsed(NetAddress address)
address - the NetAddress to look for
public boolean addressUsed(java.lang.String type,
java.lang.String group)
group - a string representation from a NetAddress of the given typetype - the type of the network (tcp, lrmp, ...)
public Net getNet(NetReceiver receiver,
NetAddress group)
throws NetException
receiver - a NetReceiver which receives the Objectgroup - the address of the network group
public void showNetDialog(java.lang.String type,
java.lang.String name,
java.util.Hashtable dialogs)
when first calling this method use an empty Hashtable
as parameter dialogs and use this Hashtable
for each later call of this method.
showNetDialog() will create the dialogs and store them for
reuse into that Hashtable.
Use getAddress(type, Hashtable) to get/create addresses when you are using dialogs.
Following example shows the typical usage of NetDialogs
Hashtable dialogs = new Hashtable();
// getting an address
NetAddress address = null;
String networkID = ... (network type);
try {
// get address from gialog
address = (NetAddress)netManager.getAddress(networkID, dialogs);
} catch (NetException ne) {
... handle Exception
}
// displaying a dialog
String networkID = ...(network type);
netManager.showNetDialog(networkID, dialogs);
type - the type of the network to create a dialog forname - a name for the dialogdialogs - the dialogs in a Hashtable (key: "type_name")
public void showNetDialog(java.lang.String type,
java.util.Hashtable dialogs)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||