Package org.jcsp.net.cns
Class CNSChannelEndManager
- java.lang.Object
-
- org.jcsp.net.cns.CNSChannelEndManager
-
- All Implemented Interfaces:
NamedChannelEndFactory
,NamedChannelEndManager
public class CNSChannelEndManager extends java.lang.Object implements NamedChannelEndManager
This class implements theNamedChannelEndManager
interface; providing methods for both constructing and destroying channels. This implementation uses the standard Channel Name Server. Instances interact with a localCNSService
through the use of aCNSUser
object. The default constructor assumes the use of the default CNS service and obtains the reference itself. The constructor which takes aCNSUser
object allows the use of an alternative CNS service. ACNSUser
object can be obtained by calling aCNSService
object'sgetUserObject()
method (CNSService.getUserObject()
). For further information seeNamedChannelEndFactory
.- See Also:
NamedChannelEndFactory
,NamedChannelEndManager
,CNSService
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
CNSChannelEndManager.ChannelRegistration
-
Field Summary
Fields Modifier and Type Field Description private java.util.Hashtable
channelInputRegistrations
private java.util.Hashtable
channelOutputsCreated
private CNSUser
cnsUser
private NetChannelEndFactory
factoryToUse
-
Constructor Summary
Constructors Constructor Description CNSChannelEndManager()
Constructor for CNSChannelEndManager.CNSChannelEndManager(CNSUser cnsUser)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
checkCnsService()
NetSharedChannelOutput
createAny2Net(java.lang.String name)
Constructs aNetSharedChannelOutput
object connected to aNetChannelInput
located at a location resolved from the specified channel name.NetSharedChannelOutput
createAny2Net(java.lang.String name, NameAccessLevel accessLevel)
Constructs aNetSharedChannelOutput
object connected to aNetChannelInput
located at a location resolved from the specified channel name that exists in the supplied namespace.NetSharedChannelInput
createNet2Any(java.lang.String name)
Constructs aNetSharedChannelInput
object and registers its location with the supplied name in the global namespace of a channel naming service.NetSharedChannelInput
createNet2Any(java.lang.String name, NameAccessLevel nameAccessLevel)
Constructs aNetSharedChannelInput
object and registers its location with the supplied name in specified namespace of a channel naming service.NetAltingChannelInput
createNet2One(java.lang.String name)
Constructs aNetAltingChannelInput
object and registers its location with the supplied name in the global namespace of a channel naming service.NetAltingChannelInput
createNet2One(java.lang.String name, NameAccessLevel nameAccessLevel)
Constructs aNetAltingChannelInput
object and registers its location with the supplied name in specified namespace of a channel naming service.NetChannelOutput
createOne2Net(java.lang.String name)
Constructs aNetChannelOutput
object connected to aNetChannelInput
located at a location resolved from the specified channel name.NetChannelOutput
createOne2Net(java.lang.String name, NameAccessLevel accessLevel)
Constructs aNetChannelOutput
object connected to aNetChannelInput
located at a location resolved from the specified channel name that exists in the supplied namespace.void
destroyAllChannelEnds()
Destroys all channel ends constructed with this instance of the factory.void
destroyChannelEnd(NetChannelInput chanInEnd)
Destroys an individualNetChannelInput
object that was constructed with this instance.void
destroyChannelEnd(NetChannelOutput chanOutEnd)
Destroys an individualNetChannelOutput
object that was constructed with this instance.
-
-
-
Field Detail
-
channelInputRegistrations
private java.util.Hashtable channelInputRegistrations
-
channelOutputsCreated
private java.util.Hashtable channelOutputsCreated
-
cnsUser
private CNSUser cnsUser
-
factoryToUse
private NetChannelEndFactory factoryToUse
-
-
Constructor Detail
-
CNSChannelEndManager
public CNSChannelEndManager()
Constructor for CNSChannelEndManager.
-
CNSChannelEndManager
public CNSChannelEndManager(CNSUser cnsUser)
-
-
Method Detail
-
checkCnsService
private void checkCnsService()
-
createNet2One
public NetAltingChannelInput createNet2One(java.lang.String name)
Constructs aNetAltingChannelInput
object and registers its location with the supplied name in the global namespace of a channel naming service.- Specified by:
createNet2One
in interfaceNamedChannelEndFactory
- Parameters:
name
- the name against which to register the channel.- Returns:
- the constructed
NetAltingChannelInput
object. - See Also:
NamedChannelEndFactory.createNet2One(String)
-
createNet2One
public NetAltingChannelInput createNet2One(java.lang.String name, NameAccessLevel nameAccessLevel)
Constructs aNetAltingChannelInput
object and registers its location with the supplied name in specified namespace of a channel naming service.- Specified by:
createNet2One
in interfaceNamedChannelEndFactory
- Parameters:
name
- the name against which to register the channel.nameAccessLevel
- the namespace in which to register the name.- Returns:
- the constructed
NetAltingChannelInput
object. - See Also:
NamedChannelEndFactory.createNet2One(String, NameAccessLevel)
-
createNet2Any
public NetSharedChannelInput createNet2Any(java.lang.String name)
Constructs aNetSharedChannelInput
object and registers its location with the supplied name in the global namespace of a channel naming service.- Specified by:
createNet2Any
in interfaceNamedChannelEndFactory
- Parameters:
name
- the name against which to register the channel.- Returns:
- the constructed
NetSharedChannelInput
object. - See Also:
NamedChannelEndFactory.createNet2Any(String)
-
createNet2Any
public NetSharedChannelInput createNet2Any(java.lang.String name, NameAccessLevel nameAccessLevel)
Constructs aNetSharedChannelInput
object and registers its location with the supplied name in specified namespace of a channel naming service.- Specified by:
createNet2Any
in interfaceNamedChannelEndFactory
- Parameters:
name
- the name against which to register the channel.nameAccessLevel
- the namespace in which to register the name.- Returns:
- the constructed
NetSharedChannelInput
object. - See Also:
NamedChannelEndFactory.createNet2Any(String, NameAccessLevel)
-
createOne2Net
public NetChannelOutput createOne2Net(java.lang.String name)
Constructs aNetChannelOutput
object connected to aNetChannelInput
located at a location resolved from the specified channel name.- Specified by:
createOne2Net
in interfaceNamedChannelEndFactory
- Parameters:
name
- the name of the channel from which to resolve the location.- Returns:
- the constructed
NetChannelOutput
object. - See Also:
NamedChannelEndFactory.createOne2Net(String)
-
createOne2Net
public NetChannelOutput createOne2Net(java.lang.String name, NameAccessLevel accessLevel)
Constructs aNetChannelOutput
object connected to aNetChannelInput
located at a location resolved from the specified channel name that exists in the supplied namespace.- Specified by:
createOne2Net
in interfaceNamedChannelEndFactory
- Parameters:
name
- the name of the channel from which to resolve the location.accessLevel
- the namespace in which the channel name exists.- Returns:
- the constructed
NetChannelOutput
object. - See Also:
NamedChannelEndFactory.createOne2Net(String, NameAccessLevel)
-
createAny2Net
public NetSharedChannelOutput createAny2Net(java.lang.String name)
Constructs aNetSharedChannelOutput
object connected to aNetChannelInput
located at a location resolved from the specified channel name.- Specified by:
createAny2Net
in interfaceNamedChannelEndFactory
- Parameters:
name
- the name of the channel from which to resolve the location.- Returns:
- the constructed
NetChannelOutput
object. - See Also:
NamedChannelEndFactory.createAny2Net(String)
-
createAny2Net
public NetSharedChannelOutput createAny2Net(java.lang.String name, NameAccessLevel accessLevel)
Constructs aNetSharedChannelOutput
object connected to aNetChannelInput
located at a location resolved from the specified channel name that exists in the supplied namespace.- Specified by:
createAny2Net
in interfaceNamedChannelEndFactory
- Parameters:
name
- the name of the channel from which to resolve the location.accessLevel
- the namespace in which the channel name exists.- Returns:
- the constructed
NetChannelOutput
object. - See Also:
NamedChannelEndFactory.createAny2Net(String, NameAccessLevel)
-
destroyChannelEnd
public void destroyChannelEnd(NetChannelInput chanInEnd)
Destroys an individualNetChannelInput
object that was constructed with this instance. This will deregister the channel name and destroy the channel end.- Specified by:
destroyChannelEnd
in interfaceNamedChannelEndManager
- Parameters:
chanInEnd
- the channel end to destroy.- See Also:
NamedChannelEndManager.destroyChannelEnd(NetChannelInput)
-
destroyChannelEnd
public void destroyChannelEnd(NetChannelOutput chanOutEnd)
Destroys an individualNetChannelOutput
object that was constructed with this instance. This will simply destroy the channel end.- Specified by:
destroyChannelEnd
in interfaceNamedChannelEndManager
- Parameters:
chanInEnd
- the channel end to destroy.- See Also:
NamedChannelEndManager.destroyChannelEnd(NetChannelOutput)
-
destroyAllChannelEnds
public void destroyAllChannelEnds()
Destroys all channel ends constructed with this instance of the factory.- Specified by:
destroyAllChannelEnds
in interfaceNamedChannelEndManager
- See Also:
o.jcsp.net.cns.NamedChannelEndManager#destroyAllChannelEnds()
-
-